diff options
author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2022-08-11 22:26:36 -0700 |
---|---|---|
committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2022-08-11 22:29:06 -0700 |
commit | edc77353daa707712fc92a31edb5b27ad103ba30 (patch) | |
tree | f697b5f0e4e225c4cfad9e72fe2366c6efacb912 /lldb/examples | |
parent | 603f44acc6ec31a274c554f0647630c10a114a6b (diff) | |
download | llvm-edc77353daa707712fc92a31edb5b27ad103ba30.tar.gz |
[lldb/crashlog] Improve exception reporting for interactive mode
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
Differential Revision: https://reviews.llvm.org/D131086
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/examples')
-rw-r--r-- | lldb/examples/python/scripted_process/crashlog_scripted_process.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/examples/python/scripted_process/crashlog_scripted_process.py b/lldb/examples/python/scripted_process/crashlog_scripted_process.py index ffdd43d7c5d8..e64b9b7822af 100644 --- a/lldb/examples/python/scripted_process/crashlog_scripted_process.py +++ b/lldb/examples/python/scripted_process/crashlog_scripted_process.py @@ -17,6 +17,7 @@ class CrashLogScriptedProcess(ScriptedProcess): self.addr_mask = crash_log.addr_mask self.crashed_thread_idx = crash_log.crashed_thread_idx self.loaded_images = [] + self.exception = crash_log.exception def load_images(self, images): #TODO: Add to self.loaded_images and load images in lldb @@ -69,6 +70,7 @@ class CrashLogScriptedProcess(ScriptedProcess): self.pid = super().get_process_id() self.crashed_thread_idx = 0 + self.exception = None self.parse_crashlog() def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo: @@ -154,9 +156,12 @@ class CrashLogScriptedThread(ScriptedThread): def get_stop_reason(self) -> Dict[str, Any]: if not self.has_crashed: - return { "type": lldb.eStopReasonNone, "data": { }} + return { "type": lldb.eStopReasonNone } # TODO: Investigate what stop reason should be reported when crashed - return { "type": lldb.eStopReasonException, "data": { "desc": "EXC_BAD_ACCESS" }} + stop_reason = { "type": lldb.eStopReasonException, "data": { }} + if self.scripted_process.exception: + stop_reason['data']['mach_exception'] = self.scripted_process.exception + return stop_reason def get_register_context(self) -> str: if not self.register_ctx: |