The composition structure of the iOS_Crash report

A crash report is structured as follows, with each section containing information that helps locate the crash:
examining-the-fields-in-a-crash-report


1. Header

Describe the environment in which the crash occurred, including device, system, time, version and other information. like:

Incident Identifier: 6156848E-344E-4D9E-84E0-87AFD0D0AE7B
CrashReporter Key:   76f2fb60060d6a7f814973377cbdc866fffd521f
Hardware Model:      iPhone8,1
Process:             TouchCanvas [1052]
Path:                /private/var/containers/Bundle/Application/51346174-37EF-4F60-B72D-8DE5F01035F5/TouchCanvas.app/TouchCanvas
Identifier:          com.example.apple-samplecode.TouchCanvas
Version:             1 (3.0)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.example.apple-samplecode.TouchCanvas [1806]


Date/Time:           2020-03-27 18:06:51.4969 -0700
Launch Time:         2020-03-27 18:06:31.7593 -0700
OS Version:          iPhone OS 13.3.1 (17D50)

2. Exception information

Exception information. Describes how a process terminates, but may not fully explain why the program terminates. like:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000102afb3d0
  • Exception Type: Mach exception name (corresponding BSD termination signal)
  • Exception Codes:Exception handler specific information, one or more 64-bit hexadecimal numbers. Typically this field is not present because the operating system renders the information into human-readable information through other fields.
  • Exception Subtype: Exception subtype
  • Exception Message:Exception description information
  • Exception Note:Exception additional information.
    1. If included EXC_CORPSE_NOTIFY, the crash was not caused by a hardware defect, but could be caused by the operating system or the process calling the abort() function, which caused the process to terminate.
    2. If included SIMULATED, the process did not crash, but the operating system may subsequently request that the process be terminated.
    3. If included NON-FATAL CONDITION(this is not a crash), the process will not terminate because the problem creating the crash report is not fatal
  • Termination Reason: Reason for termination. The system component will terminate the process when encountering a fatal error and record the information in this field. Messages such as invalid code signing, missing dependent libraries, and accessing privacy-sensitive information without purposeful strings can be found in this field.
  • Triggered by Thread or Crashed Thread: The thread that caused the exception

3. Diagnostic messages

Operating systems sometimes include additional diagnostic information in a variety of formats, depending on the cause of the crash, and are not included in every crash report. like:

Application Specific Information:
BUG IN CLIENT OF LIBDISPATCH: dispatch_sync called on queue already owned by current thread

Application Specific Information: A frame error message that occurs before the process terminates
Termination Description: Termination due to a watchdog violation will contain this field describing the reason why the watchdog was triggered. like:

Termination Description: SPRINGBOARD, 
    scene-create watchdog transgression: application<com.example.MyCoolApp>:667
    exhausted real (wall clock) time allowance of 19.97 seconds 

4. Backtraces

Each thread of the crashing process is captured as a traceback, recording the code running on the thread when the process terminated.
Crashes caused by language exceptions contain an additional traceback, one before the first thread Last Exception Backtrace.

The first line of each traceback lists the thread number and name. Each subsequent line represents a stack frame in the traceback, and each column of the stack frame contains information about the code that was executed at the time of the crash. like:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   TouchCanvas                       0x0000000102afb3d0 CanvasView.updateEstimatedPropertiesForTouches(_:) + 62416 (CanvasView.swift:231)
1   TouchCanvas                       0x0000000102afb3d0 CanvasView.updateEstimatedPropertiesForTouches(_:) + 62416 (CanvasView.swift:231)
2   TouchCanvas                       0x0000000102af7d10 ViewController.touchesMoved(_:with:) + 48400 (<compiler-generated>:0)
3   TouchCanvas                       0x0000000102af80b8 @objc ViewController.touchesMoved(_:with:) + 49336 (<compiler-generated>:0)
4   UIKitCore                         0x00000001ba9d8da4 forwardTouchMethod + 328
5   UIKitCore                         0x00000001ba9d8e40 -[UIResponder touchesMoved:withEvent:] + 60
6   UIKitCore                         0x00000001ba9d8da4 forwardTouchMethod + 328
7   UIKitCore                         0x00000001ba9d8e40 -[UIResponder touchesMoved:withEvent:] + 60
8   UIKitCore                         0x00000001ba9e6ea4 -[UIWindow _sendTouchesForEvent:] + 1896
9   UIKitCore                         0x00000001ba9e8390 -[UIWindow sendEvent:] + 3352
10  UIKitCore                         0x00000001ba9c4a9c -[UIApplication sendEvent:] + 344
11  UIKitCore                         0x00000001baa3cc20 __dispatchPreprocessedEventFromEventQueue + 5880
12  UIKitCore                         0x00000001baa3f17c __handleEventQueueInternal + 4924
13  UIKitCore                         0x00000001baa37ff0 __handleHIDEventFetcherDrain + 108
14  CoreFoundation                    0x00000001b68a4a00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15  CoreFoundation                    0x00000001b68a4958 __CFRunLoopDoSource0 + 80
16  CoreFoundation                    0x00000001b68a40f0 __CFRunLoopDoSources0 + 180
17  CoreFoundation                    0x00000001b689f23c __CFRunLoopRun + 1080
18  CoreFoundation                    0x00000001b689eadc CFRunLoopRunSpecific + 464
19  GraphicsServices                  0x00000001c083f328 GSEventRunModal + 104
20  UIKitCore                         0x00000001ba9ac63c UIApplicationMain + 1936
21  TouchCanvas                       0x0000000102af16dc main + 22236 (AppDelegate.swift:12)
22  libdyld.dylib                     0x00000001b6728360 start + 4


Thread 1:
0   libsystem_pthread.dylib           0x00000001b6645758 start_wqthread + 0


Thread 2:
0   libsystem_pthread.dylib           0x00000001b6645758 start_wqthread + 0
...
  • The first column: stack frame number. The stack frames are arranged in the order of calling. Frame 0 is the function being executed when execution stops, frame 1 is the function calling frame 0, and so on.

  • Second column: Name of the binary file that is executing the function

  • The third column: the address of the machine instruction being executed. For a non-collapsing stack, this is the address of the first machine instruction executed after control returns to this stack frame

  • Column 4: In a fully symbolic crash report, the name of the function being executed.

  • The following +数字: is the byte offset from the function entry point to the current instruction in the function.

  • (File name. Suffix: number): file name and line number. In some cases it does not correspond to the original source code:

    1. If the source filename is <compiler-generated>, then the compiler created code for that framework and that code is not in your source file. If this is the top frame of the crashing thread, look at the previous stack frames for clues.
    2. If the source file's line number is 0, it means that the traceback does not map to a specific line of code in the original code. Because the compiler optimized the code (i.e., introverted), and the code executed at the time of the crash did not correspond to the exact line in the original code. At this point the framework's function name is still just a clue.

5. Thread state

The Thread Status section lists the CPU registers and their values ​​of the crashed thread when the program terminated. like:

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000001   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x000000000000000f
    x4: 0x00000000000001c2   x5: 0x000000010327f6c0   x6: 0x000000010327f724   x7: 0x0000000000000120
    x8: 0x0000000000000001   x9: 0x0000000000000001  x10: 0x0000000000000001  x11: 0x0000000000000000
   x12: 0x00000001038612b0  x13: 0x000005a102b075a7  x14: 0x0000000000000100  x15: 0x0000010000000000
   x16: 0x00000001c3e6c630  x17: 0x00000001bae4bbf8  x18: 0x0000000000000000  x19: 0x0000000282c14280
   x20: 0x00000001fe64a3e0  x21: 0x4000000281f1df10  x22: 0x0000000000000001  x23: 0x0000000000000000
   x24: 0x0000000000000000  x25: 0x0000000282c14280  x26: 0x0000000103203140  x27: 0x00000001bacf4b7c
   x28: 0x00000001fe5ded08   fp: 0x000000016d311310   lr: 0x0000000102afb3d0
    sp: 0x000000016d311200   pc: 0x0000000102afb3d0 cpsr: 0x60000000
   esr: 0xf2000001  Address size fault

Understanding thread status is an advanced topic that requires understanding of the Program Binary Interface (ABI). See Writing ARM64 code for Apple platforms.
Registers provide additional information for crashes caused by memory accesses. For details, see Understand the crashed thread's registers.


6. Binary images

Binary Image, The Binary Image section of the crash report lists all code loaded in the process at the time of termination (such as application executables and system frameworks). Each line in the binary image section represents a binary image, such as:

Binary Images:
0x102aec000 - 0x102b03fff TouchCanvas arm64  <fe7745ae12db30fa886c8baa1980437a> /var/containers/Bundle/Application/51346174-37EF-4F60-B72D-8DE5F01035F5/TouchCanvas.app/TouchCanvas
...
  • The first column: the address range of the binary image within the process. The first address is the loading address of the binary file.
  • Second column: binary name
  • Column 3: CPU architecture of the binary image loaded by the operating system into the process
  • The fourth column: UUID that uniquely identifies the binary image, corresponding to the dSYM file
  • Column 4: Path to the binary file on disk. (MacOS uses placeholders to replace user-recognizable path components to protect privacy)

Reference:
Examining the fields in a crash report

Guess you like

Origin blog.csdn.net/Margaret_MO/article/details/132393147