@@ -1171,23 +1171,30 @@ JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
11711171 continue ;
11721172 }
11731173 jl_ptls_t ptls2 = allstates [i ];
1174- if (ptls2 == NULL )
1174+ if (ptls2 == NULL ) {
11751175 continue ;
1176+ }
11761177 small_arraylist_t * live_tasks = & ptls2 -> heap .live_tasks ;
11771178 size_t n = mtarraylist_length (live_tasks );
1179+ int t_state = JL_TASK_STATE_DONE ;
11781180 jl_task_t * t = ptls2 -> root_task ;
1179- int t_state = jl_atomic_load_relaxed (& t -> _state );
1181+ if (t != NULL )
1182+ t_state = jl_atomic_load_relaxed (& t -> _state );
11801183 jl_safe_printf ("==== Thread %d created %zu live tasks\n" ,
11811184 ptls2 -> tid + 1 , n + (t_state != JL_TASK_STATE_DONE ));
11821185 if (show_done || t_state != JL_TASK_STATE_DONE ) {
11831186 jl_safe_printf (" ---- Root task (%p)\n" , ptls2 -> root_task );
1184- jl_safe_printf (" (sticky: %d, started: %d, state: %d, tid: %d)\n" ,
1185- t -> sticky , t -> started , t_state ,
1186- jl_atomic_load_relaxed (& t -> tid ) + 1 );
1187- if (t -> stkbuf != NULL )
1188- jlbacktracet (t );
1189- else
1190- jl_safe_printf (" no stack\n" );
1187+ if (t != NULL ) {
1188+ jl_safe_printf (" (sticky: %d, started: %d, state: %d, tid: %d)\n" ,
1189+ t -> sticky , t -> started , t_state ,
1190+ jl_atomic_load_relaxed (& t -> tid ) + 1 );
1191+ if (t -> stkbuf != NULL ) {
1192+ jlbacktracet (t );
1193+ }
1194+ else {
1195+ jl_safe_printf (" no stack\n" );
1196+ }
1197+ }
11911198 jl_safe_printf (" ---- End root task\n" );
11921199 }
11931200
0 commit comments