@@ -1169,23 +1169,30 @@ JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
11691169 continue ;
11701170 }
11711171 jl_ptls_t ptls2 = allstates [i ];
1172- if (ptls2 == NULL )
1172+ if (ptls2 == NULL ) {
11731173 continue ;
1174+ }
11741175 small_arraylist_t * live_tasks = & ptls2 -> heap .live_tasks ;
11751176 size_t n = mtarraylist_length (live_tasks );
1177+ int t_state = JL_TASK_STATE_DONE ;
11761178 jl_task_t * t = ptls2 -> root_task ;
1177- int t_state = jl_atomic_load_relaxed (& t -> _state );
1179+ if (t != NULL )
1180+ t_state = jl_atomic_load_relaxed (& t -> _state );
11781181 jl_safe_printf ("==== Thread %d created %zu live tasks\n" ,
11791182 ptls2 -> tid + 1 , n + (t_state != JL_TASK_STATE_DONE ));
11801183 if (show_done || t_state != JL_TASK_STATE_DONE ) {
11811184 jl_safe_printf (" ---- Root task (%p)\n" , ptls2 -> root_task );
1182- jl_safe_printf (" (sticky: %d, started: %d, state: %d, tid: %d)\n" ,
1183- t -> sticky , t -> started , t_state ,
1184- jl_atomic_load_relaxed (& t -> tid ) + 1 );
1185- if (t -> stkbuf != NULL )
1186- jlbacktracet (t );
1187- else
1188- jl_safe_printf (" no stack\n" );
1185+ if (t != NULL ) {
1186+ jl_safe_printf (" (sticky: %d, started: %d, state: %d, tid: %d)\n" ,
1187+ t -> sticky , t -> started , t_state ,
1188+ jl_atomic_load_relaxed (& t -> tid ) + 1 );
1189+ if (t -> stkbuf != NULL ) {
1190+ jlbacktracet (t );
1191+ }
1192+ else {
1193+ jl_safe_printf (" no stack\n" );
1194+ }
1195+ }
11891196 jl_safe_printf (" ---- End root task\n" );
11901197 }
11911198
0 commit comments