Skip to content

Commit 5f7beed

Browse files
committed
Change the API for jl_print_task_backtraces to take a bool
1 parent c9934eb commit 5f7beed

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/stackwalk.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,10 @@ JL_DLLEXPORT void jl_print_backtrace(void) JL_NOTSAFEPOINT
11231123
jlbacktrace();
11241124
}
11251125

1126-
void _jl_print_task_backtraces(int skip_done) JL_NOTSAFEPOINT
1126+
// Print backtraces for all live tasks, for all threads.
1127+
// WARNING: this is dangerous and can crash if used outside of gdb, if
1128+
// all of Julia's threads are not stopped!
1129+
void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
11271130
{
11281131
size_t nthreads = jl_atomic_load_acquire(&jl_n_threads);
11291132
jl_ptls_t *allstates = jl_atomic_load_relaxed(&jl_all_tls_states);
@@ -1144,7 +1147,7 @@ void _jl_print_task_backtraces(int skip_done) JL_NOTSAFEPOINT
11441147
for (size_t j = 0; j < live_tasks->len; j++) {
11451148
jl_task_t *t = (jl_task_t *)lst[j];
11461149
int t_state = jl_atomic_load_relaxed(&t->_state);
1147-
if (skip_done && t_state == JL_TASK_STATE_DONE) {
1150+
if (!show_done && t_state == JL_TASK_STATE_DONE) {
11481151
continue;
11491152
}
11501153
jl_safe_printf(" ---- Task %zu (%p)\n", j + 1, t);
@@ -1161,17 +1164,6 @@ void _jl_print_task_backtraces(int skip_done) JL_NOTSAFEPOINT
11611164
}
11621165
jl_safe_printf("==== Done\n");
11631166
}
1164-
// Print backtraces for all live tasks, for all threads.
1165-
// WARNING: this is dangerous and can crash if used outside of gdb, if
1166-
// all of Julia's threads are not stopped!
1167-
JL_DLLEXPORT void jl_print_task_backtraces(void) JL_NOTSAFEPOINT
1168-
{
1169-
_jl_print_task_backtraces(0);
1170-
}
1171-
JL_DLLEXPORT void jl_print_task_backtraces_skip_done(void) JL_NOTSAFEPOINT
1172-
{
1173-
_jl_print_task_backtraces(1);
1174-
}
11751167

11761168
#ifdef __cplusplus
11771169
}

0 commit comments

Comments
 (0)