-->

What do the memory addresses in iPhone crash logs

2020-07-25 10:18发布

问题:

I've been looking at crash logs generated by an iphone app today:

Thread 0 Crashed:
0   libobjc.A.dylib                 0x3002d7da 0x3002b000 + 10202
1   UIKit                           0x31ec4abc 0x31e4d000 + 490172
2   UIKit                           0x31ebd214 0x31e4d000 + 459284
3   UIKit                           0x31ebcfac 0x31e4d000 + 458668

Can anyone tell me what the hex addresses mean? (memory addresses, sure..)

I know how to symbolicate to produce:

0   libobjc.A.dylib                 0x000027da objc_msgSend + 18
1   UIKit                           0x00077abc -[UINavigationController _startDeferredTransitionIfNeeded] + 176
2   UIKit                           0x00070214 -[UINavigationController pushViewController:transition:forceImmediate:] + 600
3   UIKit                           0x0006ffac -[UINavigationController pushViewController:animated:] + 28

and debug the crash from there, but I'm curious; if you take

0x3002d7da 0x3002b000 + 10202

then: 0x3002d7da = 0x3002b000 + (decimal) 10202

What does this signify exactly?

I should add I'm not looking for info on how to symbolicate, thx!

EDIT: what is also strange to me is that if you compare pre and post symbolicated versions, then for code I wrote:

9   memleaktest                     0x00002ffe 0x1000 + 8190
becomes
9   memleaktest                     0x00002ffe -[memleaktestViewController buttonOne] (memleaktestViewController.m:24)

makes sense, but for framework code:

8   CoreFoundation                  0x307fe52c 0x307f8000 + 25900
becomes
8   CoreFoundation                  0x0000652c -[NSObject(NSObject) release] + 24

the address and offset has changed? Why would this be?

回答1:

if you take
   0x3002d7da 0x3002b000 + 10202
What does this signify exactly?

In this case, the "+" doesn't signify addition so much. What this line is telling you is:

  • The routine/library in question starts at address 0x3002b000
  • Your line-of-code in the stack trace happened 10202 bytes into it.
  • The sum of those two numbers = 0x3002d7da

(Put another way, as you did, 0x3002d7da = 0x3002b000 + 10202.)

The important thing about which you might care is the start address of the method being called.

But, really, you can ignore all of that, since it's not nearly as useful as the symbolicated version, which gives you source-file name & line-number.



回答2:

Extending Olie's response on the "symbolicated version" of the app: The debugging information is stripped from the distribution version of the app to make it smaller and also to protect the developer's intellectual property (so you can't see class and method names).

In order to decrypt the log, you need to have the debugging symbols file associated with the specific build that created the crash log.

This file (.dSYM extension) will be present in the build folder where the binary of the iPhone app is also located. Please note that you need the .dSYM file for the specific compilation that was used to compile the app on the phone - the dSYM file is timestamped, so if you recompile the app, the dSYM file will change even if you don't change a line of code.

Once you have this file on your computer, drag the crash file into xcode (or view logs from attached devices in the Organiser), which will give you a stack trace of the methods called and the specific lines of code called which led to the crash.



标签: iphone xcode