GDB:从阻塞进程中恢复控制

时间:2014-09-04 12:59:05

标签: c++ c linux gdb

我有以下问题:我想在进程进入阻塞情况(即阻塞函数或池循环)时恢复对gdb的控制。

让我们用一个例子来说明:我有进程A,它会分叉进程B.B做它的工作,然后卡在等待来自A的事件。我想把GDB切换到A所以我可以单独运行它直到事件代。但是,我无法从B中恢复GDB的控制。当然我可以在B中生成一个SIGINT信号ctrl + C,然后改为A,但是当我回到B时,即使我处理了传递SIGINT,B也会完成

Log:
Program received signal SIGINT, Interrupt.
[Switching to Thread 0xb68feb40 (LWP 3177)]
0xb7fdeb0c in ?? ()
(gdb) handle SIGINT pass
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) y
Signal        Stop  Print   Pass to program Description
SIGINT        Yes   Yes Yes     Interrupt
(gdb) c
Continuing.
[Thread 0xb7abcb40 (LWP 3178) exited]
[Thread 0xb68feb40 (LWP 3177) exited]
Couldn't get registers: No such process.

(gdb) info inferiors    
Num  Description       
* 2    <null>           
1    process 3168      

有没有办法恢复GDB控制和切换过程而不杀死它?

0 个答案:

没有答案