iOS crash reports: atos not working as expected

前端 未结 4 691
终归单人心
终归单人心 2020-11-22 13:53

I\'m looking at a crash report provided by Apple

Hardware Model:      iPhone4,1
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  la         


        
4条回答
  •  清歌不尽
    2020-11-22 14:21

    You have to calculate the address to use with atos, you can't just use the one in the stacktrace.

    symbol address = slide + stack address - load address
    
    1. The slide value is the value of vmaddr in LC_SEGMENT cmd (Mostly this is 0x1000). Run the following to get it:

      otool -arch ARCHITECTURE -l "APP_BUNDLE/APP_EXECUTABLE" | grep -B 3 -A 8 -m 2 "__TEXT"
      

      Replace ARCHITECTURE with the actual architecture the crash report shows, e.g. armv7. Replace APP_BUNDLE/APP_EXECUTABLE with the path to the actual executable.

    2. The stack address is the hex value from the crash report.

    3. The load address can be is the first address showing in the Binary Images section at the very front of the line which contains your executable. (Usually the first entry).

    Since in the past value of the slide was equal to value of the load address this always worked. But since Apple introduced Address space layout randomization beginning with iOS 4.3 (in different variations), the apps loading address is randomized for security reasons.

提交回复
热议问题