Is it possible to use byte offsets to locate the relevant line in the source code for my ios crash stack trace?

525 views Asked by At

My app linked a static library which caused the crash (so .dSYM file is no use here). I have its source codes so is it possible to use byte offsets to locate the relevant line in the source code ?

Following is the crash stack. I have source code for function pjsua_acc_set_registration, so is it possible find the relevant line for offset 1535 ?

Exception Type:  SIGABRT
Exception Codes: #0 at 0x38d021fc
Crashed Thread:  0

Thread 0 Crashed:
0   libsystem_kernel.dylib              0x38d021fc ___pthread_kill + 8
1   libsystem_c.dylib                   0x38cb302d _abort + 77
2   libsystem_c.dylib                   0x38c92c6b ___assert_rtn + 183
3   my app                              0x00181cff pjsua_acc_set_registration + 1535
4   CoreFoundation                      0x2e3f53d4 __invoking___ + 68
5   CoreFoundation                      0x2e33f6c7 -[NSInvocation invoke] + 287
6   CoreFoundation                      0x2e342e83 -[NSInvocation invokeWithTarget:] + 51
7   my app                              0x0015f3bb -[UABaseAppDelegateSurrogate forwardInvocation:] (UABaseAppDelegateSurrogate.m:75)

...
1

There are 1 answers

3
Duncan C On BEST ANSWER

Without a symbol file I don't think there is an automated way to do it.

If your know ARM assembler, have the source code, and have a LOT of time on your hands you could probably puzzle through a disassembly of your program and figure out what source code that byte offset corresponds to. I used to do that kind of analysis, but haven't gotten that deep into it in quite a few years. (Plus I've never learned ARM assembler)

The problem is made much harder by code optimization. By default the release build setting turns on a high level of code optimization. The compiler reorders code, intermingles source statements together, unrolls loops, moves variables into registers or simplifies them away, and does lots of other tricks that make figuring out what you are looking at pretty tricky.