xcodedebuggingsigint

How do I generate a SIGINT when using XCode to debug?


My console app traps SIGINT so it can exit gracefully.

Pressing CTRL+C inside XCode while the program is being debugged, though, has no effect.

I can find the process and use a terminal window to send a SIGINT to my process, however I'm hoping there's a simpler solution that I can do within XCode.


Solution

  • The pause button of the debugger console actually sends a SIGINT to your app. If you want to make the debugger pass the signal to your app you can do the following:

    1. Press the pause button of the debugger and wait for the debug console to gain focus
    2. Type handle SIGINT pass and press ENTER
    3. Press the Continue button

    Now pressing again the Pause button of the debugger console of Xcode will make the SIGINT hit your app.

    If you don't want the debugger to stop as soon as the SIGINT is caught you might also want to add handle SIGINT nostop to the previous list.