2016-02-16 00:22:28 +02:00
|
|
|
# gdb
|
|
|
|
|
|
|
|
> The GNU Debugger.
|
2019-06-07 11:58:21 +01:00
|
|
|
> More information: <https://www.gnu.org/software/gdb>.
|
2016-02-16 00:22:28 +02:00
|
|
|
|
|
|
|
- Debug an executable:
|
|
|
|
|
|
|
|
`gdb {{executable}}`
|
|
|
|
|
|
|
|
- Attach a process to gdb:
|
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`gdb {{[-p|--pid]}} {{procID}}`
|
2016-02-16 00:22:28 +02:00
|
|
|
|
2019-05-13 21:24:17 -04:00
|
|
|
- Debug with a core file:
|
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`gdb {{[-c|--core]}} {{core}} {{executable}}`
|
2019-05-13 21:24:17 -04:00
|
|
|
|
2016-02-16 00:22:28 +02:00
|
|
|
- Execute given GDB commands upon start:
|
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`gdb {{[-ex|--eval-command]}} "{{commands}}" {{executable}}`
|
2016-02-16 00:22:28 +02:00
|
|
|
|
2023-06-27 14:57:35 -07:00
|
|
|
- Start `gdb` and pass arguments to the executable:
|
2016-02-16 00:22:28 +02:00
|
|
|
|
|
|
|
`gdb --args {{executable}} {{argument1}} {{argument2}}`
|
2025-02-13 04:27:12 +02:00
|
|
|
|
|
|
|
- Skip debuginfod and pagination prompts and then print the backtrace:
|
|
|
|
|
man, sudo, mount, file, curl, ps, seq, gdb, cat, upower, cal: add option placeholders (#15915)
2025-03-11 08:07:57 +02:00
|
|
|
`gdb {{[-c|--core]}} {{core}} {{executable}} -iex 'set debuginfod enabled on' -iex 'set pagination off' -ex bt`
|