GDB常用命令快速查询(英文版)

节选自:http://beej.us/guide/bggdb/


Command parameters are in italics. Optional parameters are in square brackets. All commands can be abbreviated until they become ambiguous.

This list is very very incomplete, and only shows things talked about in this tutorial!

Help Commands
helpcommand Get help on a certain command
aproposkeyword Search help for a particular keyword
Starting and Quitting
gdb[-tui] [-c core] [exename] (Unix Command)Startgdbon an executable or standalone; specify "-tui" to start the TUI GUI; specify "-c" with a corefile name to see where a crash occurred
run[arg1] [arg2] [...] Run the currently loaded program with the given command line arguments
quit Exit the debugger
fileexename Load an executable file by name
Breakpoints and Watchpoints
breaklocation Set a breakpoint at a location, line number, or file (e.g. "main", "5", or "hello.c:23")
watchexpression Break when a variable is written to
rwatchexpression Break when a variable is read from
awatchexpression Break when a variable is written to or read from
info break Display breakpoint and watchpoint information and numbers
info watch Same asinfo break
clearlocation Clear a breakpoint from a location
deletenum Delete a breakpoint or watchpoint by number
Stepping and Running
next Run to the next line of this function
step Step into the function on this line, if possible
stepi Step a single assembly instruction
continue Keep running from here
CTRL-C Stop running, wherever you are
finish Run until the end of the current function
advancelocation Advance to a location, line number, or file (e.g. "somefunction", "5", or "hello.c:23")
jumplocation Just likecontinue, except jump to a particular location first.
Examining and Modifying Variables
displayexpression Display the value of a variable or expression every step of the program—the expression must make sense in the current scope
info display Show a list of expressions currently being displayed and their numbers
undisplaynum Stop showing an expression identified by its number (seeinfo display)
printexpression Print the value of a variable or expression
printfformatstrexpressionlist Do some formatted output withprintf()e.g.printf"i=%d,p=%s\n",i,p
set variableexpression Set a variable to value, e.g.setvariablex=20
set (expression) Works likeset variable
Window Commands
info win Shows current window info
focuswinname Set focus to a particular window bby name ("SRC", "CMD", "ASM", or "REG") or by position ("next" or "prev")
fs Alias forfocus
layouttype Set the window layout ("src", "asm", "split", or "reg")
tui regtype Set the register window layout ("general", "float", "system", or "next")
winheightval Set the window height (either an absolute value, or a relative value prefaced with "+" or "-")
wh Alias forwinheight
setdisassembly-flavorflavor Set the look-and-feel of the disassembly. On Intel machines, valid flavors areintelandatt
Misc Commands
RETURN Hit RETURN to repeat the last command
backtrace Show the current stack
bt Alias forbacktrace
attachpid Attach to an already-running process by its PID
info registers Dump integer registers to screen
info all-registers Dump all registers to screen

你可能感兴趣的:(常用命令)