Is there a way to print stacktrace of all threads without attaching GDB?
Or is there a command which I can use as gdb batch mode to print stacktrace of all threads?
elfutils among other utilities includes eu-stack
:
eu-stack Print a stack for each thread in a process or core file.
It is faster than gdb or pstack, which is just a shell script wrapper around gdb. To print stack traces run eu-stack
as follows:
$ eu-stack -p 2209
PID 2209 - process
TID 2209:
#0 0x00007f53476b667b __poll
#1 0x00007f5348f98e99 g_main_context_iterate.isra.23
#2 0x00007f5348f99232 g_main_loop_run
#3 0x000055e604b1e56a main
#4 0x00007f53475cc00a __libc_start_main
#5 0x000055e604b1e76a _start
TID 2223:
#0 0x00007f53476b667b __poll
#1 0x00007f5348f98e99 g_main_context_iterate.isra.23
#2 0x00007f5348f98fac g_main_context_iteration
#3 0x00007f5348f98ff1 glib_worker_main
#4 0x00007f5348fc0486 g_thread_proxy
#5 0x00007f534813761b start_thread
#6 0x00007f53476c2c2f __clone
TID 2224:
#0 0x00007f53476b667b __poll
#1 0x00007f5348f98e99 g_main_context_iterate.isra.23
#2 0x00007f5348f99232 g_main_loop_run
#3 0x00007f5349581b56 gdbus_shared_thread_func
#4 0x00007f5348fc0486 g_thread_proxy
#5 0x00007f534813761b start_thread
#6 0x00007f53476c2c2f __clone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With