Skip to content

Commit

Permalink
47933.patch (#3)
Browse files Browse the repository at this point in the history
Add option to `jl_print_task_backtraces(bool)` to control whether or not to print DONE tasks (JuliaLang#47933)
  • Loading branch information
NHDaly authored and kpamnany committed Mar 24, 2023
1 parent 6fa4399 commit 10d466a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/stackwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ JL_DLLEXPORT void jl_print_backtrace(void) JL_NOTSAFEPOINT
// Print backtraces for all live tasks, for all threads.
// WARNING: this is dangerous and can crash if used outside of gdb, if
// all of Julia's threads are not stopped!
JL_DLLEXPORT void jl_print_task_backtraces(void) JL_NOTSAFEPOINT
JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
{
for (size_t i = 0; i < jl_n_threads; i++) {
jl_ptls_t ptls2 = jl_all_tls_states[i];
Expand All @@ -1130,9 +1130,13 @@ JL_DLLEXPORT void jl_print_task_backtraces(void) JL_NOTSAFEPOINT
void **lst = live_tasks->items;
for (size_t j = 0; j < live_tasks->len; j++) {
jl_task_t *t = (jl_task_t *)lst[j];
int t_state = jl_atomic_load_relaxed(&t->_state);
if (!show_done && t_state == JL_TASK_STATE_DONE) {
continue;
}
jl_safe_printf(" ---- Task %zu (%p)\n", j + 1, t);
jl_safe_printf(" (sticky: %d, started: %d, state: %d, tid: %d)\n",
t->sticky, t->started, jl_atomic_load_relaxed(&t->_state),
t->sticky, t->started, t_state,
jl_atomic_load_relaxed(&t->tid) + 1);
if (t->stkbuf != NULL)
jlbacktracet(t);
Expand Down

0 comments on commit 10d466a

Please sign in to comment.