Skip to content

Commit

Permalink
Merge pull request #827 from bugsnag/stringify-mach-code-and-subcode
Browse files Browse the repository at this point in the history
[PLAT-5084] Stringify Mach exception code and subcode
  • Loading branch information
nickdowell committed Oct 5, 2020
2 parents 4066f21 + 77120d1 commit 107b1cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSCrashReport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,20 +1252,25 @@ void bsg_kscrw_i_writeError(const BSG_KSCrashReportWriter *const writer,
case BSG_KSCrashTypeMachException:
writer->beginObject(writer, BSG_KSCrashField_Mach);
{
char buffer[20] = {0};

writer->addUIntegerElement(writer, BSG_KSCrashField_Exception,
(unsigned)machExceptionType);
if (machExceptionName != NULL) {
writer->addStringElement(writer, BSG_KSCrashField_ExceptionName,
machExceptionName);
}
writer->addUIntegerElement(writer, BSG_KSCrashField_Code,
(unsigned)machCode);

snprintf(buffer, sizeof(buffer), "0x%llx", machCode);
writer->addStringElement(writer, BSG_KSCrashField_Code, buffer);

if (machCodeName != NULL) {
writer->addStringElement(writer, BSG_KSCrashField_CodeName,
machCodeName);
}
writer->addUIntegerElement(writer, BSG_KSCrashField_Subcode,
(unsigned)machSubCode);

snprintf(buffer, sizeof(buffer), "0x%llx", machSubCode);
writer->addStringElement(writer, BSG_KSCrashField_Subcode, buffer);
}
writer->endContainer(writer);
writer->addStringElement(writer, BSG_KSCrashField_Type,
Expand Down
4 changes: 2 additions & 2 deletions features/unhandled_mach_exception.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Feature: Bugsnag captures an unhandled mach exception
And the event "exceptions.0.message" equals "Attempted to dereference garbage pointer 0xdeadbeef."
And the event "metaData.error.address" equals 3735928559
And the event "metaData.error.type" equals "mach"
And the event "metaData.error.mach.code" equals 257
And the event "metaData.error.mach.code" equals "0x101"
And the event "metaData.error.mach.code_name" equals "EXC_ARM_DA_ALIGN"
And the event "metaData.error.mach.exception" equals 1
And the event "metaData.error.mach.exception_name" equals "EXC_BAD_ACCESS"
And the event "metaData.error.mach.subcode" equals 3735928559
And the event "metaData.error.mach.subcode" equals "0xdeadbeef"
And the event "severity" equals "error"
And the event "unhandled" is true
And the event "severityReason.type" equals "unhandledException"

0 comments on commit 107b1cb

Please sign in to comment.