This may be calculated on the device or on the apm server, whichever makes more sense.
"culprit" :
"description": "Culprit identifies the function call which was the primary perpetrator of this event.",
The culprit should be calculated as the first frame from the customer's application or framework.
This can be done by looking at the stack trace frame by frame and calculate whether the memory address is from a relevant library.
For example in this abbreviated stack trace:
How can we determine a library is a "user library"?
This can be determined by the path of the library. Above we can see opbeans-swift has the path : /private/var/containers/Bundle/Application/. This path indicates user package or framework. System libraries have /System/Library/Frameworks/, /usr/lib/', or/private/preboot/`
Looking at the crash frames : we see this structure:
note: image address + line address offset = line address
we can use either the library name or the image address from the frame to determine which binary image path to determine if it is a user library or system library.
libSwiftCore.dylib's path starts with /usr/lib/ which indicates a system library. This is not the culprit.
The next line:
1 opbeans-swift 0x0000000102c5c108 0x102c30000 + 180488
this frame is from opbeans-swift, which has the path prefix /private/var/containers/Bundle/Application/ which indicates it's a user library. We can use this address, 0x0000000102c5c108, as the culprit.
This may be calculated on the device or on the apm server, whichever makes more sense.
The culprit should be calculated as the first frame from the customer's application or framework. This can be done by looking at the stack trace frame by frame and calculate whether the memory address is from a relevant library. For example in this abbreviated stack trace:
How can we determine a library is a "user library"? This can be determined by the path of the library. Above we can see opbeans-swift has the path :
/private/var/containers/Bundle/Application/
. This path indicates user package or framework. System libraries have/System/Library/Frameworks/
,/usr/lib/', or
/private/preboot/`Looking at the crash frames : we see this structure:
0 libswiftCore.dylib 0x00000001a9b75534 0x1a9b3d000 + 230708
note: image address + line address offset = line address
we can use either the library name or the image address from the frame to determine which binary image path to determine if it is a user library or system library.
libSwiftCore.dylib's path starts with /usr/lib/ which indicates a system library. This is not the culprit.
The next line:
1 opbeans-swift 0x0000000102c5c108 0x102c30000 + 180488
this frame is fromopbeans-swift
, which has the path prefix/private/var/containers/Bundle/Application/
which indicates it's a user library. We can use this address,0x0000000102c5c108
, as the culprit.