This is an archive of the discontinued LLVM Phabricator instance.

[lldb/crashlog] Improve exception reporting for interactive mode
ClosedPublic

Authored by mib on Aug 3 2022, 11:09 AM.

Details

Summary

This patch improve exception reporting when loading a crash report in a
scripted process. Now, we parse the exception dictionary from the
crash report use it the create a higher fidelity MachException stop info.

This patch also updates the test to reflect that change.

rdar://97096486

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Aug 3 2022, 11:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 11:09 AM
mib requested review of this revision.Aug 3 2022, 11:09 AM
JDevlieghere added inline comments.Aug 3 2022, 11:28 AM
lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
527–544

Just double checking: I assume these are always defined, even when mach/exception.h is not included?

569–570
580–612

Seems like a good candidate for a StringSwitch: https://llvm.org/doxygen/classllvm_1_1StringSwitch.html

mib marked 2 inline comments as done.Aug 3 2022, 6:32 PM
mib added inline comments.
lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
527–544

no, I'm getting the following error if I don't include mach/exception.h

llvm.org/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:525:8: error: use of undeclared identifier 'EXC_BAD_ACCESS'
  case EXC_BAD_ACCESS:
       ^
mib updated this revision to Diff 449848.Aug 3 2022, 6:35 PM

Use llvm::StringSwitch to get the exception code with the name

mib updated this revision to Diff 449849.Aug 3 2022, 6:39 PM

Remove the comment from MachException::ExceptionCode since the function returns now an llvm::Optional

mib updated this revision to Diff 452040.Aug 11 2022, 5:23 PM
mib marked an inline comment as done.

Reflect changes from D131719

JDevlieghere accepted this revision.Aug 11 2022, 5:49 PM

LGTM assuming this compiles on non-apple hosts

lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
527–544

So doesn't that mean this won't compile on a non-apple platform? Is this whole block APPLE only?

This revision is now accepted and ready to land.Aug 11 2022, 5:49 PM
mib updated this revision to Diff 452078.Aug 11 2022, 10:28 PM
This revision was landed with ongoing or failed builds.Aug 11 2022, 10:29 PM
This revision was automatically updated to reflect the committed changes.