How to debug programs using signals?

后端 未结 1 1779
长情又很酷
长情又很酷 2020-12-14 03:37
#include  
#include 

static volatile sig_atomic_t being_debugged = 1;
static void int3_handler(int signo) { being_debugged = 0; }

in         


        
相关标签:
1条回答
  • 2020-12-14 04:09

    GDB will stop the inferior (being debugged) program when the inferior receives any signal.

    If you simply continue from GDB, the signal will be "swallowed", which is not what you want.

    You can ask GDB to continue the program and send it a signal with signal SIGTRAP.

    You can also ask GDB to pass a given signal directly to the inferior, and not stop at all with handle SIGTRAP nostop noprint pass GDB command. You'll need to do that before you hit the first SIGTRAP.

    0 讨论(0)
提交回复
热议问题