没有合适的资源?快使用搜索试试~ 我知道了~
GDB命令快速查找手册
4星 · 超过85%的资源 需积分: 9 56 下载量 25 浏览量
2008-12-08
14:47:46
上传
评论
收藏 75KB PDF 举报
温馨提示
试读
2页
功能强大的GDB调试工具的命令快查表,对linux下使用命令行调试的朋友大有帮助
资源推荐
资源详情
资源评论
GDB QUICK REFERENCE GDB Version 4
Essential Commands
gdb program [core] debug program [using coredump core]
b [file:]function set breakpoint at function [in file]
run [arglist] start your program [with arglist]
bt backtrace: display program stack
p expr display the value of an expression
c continue running your program
n next line, stepping over function calls
s next line, stepping into function calls
Starting GDB
gdb start GDB, with no debugging files
gdb program begin debugging program
gdb program core debug coredump core produced by
program
gdb --help describe command line options
Stopping GDB
quit exit GDB; also q or EOF (eg C-d)
INTERRUPT (eg C-c) terminate current command, or
send to running process
Getting Help
help list classes of commands
help class one-line descriptions for commands in
class
help command describe command
Executing your Program
run arglist start your program with arglist
run start your program with current argument
list
run . . . <inf >outf start your program with input, output
redirected
kill kill running program
tty dev use dev as stdin and stdout for next run
set args arglist specify arglist for next run
set args specify empty argument list
show args display argument list
show env show all environment variables
show env var show value of environment variable var
set env var string set environment variable var
unset env var remove var from environment
Shell Commands
cd dir change working directory to dir
pwd Print working directory
make . . . call “make”
shell cmd execute arbitrary shell command string
[ ] surround optional arguments . . . show one or more arguments
c
1998 Free Software Foundation, Inc. Permissions on back
Breakpoints and Watchpoints
break [file:]line
b [file:]line
set breakpoint at line number [in file]
eg: break main.c:37
break [file:]func set breakpoint at func [in file]
break +offset
break -offset
set break at offset lines from current stop
break *addr set breakpoint at address addr
break set breakpoint at next instruction
break . . . if expr break conditionally on nonzero expr
cond n [expr] new conditional expression on breakpoint
n; make unconditional if no expr
tbreak . . . temporary break; disable when reached
rbreak regex break on all functions matching regex
watch expr set a watchpoint for expression expr
catch event break at event, which may be catch,
throw, exec, fork, vfork, load, or
unload.
info break show defined breakpoints
info watch show defined watchpoints
clear delete breakpoints at next instruction
clear [file:]fun delete breakpoints at entry to fun()
clear [file:]line delete breakpoints on source line
delete [n] delete breakpoints [or breakpoint n]
disable [n] disable breakpoints [or breakpoint n]
enable [n] enable breakpoints [or breakpoint n]
enable once [n] enable breakpoints [or breakpoint n];
disable again when reached
enable del [n] enable breakpoints [or breakpoint n];
delete when reached
ignore n count ignore breakpoint n, count times
commands n
[silent]
command-list
execute GDB command-list every time
breakpoint n is reached. [silent
suppresses default display]
end end of command-list
Program Stack
backtrace [n]
bt [n]
print trace of all frames in stack; or of n
frames—innermost if n>0, outermost if
n<0
frame [n] select frame number n or frame at address
n; if no n, display current frame
up n select frame n frames up
down n select frame n frames down
info frame [addr] describe selected frame, or frame at addr
info args arguments of selected frame
info locals local variables of selected frame
info reg [rn]. . .
info all-reg [rn]
register values [for regs rn] in selected
frame; all-reg includes floating point
Execution Control
continue [count]
c [count]
continue running; if count specified, ignore
this breakpoint next count times
step [count]
s [count]
execute until another line reached; repeat
count times if specified
stepi [count]
si [count]
step by machine instructions rather than
source lines
next [count]
n [count]
execute next line, including any function
calls
nexti [count]
ni [count]
next machine instruction rather than
source line
until [location] run until next instruction (or location)
finish run until selected stack frame returns
return [expr] pop selected stack frame without
executing [setting return value]
signal num resume execution with signal s (none if 0)
jump line
jump *address
resume execution at specified line number
or address
set var=expr evaluate expr without displaying it; use
for altering program variables
Display
print [/f ] [expr]
p [/f ] [expr]
show value of expr [or last value $]
according to format f:
x hexadecimal
d signed decimal
u unsigned decimal
o octal
t binary
a address, absolute and relative
c character
f floating point
call [/f ] expr like print but does not display void
x [/Nuf ] expr examine memory at address expr; optional
format spec follows slash
N count of how many units to display
u unit size; one of
b individual bytes
h halfwords (two bytes)
w words (four bytes)
g giant words (eight bytes)
f printing format. Any print format, or
s null-terminated string
i machine instructions
disassem [addr] display memory as machine instructions
Automatic Display
display [/f ] expr show value of expr each time program
stops [according to format f ]
display display all enabled expressions on list
undisplay n remove number(s) n from list of
automatically displayed expressions
disable disp n disable display for expression(s) number n
enable disp n enable display for expression(s) number n
info display numbered list of display expressions
资源评论
- yeff1002013-03-20便捷清晰,省的再查。
- dawnkeen2013-08-27简单,好用,verygood!
hnbc_hzl
- 粉丝: 2
- 资源: 35
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MyBatis 动态 SQL:灵活而强大的查询构建器.pdf
- com.accordion.prettyo.apk
- 毕业设计:基于SSM的mysql-ssm软件bug管理系统(源码 + 数据库 + 说明文档)
- MTSQL8.0.35windows(64bit)-mysql-installer-community-8.0.35.0
- 人工智能引领音乐创作新时代之Suno AI
- Public-bicycle-usage-forecast-master.zip
- 通道处理过程模拟:从理论到实践.pdf
- 数据库第七次作业E-R图第一题
- 大厂面试真题Java语法基础面试专题及答案
- IMG20240428211124.jpg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功