0

I'm trying to symbolicate a crash log on my device. I have the stack frames, the instruction pointer addresses for each frame, the module that the IP was in, and the offset into that module. My plan is to use dladdr() to get the function or method for each stack frame address.

I'm trying to do this on a fresh app launch, so I don't know that the libraries are currently loaded or what addresses they're loaded at. I can use dlopen() to ensure that the library is open, but I'm not sure what base address to add my previously calculated offset to.

Is there any way to determine where the library is loaded or make sense of the handle returned from dlopen()?

Greg
  • 10,360
  • 6
  • 44
  • 67

1 Answers1

1

The problem with doing the symbolication on the next startup on the device is, that you need to make sure that the app version did not change (if you want to symbolicate those too, which you shouldn't since you won't get line numbers) and need to make sure that the iOS version is also the same. So trying to open them might give you more trouble unsuccessful results than you want.

The safest and most reliable way is to symbolicate on your Mac or a server where you can collect all symbols and are also able to get line numbers for your own apps code.

Why don't use just use PLCrashReporter to collect the crash logs? This does all you need in a very safe and reliable way, including catching exceptions, signal handlers etc. This article shows more about some of the problems working with crashes has: http://landonf.bikemonkey.org/code/objc/Reliable_Crash_Reporting.20110912.html

See https://code.google.com/p/plcrashreporter/ and our fork with some additions for Mac support and safe (!!) symbolication of system libs right when the crash happens, see https://github.com/bitstadium/PLCrashReporter and https://github.com/bitstadium/HockeySDK-iOS which uses that fork.

One important note I forgot to mention: since iOS 6 a lot of symbols result in "redacted" when symbolicated on the device. Another reason you may want to avoid this.

Kerni
  • 15,241
  • 5
  • 36
  • 57
  • We ran into the "redacted" problem with our custom on-device symbolication, which got me investigating PLCrashReporter in the first place. I was hoping to symbolicate on the device in order to make our server-side operation and setup simpler. I think I'd like to provide all the symbolication I can with info from the device, and follow up with server-side symbolication if we have the symbol files available. I'll try looking at your PLCrashReporter fork. Thanks! – Greg Oct 03 '12 at 14:06
  • Not an real answer to the question, but if you don't want to have the symbolication issue at all, not even on your own servers, you might want to check out our hosted service hockeyapp.net or other services out there. – Kerni Oct 03 '12 at 14:27
  • It looks like your fork of PLCrashReporter does just what I was looking for. Thanks! We'll also collect the raw crash data from PLCrashReporter for server-side symbolication in case the lines are too annoying. – Greg Oct 03 '12 at 17:45