Debugging a segmentation fault when I do ctrl c

≡放荡痞女 提交于 2019-12-02 23:54:30
Charlie Martin

gdb is intercepting the signal. When you press CTRL-C, you're actually causing the terminal driver to generate a SIGINT.

What you need to do is have GDB generate the SIGINT using the signal command. the syntax is

signal num

and man signal will tell you the signal number (in this case, SIGINT is signal 2, so signal 2 will do it.)

Update

Sure enough, you can use the symbolic name. info signal will tell you all the names etc.

Oh, by the way, odds are that you have a signal handler installed for SIGINT and the arguments aren't right somehow.

An alternative is to stop gdb from catching the SIGINT by typing handle SIGINT noprint pass at the gdb prompt before running the program.

One option is to load the core file produced when not running in the debugger into gdb. From within gdb, type core-file [filename].

You can also send the CTRL-C (aka SIGINT) from another terminal: kill -INT

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!