`

GDB 调试相关

 
阅读更多

之前利用gdb查看内存数据,定位到了一个内存泄露的问题,但是没有很好的将一些当时用到的资料收集起来,这次汇集下以便以后参考:

 

1:Debugging with gdb

http://sourceware.org/gdb/download/onlinedocs/gdb/index.html

 

2:GNU GDB Debugger Command Cheat Sheet

http://www.yolinux.com/TUTORIALS/GDB-Commands.html

 

 

3:GDB调试器

http://www.ruchee.com/code/linux/gnu/gdb.html

 

4:linux  gdb

http://blog.csdn.net/lw1a2/article/details/5598006

 

gdb转储内存使用到的命令参考自:

http://sourceware.org/gdb/onlinedocs/gdb/Logging-Output.html

 

 

set logging onEnable logging. 
set logging offDisable logging. 
set logging file fileChange the name of the current logfile. The default logfile is 

gdb.txt


set logging overwrite [on|off]By default, gdb will append to the logfile. Set overwrite if you want set logging on to overwrite the logfile instead. 
set logging redirect [on|off]By default, gdb output will go to both the terminal and the logfile. Set redirect if you want output to go only to the log file. 
show loggingShow the current values of the logging settings.

 

gdb内存查看参考自:

1: Examining Memory

http://sourceware.org/gdb/onlinedocs/gdb/Memory.html#Memory

 

2:Output Formats

http://sourceware.org/gdb/onlinedocs/gdb/Output-Formats.html#Output-Formats

 

简单的gdb内存转储的例子如下:

 

>> set logging on
>> x/[n][format]  startHexAddress

 结果是生成一个gdb.txt的默认文件。

 n是指需要从起始地址转储多少单位内存数据,例如假设需要查看的数据是4*1024 byte,然后按照byte的大小来查看, 则n需要设置为4*1024

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics