6

Simple question: how do I get line number for error in XCode (v 4.2)?

I've searched around for various solutions - have added an exception breakpoint and have tried the suggestion here: xcode-4-2-debug-doesnt-symbolicate-stack-call (which didn't seem to do anything).

This is what I get. It's not that helpful since I know (in this case) the method that is throwing the error. I just want to know the specific line. I am resorting to printf statements before and after suspected lines - and that sort of hack is no way to program.

enter image description here

Community
  • 1
  • 1
spring
  • 18,009
  • 15
  • 80
  • 160

1 Answers1

0

If it's an exception, you may just need to step through until it's found and execution breaks, or use @try catch blocks.

If you suspect a method, you should try returning a system error code and printing the error message for that error.

You can also use standard c macros like __FILE__ or __LINE__ with your own logger to output errors with file/line information.

Faris M
  • 540
  • 4
  • 10
  • thanks. I was hoping there was some option or switch I hadn't yet discovered which would show me the code or at least give me a line number. – spring Apr 27 '12 at 02:40
  • When adding an exception breakpoint there is an option to add a "debugger command" or Log Message. Can I put something like `printf(" DEBUG %s %d \n", __FILE__, __LINE__);` in either of those? – spring May 01 '12 at 05:29