I should be using radare2 instead... but I'm on ARM and don't really want to install radare2
TODO: Install radare2! :D
Just run:
(gdb) run
Run with args from stdin from file
(gdb) run < in.txt
Set args in gdb:
(gdb) set args asdf
(gdb) show args
- Show disassembly:
disassemble main
- Show code:
list main
- Show line:
list 123
- Set breakpoint at line:
break 14
- Set breakpoint at address:
break *0x080000whatever00
- Delete breakpoint:
delete 1
(delete breakpoint number 1) - Show breakpoints:
info break
ORi b
- Ignore breakpoint some amount of times:
ignore 1 100
(ignore breakpoint 1 the first 100 times it's crossed) - Watch variable: `watch src/modules/src/crtp_commander_rpyt.c::
- Show register:
info register
ORinfo register esp
- Show address:
x 0xffffd640
- Show 10 bytes after address:
x/10 0xfffd640
- Show 16 strings after address:
x/16s 0xffff6d40
- List callstack/backtrace:
backtrace
GDB will load any .gdbinit
files it finds in the local directory. It probably finds them elsewhere as well.
The commands in these files will run when gdb starts to initialize your gdb session.
Some people build really insane init files for gdb...
For the Black Magic Probe STM32 programming/debugging tool, this .gdbinit
can be pretty useful:
target extended-remote /dev/cu.usbmodemBDEAA9F1
monitor swdp_scan
attach 1
set confirm off
set mem inaccessible-by-default off
define lc
load
continue
end
define lr
load
run
end