get line number for error in XCode
Asked Answered
M

1

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

Massage answered 23/4, 2012 at 2:1 Comment(0)
C
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.

Christianity answered 23/4, 2012 at 2:7 Comment(2)
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.Massage
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?Massage

© 2022 - 2024 — McMap. All rights reserved.