linux – 为什么每次使用’cont’命令时,在gdb中运行时一个CTRL-
发布时间:2020-12-13 23:10:52 所属栏目:Linux 来源:网络整理
导读:我正在研究Ubuntu Linux上的一个项目,当我使用GDB调试应用程序并按CTRL Z中断时,我按预期得到了SIGTSTP和GDB中断. 但是当我在那之后使用cont时,我仍然有SIGTSTP,我重复了很多时间,但接缝它只是行为相同,只是反复给我SIGTSTP. 以下两个调用堆栈或者重复: The
我正在研究Ubuntu
Linux上的一个项目,当我使用GDB调试应用程序并按CTRL Z中断时,我按预期得到了SIGTSTP和GDB中断.
但是当我在那之后使用cont时,我仍然有SIGTSTP,我重复了很多时间,但接缝它只是行为相同,只是反复给我SIGTSTP. 以下两个调用堆栈或者重复: The call stack is as following alterativly: Program received signal SIGTSTP,Stopped (user). [Switching to Thread 0x7fffef73d700 (LWP 32591)] 0x00007ffff636dffd in read () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) bt #0 0x00007ffff636dffd in read () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007ffff6301ff8 in _IO_file_underflow () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007ffff630303e in _IO_default_uflow () from /lib/x86_64-linux-gnu/libc.so.6 #3 0x00007ffff62f718a in _IO_getline_info () from /lib/x86_64-linux-gnu/libc.so.6 #4 0x00007ffff62f606b in fgets () from /lib/x86_64-linux-gnu/libc.so.6 ... .... .... .... #11 0x00007ffff664ee9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #12 0x00007ffff637b3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6 #13 0x0000000000000000 in ?? () (gdb) c Continuing. Program received signal SIGTSTP,Stopped (user). [Switching to Thread 0x7fffeef3c700 (LWP 32592)] 0x00007ffff6374763 in select () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) bt #0 0x00007ffff6374763 in select () from /lib/x86_64-linux-gnu/libc.so.6 ... ... ... ... #6 0x00007ffff664ee9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #7 0x00007ffff637b3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6 #8 0x0000000000000000 in ?? () 那有什么理由吗?谢谢. 解决方法
通常(它是可配置的)gdb安排在程序即将接收信号时停止程序并重新获得对终端的控制.
gdb通常(它是可配置的)在你恢复执行时将信号发送给程序. 可以使用info signals命令查看设置. (gdb) info signals Signal Stop Print Pass to program Description SIGINT Yes Yes No Interrupt ... SIGTSTP Yes Yes Yes Stopped (user) ... 在这种情况下, >键入Ctrl-C将停止程序,继续将恢复它而不向其发送任何信号. 有两种方法可以在不向其发送SIGTSTP信号的情况下恢复程序. 第一种是使用句柄SIGTSTP nopass命令,它将“传递给程序”标志更改为“否”. 第二种是使用signal命令而不是continue.从内置帮助: (gdb) help signal Continue program with the specified signal. Usage: signal SIGNAL The SIGNAL argument is processed the same as the handle command. An argument of "0" means continue the program without sending it a signal. This is useful in cases where the program stopped because of a signal,and you want to resume the program while discarding the signal. 因此,信号0将在没有SIGTSTP信号传递给它的情况下恢复程序. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |