http://baike.baidu.com/view/639266.htm
文件清单
执行程序
显示数据
断点
断点管理
变量检查赋值
单步执行
函数调用
机器语言工具
http://www.bobbog.com/archives/24
GDB 内存断点的使用例子:
http://blog.csdn.net/livelylittlefish/article/details/5110234#quote
在使用的过程中有什么忘掉了或是不懂的就直接help,查看帮助信息:
(gdb) help
List of classes of commands:
aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands
Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
比如,我的可执行文件包含多个C/C++ 源文件,想查看其中一个文件的指定行,使用list 命令,help 如下
(gdb) help list
List specified function or line.
With no argument, lists ten more lines after or around previous listing.
"list -" lists the ten lines before a previous ten-line listing.
One argument specifies a line, and ten lines are listed around that line.
Two arguments with comma between specify starting and ending lines to list.
Lines can be specified in these ways:
LINENUM, to list around that line in current file,
FILE:LINENUM, to list around that line in that file,
FUNCTION, to list around beginning of that function,
FILE:FUNCTION, to distinguish among like-named static functions.
*ADDRESS, to list around the line containing that address.
With two args if one is empty it stands for ten lines away from the other arg.
数据读断点/写断点 :
(gdb) help awatch
Set a watchpoint for an expression.
Usage: awatch [-l|-location] EXPRESSION
A watchpoint stops execution of your program whenever the value of
an expression is either read or written.
If -l or -location is given, this evaluates EXPRESSION and watches
the memory to which it refers.
数据写断点:
(gdb) help watch
Set a watchpoint for an expression.
Usage: watch [-l|-location] EXPRESSION
A watchpoint stops execution of your program whenever the value of
an expression changes.
If -l or -location is given, this evaluates EXPRESSION and watches
the memory to which it refers.