I am running gdb and want to examine one of those unfortunate god objects. It takes many pages (and I have a 24\" monitor turned sideways!) to see the whole thing. For eas
I had a backtrace that was so long (over 100k lines) that holding down the enter key was taking too long. I found a solution to that:
Andreas Schneider's bt command writes a backtrace to file without any user interaction – just prefix your command with bt .
Here, I've turned it into a script:
#!/usr/bin/env bash
ex=(
-ex "run"
-ex "set logging overwrite on"
-ex "set logging file gdb.bt"
-ex "set logging on"
-ex "set pagination off"
-ex "handle SIG33 pass nostop noprint"
-ex "echo backtrace:\n"
-ex "backtrace full"
-ex "echo \n\nregisters:\n"
-ex "info registers"
-ex "echo \n\ncurrent instructions:\n"
-ex "x/16i \$pc"
-ex "echo \n\nthreads backtrace:\n"
-ex "thread apply all backtrace"
-ex "set logging off"
-ex "quit"
)
echo 0 | gdb -batch-silent "${ex[@]}" --args "$@"