Quick Linux Tip #11:
Try: sudo gdb -p 1234 -batch -ex 'thread apply all bt' -ex 'quit'
Info: gdb can attach to running processes and dump stack traces without stopping them. Essential for debugging production issues where you cannot restart the service.
Examples:
- $ sudo gdb -p $(pgrep nginx) -batch -ex 'bt'
- $ sudo strace -p 1234 -f -e trace=network
- $ sudo perf record -p 1234 -g sleep 30
Note: gdb briefly pauses the process. For production, use perf or strace for less impact. Requires debug symbols for best results.
Leave a Reply