Go up to the main documents page (md)
Assembly-specific commands
stepi: step one MACHINE instruction (i.e. assembly instruction), instead of one C++ instruction (which is what step does)info registers: display the values in the registersset disassembly-flavor intel: set the assembly output format to what we are used to in class (and what we are programming in)disassemble: like list, but displays the lines of assembly code currently being executed.disassemble (function): prints the assembly code for the supplied function (up until the next label)Program execution
run: starts a program execution, and continues until it exits, crashes, or hits a breakpointstart: starts a program execution, and breaks when it enters the main() functionbt: prints a back trace, which is the list of function calls that got to the current pointlist: shows the lines of source code before and after the point at which the program pausedlist (function): prints the lines of code around (function) or the current breakpoint otherwise if no (function) is provided.up: move up the back trace function stack listdown: move down the back trace function stack liststep (or just s): step INTO the next line of code to executenext (or just n): step OVER the next line of code to executecontinue (or just c): continue executionfinish: finishes executing the current function and then pausesquit: exits the debuggerBreakpoints
b (pos) (or break (pos)): set a breakpoint at (pos). A breakpoint can be a function name (e.g., b GetMax), a line number (e.g., b 22), or either of the above preceded by a file name (e.g., b lab2.cpp:22 or b lab2.cpp:GetMax)tbreak (pos): set a temporary breakpoint (only breaks the first time)info break: show breakpointsdelete (or just d): deletes all breakpointsdelete (num): delete the breakpoint indicated by (num)Examining data
print (var) (or p): print the value in the given variableprint &(var): print the address that the given variable is locatedprint *(ptr): print the destination of a pointerx/(format) (var/address): format controls how the memory should be displayed, and consists of (up to) 3 components: a numeric count of how many elements to display; a single-character format, indicating how to interpret and display each element -- e.g. a few of the flags are x/x displays in hex, x/d displays in signed decimals, x/c displays in characters, x/i displays in instructions, and x/s displays in C strings; and a single-character size, indicating the size of each element to display -- e.g. b, h, w, and g, for one-, two-, four-, and eight-byte blocks, respectively. You can have multiple at a time, e.g. x/30x (var/address) will display 30 elements in hexidecimal from the provided var/address OR if no var/address is provided, from the top of the stack.info locals: display all the local variables and their valuesdisplay (var): always display the value in (var) whenever the program pausesdisplay: show the variables that have been entered with display and their numeric IDsundisplay (num): stop displaying the variable with numeric ID numprint function_call(params): execute the function, and print the resultset variable (var) = (value): set the variable (var) to the value (value) -- e.g. set variable foo = 5frame x: moves to frame x in the backtrace (bt) of a crashed or paused program