2013-07-06 wcdj
在平时工作中经常会用到多进程/多线程,如果程序出现bug如何定位呢?GDB是GNU/Linux环境下常用的C/C++调试工具,下面是关于GDB多进程调试的简单使用说明。
关于守护进程
http://blog.csdn.net/delphiwcdj/article/details/7364343
pstree –H PID
highlight this process and its ancestors
What is GDB?
GDB, the GNU Project debugger, allows you to see what isgoing on `inside' another program while it executes -- or what another programwas doing at the moment it crashed.
GDB can do four main kinds of things (plus other things insupport of these) to help you catch bugs in the act:
- Start your program, specifying anything that might affect its behavior.
- Make your program stop on specified conditions.
- Examine what has happened, when your program has stopped.
- Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.
The program being debugged can be writtenin Ada, C, C++, Objective-C, Pascal (and many other languages). Those programsmight be executing on the same machine as GDB (native) or on another machine(remote). GDB can run on most popular UNIX and Microsoft Windows variants.
GDB多进程调试
使用 GDB 调试多进程程序的子程序
http://wenku.baidu.com/view/721d830003d8ce2f00662392.html
[1] GDB: The GNU Project Debugger
http://www.gnu.org/software/gdb/
[2] Debugging Under Unix: gdb Tutorial
http://www.cs.cmu.edu/~gilpin/tutorial/
[2] 用 GDB 调试程序
http://oss.org.cn/ossdocs/gnu/linux/gdb.html
[3] GDB调试精粹及使用实例
http://fanqiang.chinaunix.net/program/other/2006-07-14/4834.shtml