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
helpcommandGet help on a certain command
aproposkeywordSearch 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
quitExit the debugger
fileexenameLoad an executable file by name
Breakpoints and Watchpoints
breaklocationSet a breakpoint at a location, line number, or file (e.g. "main", "5", or "hello.c:23")
watchexpressionBreak when a variable is written to
rwatchexpressionBreak when a variable is read from
awatchexpressionBreak when a variable is written to or read from
info breakDisplay breakpoint and watchpoint information and numbers
info watchSame asinfo break
clearlocationClear a breakpoint from a location
deletenumDelete a breakpoint or watchpoint by number
Stepping and Running
nextRun to the next line of this function
stepStep into the function on this line, if possible
stepiStep a single assembly instruction
continueKeep running from here
CTRL-CStop running, wherever you are
finishRun until the end of the current function
advancelocationAdvance to a location, line number, or file (e.g. "somefunction", "5", or "hello.c:23")
jumplocationJust likecontinue, except jump to a particular location first.
Examining and Modifying Variables
displayexpressionDisplay the value of a variable or expression every step of the program—the expression must make sense in the current scope
info displayShow a list of expressions currently being displayed and their numbers
undisplaynumStop showing an expression identified by its number (seeinfo display)
printexpressionPrint the value of a variable or expression
printfformatstrexpressionlistDo some formatted output withprintf()e.g.printf"i=%d,p=%s\n",i,p
set variableexpressionSet a variable to value, e.g.setvariablex=20
set (expression)Works likeset variable
Window Commands
info winShows current window info
focuswinnameSet focus to a particular window bby name ("SRC", "CMD", "ASM", or "REG") or by position ("next" or "prev")
fsAlias forfocus
layouttypeSet the window layout ("src", "asm", "split", or "reg")
tui regtypeSet the register window layout ("general", "float", "system", or "next")
winheightvalSet the window height (either an absolute value, or a relative value prefaced with "+" or "-")
whAlias forwinheight
setdisassembly-flavorflavorSet the look-and-feel of the disassembly. On Intel machines, valid flavors areintelandatt
Misc Commands
RETURNHit RETURN to repeat the last command
backtraceShow the current stack
btAlias forbacktrace
attachpidAttach to an already-running process by its PID
info registersDump integer registers to screen
info all-registersDump all registers to screen

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值