Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get correct line numbers in symbolicated crash reports (iPhone / Mac)?

When symbolicating crash reports, I noticed that line numbers are off. I tested this with a project in which I deliberately cause a crash. It seems the generated line number do not include certain lines, e.g. comment lines or compiler preprocessor statements (not sure what it does and does not include)...

Is there an easy way to get from the "off" line number in the symbolicated crash report to the actual line of code in the source?

Edit: An example of a line in a symbolicated crash report:

7 Luisterpaal 0x00005de2 -[SWFMP3 connection:didReceiveData:] (SWFMP3.m:320)

So, the line number 320 is almost correct, but not exactly. It's a few lines off...

like image 203
Martijn Thé Avatar asked Aug 17 '09 09:08

Martijn Thé


People also ask

How do I read a crash report on a Mac?

You can access the crash log in macOS in two ways: Launch Finder, press Command + Shift + G, and type ~/Library/Logs/DiagnosticReports/ in the Go to Folder dialog box. Launch Console, and look for Diagnostic Reports located under ~/Library/Logs/.

Where can I find crash history on Mac?

To find the crash files, you can run Console app which will display all the system messages. If any specific application crashed, look in User Reports. If it's system crash, check in System Reports. Once you have found the crash file, you can Reveal in Finder (usually located in ~/Library/Logs/DiagnosticReports ).


1 Answers

In a word… no. If you're looking at a line like this in a crash report:

0 com.apple.CoreFoundation 0x95cb046b CFArrayAppendValue + 43

The "+43" isn't a line number, but a memory location from the beginning of the function. The code as you wrote it simply doesn't exist in the compiled binary - the compiler optimises and changes the code (in a Release build, at least) around so it most often doesn't match what you wrote.

Unfortunately, the solution is to provide the person experiencing the crash with a debug version that you can remote debug or at least throw out NSLog() statements to help track it down, and/or write smaller methods.

like image 63
iKenndac Avatar answered Oct 04 '22 09:10

iKenndac