Nick Frolov
Nick Frolov

Reputation: 1855

XCode debugger stops with SIGKILL on Stop button

I am using XCode 4.2 on MacOS Lion. When debugging an iPhone/iPad app in Simulator, I am using "Stop" button on XCode toolbar (Product | Stop) to exit the app. Very often after this, XCode opens main.m file, puts the execution pointer on UIApplicationMain call and says "Program received SIGKILL". In about a second after that it breaks off debug mode, so I can not debug this error. My app involves lots of threads, so, my guess is it can be related to resources being pulled out when threads are still working, or something like that. This may even be normal, and I do not care very much about this problem, because the app is being terminated anyway. But seeing this SIGKILL after every debug is really annoying. How can I debug it? Alternatively, is there a way to disable it?

EDIT: there's nothing in the console except the usual activity log (no crash details like with regular exceptions).

Upvotes: 4

Views: 5303

Answers (5)

Kyle Clegg
Kyle Clegg

Reputation: 39470

It seems to me that jrturton's solution doesn't really get around the problem. I'm specifically stopping the app so I can test saving data using NSUserDefaults.

My suggestion is to hit STOP right after running so that the debugger is no longer monitoring the app. Then you are free to close the app and reopen it as you wish. Doing this I was able to check that NSUserDefaults were being saved correctly without having to step through the debugger every time I killed and reopened the app.

Upvotes: 1

Bart van Kuik
Bart van Kuik

Reputation: 4862

If you use a trackpad, one workaround is to "swipe left" in the editor area. This will move main.c away, and open the previously edited file.

Upvotes: 0

user401925
user401925

Reputation:

If you prefer to stop your app while editing code, you can try my answer given here:

Xcode 4.2 jumps to main.m every time after stopping simulator

Upvotes: 0

Sebastian
Sebastian

Reputation: 2339

To prevent Xcode 4 from shortly halting and switching to the main.m, you can turn off debug mode(?) by clicking the Breakpoints button before pressing the Stop button.

Upvotes: 0

jrturton
jrturton

Reputation: 119242

SIGKILL is what you are sending to the process when you stop the debugger. There isn't anything wrong, but sometimes it does show up and switch you to the main.m file which is useless and annoying.

To get around it, don't bother stopping the executable from Xcode. Just leave it running, and when you want to run again, just re-launch with the "Play" button and the previous task will be terminated anyway.

Upvotes: 7

Related Questions