How to send SIGINT or signal in Xcode?

SIGINT example

Suppose you have the SIGINT handler as above example program in Xcode.

While debugging in Xcode terminal, you may want to send the signal to the process without interrupting the Xcode. (This is proven to work in Xcode Version 12.0 at this time.)

In Xcode, get to enter “pause” mode (Debug –> Pause, or ^⌘Y). Then, type below

process handle SIGINT -s false
process handle SIGINT -p true

, which will stop the Xcode interruption and pass the signal to the process. Now, you can continue to run (Debug –> Continue, or ^⌘Y)

In actual process, you can use either below command

killall -SIGINT <process name>

or

pgrep -fil <process name>
xxx
# Get the xxx PID number, and use this
kill -2 <Process PID number>

Then, it will send the signal to the process, and your handler will get notified if you set.

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *