I'm having trouble matching up the offsets in the stack traces of iOS crash dumps with offsets in the disassembly of the binary as output by otool.
Can anybody confirm how in principle I match these up. For example, if I get a line in the crash dump:
0 myapp 0x00005b0a 0x1000 + 19210
would I expect the offset of the offending instruction in the binary file to be 0x5b0a, 0x4b0a.... or something else?
In its decoding of the header information, otool also gives, for example, this information (the actual code starts at offset 0x0000224c in the file):
Section
sectname __text
segname __TEXT
addr 0x0000224c
size 0x00063ad2
offset 4684
align 2^2 (4)
reloff 0
nreloc 0
type S_REGULAR
attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
reserved1 0
reserved2 0
So, I wasn't 100% sure I was interpreting this correctly, but it seems to be saying that the code, at +0x224c in the file, ends up at offset 0x124c in memory, but then I wasn't exactly sure how this fitted in with, for example, the location 0x1000.
The problem I have is that given, say, the offset 0x5b0a, neither the instruction there nor at 0x4b0a nor at 0x6b0a makes sense as being the actual instruction in question (including that fact that e.g. locations further down the stack then don't point to branch instructions).
(I know that, at least on earlier incarnations of ARM, there was a discrepancy between the value of the PC and the corresponding memory address due to the instruction pipeline. I was assuming that such a difference would be taken into account in the offsets reported in the crash dump, or at any rate, I'd see the branch instruction in question a few instructions either side of the one pointed to if such a difference wasn't taken into account...)
Can anybody shed any light?
Provided that
myapp
did not strip out symbols you'll be able to useatos
.You can always
man atos
for more details but this should be sufficient for your problem:That output should be a list of symbol names to the terminal. Again, this requires that the
myapp
did not have symbols stripped out.