Last active
November 7, 2020 10:07
-
-
Save pmauduit/4287311784454de5d484 to your computer and use it in GitHub Desktop.
My gdb cheat sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List breakpoints: | |
| i b | |
| Show register state: | |
| i r | |
| Change / relocate sources: | |
| set substitute-path /path/to/a /another/to/a | |
| Conditional breakpoints: | |
| b [place] if [expr] | |
| b truc.c:154 if a == b | |
| Print / inspect memory segment: | |
| x/[length]xb [*pointer] | |
| x/128xb map->img->raw_bytes | |
| Run (from the begining): | |
| r [+args] | |
| Backtrace: | |
| bt | |
| Print out the memory address of a variable (prefix with &): | |
| (gdb) p & this->map->extent.minx | |
| $11 = (double *) 0x9210f8 | |
| Put a watchpoint (breaks if memory written) on an address: | |
| (gdb) watch * 0x9210f8 | |
| (awatch for also tracking read) | |
| step into: | |
| s | |
| step over: | |
| n | |
| step out: | |
| finish | |
| UI mode: | |
| lay src | |
| lay asm | |
| lay regs | |
| Back to console mode: | |
| CTRL+x + a | |
| step into / next by instruction (asm): | |
| si / ni | |
| Print a supposed structure: | |
| p *((FILE *) $rax) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment