p/xstuff displays stuff in hexadecimal
print $eaxdisplays the value of register
xstuff displays the value pointed at by stuff
displaystuff displays stuff after each command
undisplaystuff removes display number stuff
info registersdisplays the contents of all registers, including some you've never heard of, in both hexadecimal and decimal.
/sstring (displays ascii values until a NUL is encounte
display /i $eipis a useful command. It displays the value pointed at by
$eipafter each command and interprets it as an instruction. Basically it shows the next instruction to be run. Also, if a size and number are given, it will print that many of those size items after the given thing. So, for example,
x/20w $espdisplays 20 words at and after
$esp. The available sizes are:
/w /code> word
Setting and removing single breakpoints:
break (some function
break (line number
break *(some memory address
delete (breakpoint number
Removing all breakpoints:
clear[clears current break point]
clear (some function
clear (some line number
clear *(some memory address
runarg1 arg2 ... starts or restarts the program with the given arguments
runstarts or restarts the program at full speed. If restarting, uses the same arguments used last time.
stepsteps by one line of source code, going into function calls. This only works after the program is running, so you usually need to set a breakpoint somewhere so that you can get to where you want to start stepping.
nextsteps by one line of source code, not going into function calls
stepisteps by one instruction, going into function calls
nextisteps by one instruction, not going into function calls
continuegoes at full speed after a breakpoint
killend the running program
enterdo the same command again.
finishstep out of the current function.
backtraceshows the current stack.
frameN goes to the Nth stack frame.
info localsprints all local variables.
info argsprints all of the arguments to the current function as they are now (as opposed to as they were at the top of the function).
callfunction calls function. Arguments can be provided. Note: this works by pushing arguments on the stack, resetting
%eipto point the the function, and letting the program run. In some circumstances, this can fail
whatissomething prints the type of something
set args (stuff
)passes stuff as command line arguments to the program the next time
filestuff sets stuff as the program to be run and debugged.
print/d 0xsome hex number will convert it to decimal
print/xsome decimal number will convert it to hex
info bwill tell you how many times a breakpoint has been hit.
cn) will continue past a breakpoint n times. For example, if the fourth call to a function is the one that fails, you can use "
c 3" to skip the first three calls.
c 9999999". When it crashes, use
info bto find out how many times the function was called. Then rerun the program and use
continuen-1 to get to the invocation that crashes.
© 2007, Geoff Kuenning
This page is maintained by Geoff Kuenning.