2

I'm coming from using visual studio. When I run in XCode and I get an error, it just says something like SIGABRT, but there are no helpful error messages like in VS, it doesn't point me to any code. There is just a list of memory addresses and threads.

How do I make it display messages like VS?

Dollarslice
  • 9,917
  • 22
  • 59
  • 87
  • Look at this answer on how to enable exception breakpoints http://stackoverflow.com/questions/7703052/xcode-doesnt-show-line-that-caused-a-crash Also you should post some code! – JonasG Jan 23 '12 at 17:00
  • thanks for the link but unfortunately my error is even less. Literally (not exagerating) NO information other than sigabrt (apart from the line that caused it, which is `return UIApplicationMain(argc, argv, nil, NSStringFromClass([IntegrationTestAppDelegate class]));` in main. – Dollarslice Jan 23 '12 at 17:25
  • Exactly, then enable exception breakpoints and xcode will show the line! – JonasG Jan 23 '12 at 17:28
  • thanks, that was amazingly helpful! why on earth isn't that in there by default? – Dollarslice Jan 23 '12 at 17:31

2 Answers2

2

You put in your own error catchers, or use breakpoints. There's no way to make it give you helpful error messages. The best you can usually do is figure out which line it failed on, through trial and error using breakpoints.

CSturgess
  • 1,547
  • 2
  • 13
  • 29
  • Really? God that's rubbish. The thing is I know what line it's occurring on but I don't know why it's occurring, in VS the error messages help you figure out what's wrong. Where do I start trying to figure out what's going on? – Dollarslice Jan 23 '12 at 16:55
  • Here. Figure out the line it's on, then check the variables, etc. to try to fix it yourself. Then, if you can't, look online for an answer. If you still can't find it, post here with relevant code and what you've tried :). – CSturgess Jan 23 '12 at 16:59
  • but surely there's something else I can look at? literally all the information I have is: SIGABRT. how is anyone meant to work with that? what is there are millions of lines of code in your project? how do you know where to look? – Dollarslice Jan 23 '12 at 17:03
  • @SirYakalot No, not really. Xcode will usually pause execution and jump to the source file, the proper thread, and display debug info. It has a real interactive debugger (it doesn't always work -- if your memory is trashed, you'd have no luck anyhow). – justin Jan 23 '12 at 17:04
  • @Justin OK, well maybe that's why. I'll post the specific problem. Thanks for the help anyway guys, much appreciated! – Dollarslice Jan 23 '12 at 17:05
  • 1
    @SirYakalot you're welcome. If one debugger is acting up, Xcode supports two -- gdb and lldb, so one basic thing to try is the other debugger. – justin Jan 23 '12 at 17:07
  • @SirYakalot silly question: are you running your debug version? do you get any errors running with GuardMalloc or Zombies enabled? – justin Jan 23 '12 at 17:28
  • sorry to be such a noob but I have no idea what those are or how to enable them! as for debug... I think so? I'm just pressing run and in my scheme run is set to debug? – Dollarslice Jan 23 '12 at 17:30
1

You should look at Exception Breakpoints. Usually you want to add an exception throw Breakpoint to see which line threw the exception. More details in this answer: Xcode doesn't show the line that causes a crash

You should also always scan your code for errors and post some code! If you don't post code, most of the times nobody will be able to help you, especially when the problem is a code related crash.

Community
  • 1
  • 1
JonasG
  • 9,274
  • 12
  • 59
  • 88