开发者

Terminate program hitting CTRL+C within GDB

开发者 https://www.devze.com 2023-04-13 08:28 出处:网络
My开发者_运维技巧 program is determined to stop its execution by hitting CTRL+C in command window. By now, I have a critical error right in this stopping phase, so i want to debug with gdb.

My开发者_运维技巧 program is determined to stop its execution by hitting CTRL+C in command window. By now, I have a critical error right in this stopping phase, so i want to debug with gdb.

Problem is, gdb redefines CTRL+C as its own interrupt and pauses the execution when hitted. How can I handle it that CTRL+C powers my programm off and gdb can catch the stack trace?


From the (gdb) prompt, type signal SIGINT. This will send (surprize) SIGINT to the program being debugged.

Alternatively, handle SIGINT nostop print pass will make GDB pass the signal straight to the inferior (being debugged) process.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号