MetricKit MXDiagnostic symbolication

1.4k views Asked by At

I am trying to implement MetricKit so later I could analyze MXCrashDiagnostic and MXHangDiagnostic reports. However when I am triggering a test crash, and then doing Debug->Simulate MetricKit Payloads I always receive absolutely same result in dictionaryRepresentation(). Here is an example of what I get for MXCrashDiagnostic:

[[AnyHashable("diagnosticMetaData"): {
    appBuildVersion = 2;
    appVersion = "1.0";
    deviceType = "iPhone10,6";
    exceptionCode = 0;
    exceptionType = 1;
    osVersion = "iPhone OS 14.0.1 (18A393)";
    platformArchitecture = arm64;
    regionFormat = CA;
    signal = 11;
    terminationReason = "Namespace SIGNAL, Code 0xb";
    virtualMemoryRegionInfo = "0 is not in any region.  Bytes before following region: 4000000000 REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL UNUSED SPACE AT START ---> __TEXT                 0000000000000000-0000000000000000 [   32K] r-x/r-x SM=COW  ...pp/Test";
}, AnyHashable("callStackTree"): {
    callStackPerThread = 1;
    callStacks =     (
                {
            callStackRootFrames =             (
                                {
                    address = 74565;
                    binaryName = testBinaryName;
                    binaryUUID = "A36D6CF4-CBE8-4FB9-9DC4-C7EE8C6431CC";
                    offsetIntoBinaryTextSegment = 123;
                    sampleCount = 20;
                }
            );
            threadAttributed = 1;
        }
    );
}, AnyHashable("version"): 1.0.0]]

For cpuExceptionDiagnostics and hangDiagnostics the value for callStackTree is always the same.

I tried to symbolicate the the data, by executing commands:

1. cd /Path/To/Archive/myApp.xcarchive/dSYMs/myApp.app.dSYM/Contents/Resources/DWARF/
2. atos -arch arm64 -o myApp 0x00074565

But always get the same result:

atos[79918]: respawning is disabled (because DYLD_ROOT_PATH or DT_NO_RESPAWN is set), but the analysis process does not match the SDK variant of the target process 0.
Analysis of malloc zones may fail.
0x00074565 (in myApp)

I have found nothing online about the warning nor any of the params in xcode I tried to follow this and this guides on the symbolication process, some answers were also provided to this question, but it looks like I don't have the right data for symbolication, even though I did set up reports correctly.

I would appreciate if someone could let me know what am I missing and how to properly symbolicate these reports.

3

There are 3 answers

1
马谷歌 On BEST ANSWER

I guess that it will always provide the same array contains MXDiagnosticPayload when you trigger the simulate metricKit payloads in XCODE.

0
Tom Hamming On

There's a helpful thread on symbolicating MetricKit crash reports on Apple Developer Forums here: https://developer.apple.com/forums/thread/681967

In short, for each call stack frame that you have a dSYM for (likely just your app), get the offsetIntoBinaryTextSegment and convert it from decimal to hex. Then invoke atos like this:

atos -arch arm64 -o <path to dSYM> 0x1 <offset in hex>

Where <offset in hex> is the value from offsetIntoBinaryTextSegment converted to hex. I used arm64 in the example under the assumption that this is an iOS app.

You should also verify that the binaryUUID value in each frame matches the UUID of the dSYM file you're giving to atos. You can get the UUID of a dSYM file like this with dwarfdump:

dwarfdump --uuid <path to dSYM>

I've implemented this in a python script here: https://github.com/OliveTreeBible/MXSymbolicate

0
zhungxd On

Debug->Simulate MetricKit Payloads It is just a example. It can not be symbolicated by atos.

The only wray is to collecting the payloads from users.