IOS analysis crash log

Preface

IOS positioning analysis of collapse problem in many different ways, but posted to AppStore application if the crash, what should we do? We usually access the statistical system in the system, record the crash log when the system crashes, and send the log to the server next time, the better third party has Umeng and so on. Today, let’s talk about analyzing our BUG by analyzing the crash log.

DYSM file

Analysis premise crash log is that we need to have the dYSM file, this file is the.Xcarchive suffix we packed with archive generated package. A good habit is, when you submit the audit package,.Xcarchive and IPA files generated with a copy, in accordance with the version number saved, if such online problems can quickly find the files you want to locate your problem.

IOS analysis crash log

Crash log

The general crash log will look like this:

NSConcreteMutableAttributedString addAttribute:value:range:: Nil value (null) (CoreFoundation (0x0000000185c642f4 < redacted> 0x00000001974880e4 + 160 libobjc.A.dylib objc_exception_throw + 60 CoreFoundation 0x0000000185c64218 < redacted> 0x0000000186a9dfb4 + 0 Foundation < + 152 Xmen 0x10073fb30; redacted> Xmen + 7600944 Xmen 0x1006bbbf4 + 7060468 Xmen UIKit 0x000000018a9a47fc < redacted> 0x000000018a9a512c + 60 UIKit < +; redacted> 104 UIKit 0x 000000018a6b2b6c < redacted> 0x000000018a9a4fd4 + 88 UIKit < + 444 UIKit 0x000000018a78e274; redacted> < redacted> 0x000000018a999aac + 1012 UIKit < + 2904 UIKit 0x000000018a785268; redacted> < redacted> 0x000000018a6a1760 + 172 UIKit < + 580 QuartzCore 0x0000000189fe9e1c; redacted> < redacted> 0x0000000189fe4884 + 152 QuartzCore + 320 QuartzCore < redacted> 0x0000000189fe4728 < redacted> QuartzCore + 32 0x0000000189f E3ebc < redacted> 0x0000000189fe3c3c + 276 QuartzCore < + 528 QuartzCore 0x0000000189fdd364; redacted> < redacted> 0x0000000185c1c2a4 + 80 CoreFoundation < + 32 CoreFoundation 0x0000000185c19230; redacted> < redacted& gt; CoreFoundation 0x0000000185c19610 360 + < redacted> 0x0000000185b452d4 + 836 CoreFoundation CFRunLoopRunSpecific + 396 GraphicsServices 0x000000018f35b6fc + 168 GSEventRunModal UIKit + 1488 Xmen 0x000000018a70afac UIApplicationMain 0x1008cf9c0 Xmen + 92 38976 libdyld.dylib 0x0000000197b06a08 < redacted> 4) dSYM UUID: 30833A40-0F40-3980-B76B-D6E86E4DBA85 CPU + Type: arm64 Slide Address: 0x0000000100000000 Binary Image: Xmen Base Address: 0x000000010007c000

Is not a face Meng force, I will teach you how to combine crash and log to locate the dYSM file analysis code where a line of code where the collapse of a file

Extract useful information from crash logs

  • NSConcreteMutableAttributedString addAttribute:value:range:: the reason for the crash of nil value is value as nil
  • “4 Xmen 0x10073fb30 Xmen + 7600944” it points out the application name, call the method crash when the address of the address and the position of the line of the file, what we need is this one: “0x10073fb30”.
  • “DSYM, UUID:, 30833A40-0F40-3980-B76B-D6E86E4DBA85.””.
  • “CPU, Type:, arm64.””.

Begin analysis

  • Open the terminal and enter the directory of your dYSM file:
    , CD, /Dandy/XMEN/, on-line version /2.0.17_105/aaaa.xcarchive/dSYMs
  • Whether the verification in the crash log UUID and local dYSM file matches:
    “Xmen” for the app name
    dwarfdump –uuid you Xmen.app.dSYM
    the result is: UUID: (armv7) BFF6AE00-8B5F-39BD-AFD0-27707C489B25 Xmen.app.dSYM/ Contents/Resources/DWARF/Xmen UUID: 30833A40-0F40-3980-B76B-D6E86E4DBA85 (arm64) Xmen.app.dSYM/Contents/Resources/DWARF/Xmen and we found in the log: UUID and CPU Type are matched
  • dwarfdump –arch=arm64 –lookup to find the error message 0x10073fb30 /Dandy/XMEN/ /2.0.17_105/aaaa.xcarchive/dSYMs/Xmen.app.dSYM/Contents/Resources/DWARF/Xmen
    on-line version of “arm64” and “0x1008cf9c0” respectively corresponding to the log from above we extracted useful information
    /Dandy/XMEN/ on-line version of /2.0.17_105/aaaa.xcarchive/dSYMs/Xmen.app.dSYM/Contents/Resources/DWARF/Xmen corresponds to your local dYSM file directory
    “Xmen” corresponds to your app name
    results like the following: File: /Dandy/XMEN/ /2.0.17_105/aaaa.xcarchive/dSYMs/Xmen.app.dSYM/Contents/Resources/DWARF/Xmen (arm64) Looking on-line version of up address: 0x000000010073fb30 in.Debug_info 0x00219b05: Compile Unit: length… Found! = 0x00003dd0 version = 0x0 002 abbr_offset = 0x00000000 addr_size = 0x08 (next CU at 0x0021d8d9 0x00219b10: TAG_compile_unit [107]) * AT_producer (“Apple LLVM version 8.0.0 (clang-800.0.42.1)”) AT_language (DW_LANG_ObjC) AT_name (“/Dandy/checkSvn/IOS/xmen/ Xmen/Modules/StoreManage/SellerOrder/View/DSSellerOrderSectionHeaderView.m”) AT_stmt_list (0x001272a9) AT_comp_dir (/Dandy/checkSvn/IOS/xmen) AT_APPLE_major_runtime_vers (0x02) AT_low_pc (0x000000010072b8ac) AT_high_pc (0x000000010074e350) 0x0021aec5: TAG_subprogram [119] * AT_low_pc (0x0000000100739810) AT_high_pc (0x000000010074006c) AT_frame_base (reg29) AT_object_pointer ({0x0021aee3}) AT_name (“-[DSSellerOrderSectionHeaderView updateContentWithOrderData:isEdit:] AT_decl_file (” /Dandy/che “) CkSvn/IOS/xmen/Xmen/Modules/StoreManage/SellerOrder/View/DSSellerOrderSectionHeaderView.m “) AT_decl_line (248) AT_prototyped (0x01) 0x0021af36: TAG_lexical_block [138] * AT_ranges (0x00008640 [0x000000010073cf90 0x000000010073fb88) [0x000000010073fbc0 – 0x000000010073fbc4) End) Line table dir:’/Dandy/checkSvn/IOS/xmen/Xmen/Modules/StoreManage/SellerOrder/View’Line table file:’DSSellerOrderSectionHeaderView.m’ line 680, column 9 with start address 0x000000010073faf8 Looking up address: 0x000000010073fb30 in.Debug_frame not found…. We come from the terminal to the analysis results we want the results:
    this line tells us the collapse of the code where the file directory Line table dir:’/Dandy/checkSvn/IOS/xmen/Xmen/ Modules/Store Manage/SellerOrder/View’this line tells us the collapse of code where the specific documents AT_decl_file (“/Dandy/checkSvn/IOS/xmen/Xmen/Modules/StoreManage/SellerOrder/View/DSSellerOrderSectionHeaderView.m”) this line tells us crash code is AT_name in which a method inside (“-[DSSellerOrderSectionHeaderView updateContentWithOrderData:isEdit:]”) this line tells us where a specific crash code for Line table file:’DSSellerOrderSectionHeaderView.m’ line 680, column 9 with start address 0x000000010073faf8

OK, now we’ve got the breakdown code in the line. Here we find bug

Find bug

Our code should have a hosting platform, each version of the line to make a tag, it is a good habit. Below, I pull down my broken counterpart version of tag and find the line of crash code:

IOS analysis crash log

With the collapse of the log told me: the cause of the collapse is value nil, because the receiverTelephone field has found Chinese leads to URL nil to the bug solution below depends on their skills.

epilogue

I hope for your help, thank you support ~ welcome attention, I will update the technical articles in my spare time.