thread apply all bt
There is a thread apply all command in GDB:
(gdb) thread apply all bt
Thread 12 (Thread 0x7f7fe2116700 (LWP 5466)):
#0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1 0x0000000000425358 in ?? ()
...
Thread 1 (Thread 0x7f7feabc27c0 (LWP 5465)):
#0 0x00007f7fe76c5203 in select () at ../sysdeps/unix/syscall-template.S:82
Sadly, GDB seems not to be able to read the commands from a pipe, so to run the commands in its batch mode, a temporary file must be used:
$ gdbbt() {
tmp=$(tempfile)
echo thread apply all bt >"$tmp"
gdb -batch -nx -q -x "$tmp" -p "$1"
rm -f "$tmp"
}
$ gdbbt $(pidof $SHELL)
阅读(1626) | 评论(0) | 转发(0) |