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