Batch Backtraces With gdb
Run a program under GDB and print a backtrace without an interactive session.
01Command
$ gdb -batch -ex run -ex bt ./my-program02What it does
The -batch and -ex flags turn GDB into a scriptable debugger that runs commands in order, which is perfect for CI crash triage. Interactive GUIs cannot easily be embedded in an automated pipeline, which is why debugging scripts use the CLI.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- GDB documentationEvidence: Official GDB manual documenting -batch and -ex.
Last verified: 2026-10-13 · Category: Developer
06Related solutions
Send a HEAD request to any URL and print the status line, server, content type, caching, and redirect headers.
Find every occurrence of a pattern across all files in a tree, printed as file:line:number matches.
Generate a modern Ed25519 public/private key pair in ~/.ssh for authenticating to servers and Git platforms without passwords.