最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - Why doesn't symbolicatecrash show the exact line and function name in SwiftUI app crash logs even with correct dSY

programmeradmin5浏览0评论

I'm testing crash reporting in a SwiftUI app using PLCrashReporter. After a crash, I export the .crash report and symbolicate it manually with:

export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash intelcr.crash ExampleCrashReport.app.dSYM
  • I'm 100% sure the UUID of the dSYM matches the crash report;

intelcr.crash File; (BEFORE SYMBOLICATE)

Incident Identifier: 2B9B2CBB-1CFF-400F-9E6E-56A1176CA3D0
Hardware Model:      iPhone11,8
Process:         ExampleCrashRepo [11608]
Path:            /private/var/containers/Bundle/Application/64D58F25-721B-45F9-8628-69861D9C6AFA/ExampleCrashReport.app/ExampleCrashReport
Identifier:      com.initialcode.ExampleCrashReportIntel
Version:         1.0 (1)
Code Type:       ARM-64
Parent Process:   [1]

Date/Time:       2025-03-26 09:11:52 +0000
OS Version:      iPhone OS 15.3.1 (19D52)
Report Version:  104

Exception Type:  SIGSEGV
Exception Codes: SEGV_MAPERR at 0xbffb33333333332d
Crashed Thread:  0

Thread 0 Crashed:
0   libswiftCore.dylib                  0x00000001862abe94 <redacted> + 8
1   libswiftCore.dylib                  0x0000000186286a48 swift_arrayDestroy + 132
2   libswiftCore.dylib                  0x0000000185fa3548 $ss23_ContiguousArrayStorageCfD + 96
...
...

Binary Images:
       0x104d2c000 -        0x104d63fff +ExampleCrashReport arm64  <c740adc83b473671ada646cc6264249e> /private/var/containers/Bundle/Application/64D58F25-721B-45F9-8628-69861D9C6AFA/ExampleCrashReport.app/ExampleCrashReport
       0x1074f0000 -        0x1074fbfff  libobjc-trampolines.dylib arm64e  <58c8b0fa678c3facb062bf94644e78c7> /usr/lib/libobjc-trampolines.dylib
...
...

DSYM UUID:

UUID: C740ADC8-3B47-3671-ADA6-46CC6264249E (arm64) ExampleCrashReport.app.dSYM/Contents/Resources/DWARF/ExampleCrashReport
  • I have tested with both Debug and Release builds (archived and installed on a real device).

  • I added @inline(never) to the crashing function.

Despite all that, the output still shows something like this: (AFTER SYMBOLICATE)

Incident Identifier: 2B9B2CBB-1CFF-400F-9E6E-56A1176CA3D0
Hardware Model:      iPhone11,8
Process:         ExampleCrashRepo [11608]
Path:            /private/var/containers/Bundle/Application/64D58F25-721B-45F9-8628-69861D9C6AFA/ExampleCrashReport.app/ExampleCrashReport
Identifier:      com.initialcode.ExampleCrashReportIntel
Version:         1.0 (1)
Code Type:       ARM-64
Parent Process:   [1]

Date/Time:       2025-03-26 09:11:52 +0000
OS Version:      iPhone OS 15.3.1 (19D52)
Report Version:  104

Exception Type:  SIGSEGV
Exception Codes: SEGV_MAPERR at 0xbffb33333333332d
Crashed Thread:  0

Thread 0 Crashed:
0   libswiftCore.dylib                  0x00000001862abe94 swift::metadataimpl::ValueWitnesses<swift::metadataimpl::OpaqueExistentialBox<0u>>::destroy+ 8 (swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*) + 8
1   libswiftCore.dylib                  0x0000000186286a48 swift_arrayDestroy + 132
2   libswiftCore.dylib                  0x0000000185fa3548 $ss23_ContiguousArrayStorageCfD + 96
3   libswiftCore.dylib                  0x0000000186293cb4 _swift_release_dealloc + 56
4   ExampleCrashReport                  0x0000000104d36b48 _mh_execute_header + 43848
...
...

The output it should show should actually be the line when the Crash - 2 button is clicked in the ContentView class;

import SwiftUI

struct ContentView: View {
    @State private var exportedCrashURL: URL?
        @State private var isSharePresented = false

        var body: some View {
            VStack(spacing: 20) {
                Image(systemName: "globe")
                    .imageScale(.large)
                    .foregroundColor(.accentColor)

                Text("ExampleCrashApp")

                Button("Crash") {
                    test().getStartedButtonClicked()
                }
                .padding()
                .background(Color.purple)
                .foregroundColor(.white)
                .cornerRadius(8)
                
                
                Button("Crash - 2") {
                    let optional: String? = nil
                    print(optional!)
                }
                .padding()
                .background(Color.purple)
                .foregroundColor(.white)
                .cornerRadius(8)

                Button("Share CrashReport With PLCrashReporter") {
                    CrashTracker.shared.exportCrashReportToDisk { url in
                        if let url = url {
                            CrashShareManager.shareCrashFile(at: url)
                        } else {
                            print("Crash report not found.")
                        }
                    }
                }
                .padding()
                .background(Color.blue)
                .foregroundColor(.white)
                .cornerRadius(8)
            }
        }
   }


struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
class test {
    @inline(never)
    @objc func getStartedButtonClicked() {
        let numbers = [0]
        let _ = numbers[1]
    }
}

I have an older and bigger project in Xcode. Again, I create crash reports using the PLCrashReporter library and there is no problem with the symbolicate operations in that app.

However, when I create a new demo app with almost the same settings, I cannot observe the method names and line numbers in the symbolicate output.

Deployment Settings; (This is the same app settings that gives proper crash output, if there was a problem with these settings, I think there would be a problem with my other app.)

When I try the following command after asking the question, I get the correct output, but I still need it to automatically symbolize directly with the symbolicate command instead of specifying the address manually like this;

atos -o ExampleCrashReport.app.dSYM/Contents/Resources/DWARF/ExampleCrashReport -l 0x104d2c000 0x0000000104d36b48

Output;

closure #2 in closure #1 in ContentView.body.getter (in ExampleCrashReport) (ContentView.swift:45)

Any tips or missing steps?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论