Skip to content

Instantly share code, notes, and snippets.

@joekir
Last active January 17, 2019 21:11
Show Gist options
  • Save joekir/e5c0527ea42f255b6efc8db12c1d0c2f to your computer and use it in GitHub Desktop.
Save joekir/e5c0527ea42f255b6efc8db12c1d0c2f to your computer and use it in GitHub Desktop.
GDB Tips

gdb commands to remember

command what it does
info sharedlibrary list shared libraries
tui enable enable gui debugger
b <linenumber> add breakpoint at line number
b <function name> add breakpoint for function name
info b show breakpoints
d <breakpoint number> delete a breakpoint by number
set exec-wrapper env <LD...> add some overrides to the environment variables
p <variable> print current value of variable
p *array@len print all array
p /s <stringname> print all array

Running with arguments

$ gdb --args executablename arg1 arg2 arg3
$ gdb -batch -x /tmp/bin/foo --args executablename arg1 arg2 arg3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment