GDB:Ctrl + C不会像通常那样中断进程,而是终止程序 [英] GDB: Ctrl+C doesn't interrupt process as it usually does but rather terminates the program

查看:1282
本文介绍了GDB:Ctrl + C不会像通常那样中断进程,而是终止程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,当你通过GDB运行一个程序时,你可以按下Ctrl + C来中断它,如果它陷入一个无限循环并且你想要回溯。

我正在调试一个程序(xmms2d,因为它发生了),但只在这个程序中,当我按下Ctrl + C,就像GDB没有运行一样 - 程序关闭,然后GDB告诉我程序正常退出。



如何获取通常的GDB行为回来,其中Ctrl + C中断程序?或者有另外一种方法可以在GDB中产生与Ctrl + C通常一样的反应?

我会打赌xmms2d使用sigwait()来处理信号,这打破了gdb捕捉CTRL-C的能力。请参阅 https://bugzilla.kernel.org/show_bug.cgi?id=9039



通过阅读继续调试失败后,我得到了一个解决方法在Linux上断言? - 当我准备在gdb中断时,我运行kill -TRAP< pid>从另一个终端窗口。

Normally when you run a program through GDB you can press Ctrl+C to interrupt it, e.g. if it gets stuck in an infinite loop and you want to get a backtrace.

I'm debugging a program (xmms2d as it happens) but in this program only, when I press Ctrl+C it gets treated as if GDB was not running - the program shuts down cleanly and then GDB tells me the program exited normally.

How do I get the usual GDB behaviour back, where Ctrl+C interrupts the program? Or is there another way to produce the same reaction in GDB as a Ctrl+C normally does?

解决方案

I'll bet that xmms2d is using sigwait() to handle signals, which breaks gdb's ability to catch CTRL-C. See https://bugzilla.kernel.org/show_bug.cgi?id=9039

I got an idea for a workaround by reading Continue to debug after failed assertion on Linux? -- when I'm ready to break in gdb, I run "kill -TRAP <pid>" from another terminal window.

这篇关于GDB:Ctrl + C不会像通常那样中断进程,而是终止程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆