4

I'm trying to get backtrace symbol like Xcode listout as below

*** First throw call stack:
(
    0   CoreFoundation                      0x018865e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x016098b6 objc_exception_throw + 44
    2   CoreFoundation                      0x01923903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x0187690b ___forwarding___ + 1019
    4   CoreFoundation                      0x018764ee _CF_forwarding_prep_0 + 14
    5   Foundation                          0x0124036c __NSFireDelayedPerform + 372
    6   CoreFoundation                      0x01844c46 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    7   CoreFoundation                      0x0184462d __CFRunLoopDoTimer + 1181
    8   CoreFoundation                      0x0182c698 __CFRunLoopRun + 1816
    9   CoreFoundation                      0x0182bb33 CFRunLoopRunSpecific + 467
    10  CoreFoundation                      0x0182b94b CFRunLoopRunInMode + 123
    11  GraphicsServices                    0x02c249d7 GSEventRunModal + 192
    12  GraphicsServices                    0x02c247fe GSEventRun + 104
    13  UIKit                               0x0037c94b UIApplicationMain + 1225
    14  CrashHandler                        0x000088ad main + 141
    15  libdyld.dylib                       0x06244725 start + 0
    16  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I'm trying to extract symbol from NSException as below code. and less information only available.

-(void)handleException:(NSException*)exception
{

    [exception callStackSymbols]//I've written this into file.

}

I've got output as below

*** First throw call stack: (
0   CoreFoundation                      0x326bd2bb <redacted> + 186
1   libobjc.A.dylib                     0x3a33b97f objc_exception_throw + 30
2   CoreFoundation                      0x326c0e07 <redacted> + 170
3   CoreFoundation                      0x326bf531 <redacted> + 392
4   CoreFoundation                      0x32616f68 _CF_forwarding_prep_0 + 24
5   Foundation                          0x32fcb277 <redacted> + 450
6   CoreFoundation                      0x326925df <redacted> + 14
7   CoreFoundation                      0x32692291 <redacted> + 272
8   CoreFoundation                      0x32690f01 <redacted> + 1232
9   CoreFoundation                      0x32603ebd CFRunLoopRunSpecific + 356
10  CoreFoundation                      0x32603d49 CFRunLoopRunInMode + 104
11  GraphicsServices                    0x361b62eb GSEventRunModal + 74
12  UIKit                               0x34519301 UIApplicationMain + 1120
13  CrashHandler                        0x0007f421 main + 116
14  libdyld.dylib                       0x3a772b20 <redacted> + 0
)

How to decode <redacted> symbol?

Reference and Understanding:

I've refer SO post1, SO post2 but It need dSYM file and we have to manually decode as like testflight.. Without dSYM file, how to do this?

Community
  • 1
  • 1
Mani
  • 17,549
  • 13
  • 79
  • 100

2 Answers2

2

Symbolication is the process of translation a memory address to a symbol that contains all or some of the following elements:

  • class name
  • method name
  • file name
  • line number

When symbolicating on the device with the app symbols being part of the app binary, only class name and method name can be retrieved. It is not possible to get file name and line number this way.

When symbolicating using the app dSYM, it is possible to get all data, as long all information is available when building the app. E.g. when using third party static libraries, file name and line number might be missing for those calls.

<redacted> symbols can only show up for system calls when symbolicating system framework addresses on the device. The reason the class name and/or method name doesn't show up is an iOS memory optimization. Explanation for this can be found here: https://devforums.apple.com/thread/171264 To symbolicate these addresses, you need to have the iOS symbols of the iOS version and CPU architecture that was used to create the stack trace on the computer that is symbolicating the report.

It is possible to get these symbols as part of Xcode or by connecting a device of the specific iOS version and CPU architecture to Xcode, which will then fetch the symbols. Note that e.g. for iOS bugfix versions that do not come with an updated SDK, the only way to get the symbols is using a device.

Symbolication on a computer can be done using Xcode organizer or manually using the symbolciatecrash.pl script which is part of Xcode manually in the terminal.

For symbolication to work with Xcode or the script, you need a full crash report which contains lots more information than your posted stack trace.

To use atos to manually symbolicate the frame addresses of your report, you'll also need the load address for each binary that a frame references, e.g. from Foundation, CoreFoundation, UIKit. The shown stack trace doesn't provide this information. There are multiple posts here on StackOverflow how to use atos manually.

Kerni
  • 15,241
  • 5
  • 36
  • 57
1

There is no way to symbolicate the trace without a dSYMbolication file. You could try to build your code with the option not to strip debug symbols but I'm not sure.

Also implementing a crash handler is a very delicate task that I would leave to pro's ;) Yet you can give it a try and probably learn new things.

Community
  • 1
  • 1
Rivera
  • 10,792
  • 3
  • 58
  • 102
  • I also try that. I can get trace stack address but I couldn't to do that atos process. – Mani May 15 '14 at 04:55