nakst/gf

SIGINT received if a breakpoint is placed while the debuggee is inside a syscall

aolo2 opened this issue · 2 comments

aolo2 commented

I have a webserver written using io_uring, so my program spends most of its time waiting on a syscall waiting for completion events. If I then try to place a breakpoint while the program is running, it for some reason gets sent a SIGINT (which stops my server, preventing me from debugging it).

Not sure what details are relevant here, so ask away. Also 333 stars on the repo ⭐!

nakst commented

When you try to place a breakpoint but the target is running, SIGINT is sent to GDB here: https://github.com/nakst/gf/blob/master/gf2.cpp#L571
I was under the impression that this is equivalent to pressing Ctrl+C in a terminal emulator. What happens if you are debugging your server without gf in classic GDB, and press Ctrl+C while it is running?

aolo2 commented

Pressing Ctrl+C sends SIGINT as expected. This turns off my server, as expected. After thinking about it, I think I was just wrong to handle SIGINT that way. I should terminate my server upon receiving SIGTERM instead, leaving SIGINT as is, so as not to break debugging.

I'm closing the issue, sorry for the inconvenience.