mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
34 lines
844 B
Plaintext
34 lines
844 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# gdb
|
|
|
|
> The GNU Debugger.
|
|
> More information: <https://sourceware.org/gdb/current/onlinedocs/gdb#Invocation>.
|
|
|
|
- Debug an executable:
|
|
|
|
`gdb {{path/to/executable}}`
|
|
|
|
- Attach a process to `gdb`:
|
|
|
|
`gdb {{[-p|--pid]}} {{procID}}`
|
|
|
|
- Debug with a core file:
|
|
|
|
`gdb {{[-c|--core]}} {{path/to/core}} {{path/to/executable}}`
|
|
|
|
- Execute given GDB commands upon start:
|
|
|
|
`gdb {{[-ex|--eval-command]}} "{{commands}}" {{path/to/executable}}`
|
|
|
|
- Start `gdb` and pass arguments to the executable:
|
|
|
|
`gdb --args {{path/to/executable}} {{argument1 argument2 ...}}`
|
|
|
|
- Skip `debuginfod` and pagination prompts and then print the backtrace:
|
|
|
|
`gdb {{[-c|--core]}} {{path/to/core}} {{path/to/executable}} -iex 'set debuginfod enabled on' -iex 'set pagination off' -ex bt`
|