| 发表于:2007-05-16 23:34:133楼 得分:0 |
需要的gdb版本高一些 详细解释如下: multiprocess application debugging one problem with the debugging of multiprocess applications is which process to follow when a new process is created. recall from chapter 12, “introduction to sockets programming,” that the fork function returns to both the parent and child processes. we can tell gdb which to returns to follow using the follow-fork-mode command. for example, if we wanted to debug the child process, we'd specify to follow the child process as: set follow-fork-mode child or, if we instead wanted to follow the parent (the default mode), we'd specify this as: set follow-fork-mode parent in either case, when gdb follows one process, the other process (child or parent) continues to run unimpeded. we can also tell gdb to ask us which process to follow when a fork occurs, as: set follow-fork-mode ask when the fork occurs, gdb will ask which to follow. whichever is not followed will EXECute normally. | | |
|