@@ -1158,23 +1158,30 @@ JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
1158
1158
continue ;
1159
1159
}
1160
1160
jl_ptls_t ptls2 = allstates [i ];
1161
- if (ptls2 == NULL )
1161
+ if (ptls2 == NULL ) {
1162
1162
continue ;
1163
+ }
1163
1164
small_arraylist_t * live_tasks = & ptls2 -> heap .live_tasks ;
1164
1165
size_t n = mtarraylist_length (live_tasks );
1166
+ int t_state = JL_TASK_STATE_DONE ;
1165
1167
jl_task_t * t = ptls2 -> root_task ;
1166
- int t_state = jl_atomic_load_relaxed (& t -> _state );
1168
+ if (t != NULL )
1169
+ t_state = jl_atomic_load_relaxed (& t -> _state );
1167
1170
jl_safe_printf ("==== Thread %d created %zu live tasks\n" ,
1168
1171
ptls2 -> tid + 1 , n + (t_state != JL_TASK_STATE_DONE ));
1169
1172
if (show_done || t_state != JL_TASK_STATE_DONE ) {
1170
1173
jl_safe_printf (" ---- Root task (%p)\n" , ptls2 -> root_task );
1171
- jl_safe_printf (" (sticky: %d, started: %d, state: %d, tid: %d)\n" ,
1172
- t -> sticky , t -> started , t_state ,
1173
- jl_atomic_load_relaxed (& t -> tid ) + 1 );
1174
- if (t -> stkbuf != NULL )
1175
- jlbacktracet (t );
1176
- else
1177
- jl_safe_printf (" no stack\n" );
1174
+ if (t != NULL ) {
1175
+ jl_safe_printf (" (sticky: %d, started: %d, state: %d, tid: %d)\n" ,
1176
+ t -> sticky , t -> started , t_state ,
1177
+ jl_atomic_load_relaxed (& t -> tid ) + 1 );
1178
+ if (t -> stkbuf != NULL ) {
1179
+ jlbacktracet (t );
1180
+ }
1181
+ else {
1182
+ jl_safe_printf (" no stack\n" );
1183
+ }
1184
+ }
1178
1185
jl_safe_printf (" ---- End root task\n" );
1179
1186
}
1180
1187
0 commit comments