Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-5084] Stringify Mach exception code and subcode #827

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"