strings a.out
nm --format sysv a.out # dump the symbol table in the a.out file objdump -t a.out # dump the symbol table in the a.out file
See the week 4 lab page for more information and examples. Here are a summary of some of the most useful commands:
ddd a.out (gdb) break main (gdb) run 6 # run with the command line argument 6 (gdb) disass main (gdb) break theSwitchWay2 # set a break point at the begining of a function (gdb) cont (gdb) break *0x0804851a # set a break point and memory address 0x0804851a (gdb) ni # execute the next instruction (gdb) si # step into a function call (step instruction) (gdb) info registers (gdb) p *(int *)($ebp + 8) # print out the value of an int at addr 0x88760 (gdb) x/d $ebp + 8 # examine the contents of memory at the given address # (interpret it as an int) (gdb) p %eax
Figure 3.30 on p.255 of the textbook lists gdb commands.