[Lldb-commits] [PATCH] D157851: [lldb/crashlog] Add support for Last Exception Backtrace
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 14 03:06:23 PDT 2023
mib created this revision.
mib added reviewers: bulbazord, JDevlieghere.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.
This patch adds support to the "Last Exception Backtrace" to the
`crashlog` command.
This metadata is homologous to the "Application Specific Backtrace",
however the format is closer to a regular stack frame.
Since the thread that "contains" the "Last Exception Backtrace" doesn't
really exist, this information is displayed when requesting an extended
backtrace of the crashed thread, similarly to the "Application Specific
Backtrace".
To achieve that, this patch includes some refactors and fixes to the
existing "Application Specific Backtrace" handling.
rdar://113046509
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157851
Files:
lldb/examples/python/crashlog.py
lldb/examples/python/scripted_process/crashlog_scripted_process.py
Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py
===================================================================
--- lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -178,7 +178,7 @@
self.idx = self.backing_thread.index
self.tid = self.backing_thread.id
if self.backing_thread.app_specific_backtrace:
- self.name = "Application Specific Backtrace - " + str(self.idx)
+ self.name = "Application Specific Backtrace"
else:
self.name = self.backing_thread.name
self.queue = self.backing_thread.queue
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -586,10 +586,15 @@
self.parse_threads(self.data["threads"])
if "asi" in self.data:
self.crashlog.asi = self.data["asi"]
+ # FIXME: With the current design, we can either show the ASI or Last
+ # Exception Backtrace, not both. Is there a situation where we would
+ # like to show both ?
if "asiBacktraces" in self.data:
self.parse_app_specific_backtraces(self.data["asiBacktraces"])
if "lastExceptionBacktrace" in self.data:
- self.crashlog.asb = self.data["lastExceptionBacktrace"]
+ self.parse_last_exception_backtraces(
+ self.data["lastExceptionBacktrace"]
+ )
self.parse_errors(self.data)
thread = self.crashlog.threads[self.crashlog.crashed_thread_idx]
reason = self.parse_crash_reason(self.data["exception"])
@@ -792,12 +797,22 @@
return True
def parse_app_specific_backtraces(self, json_app_specific_bts):
- for idx, backtrace in enumerate(json_app_specific_bts):
- thread = self.crashlog.Thread(idx, True, self.crashlog.process_arch)
- thread.queue = "Application Specific Backtrace"
+ thread = self.crashlog.Thread(
+ len(self.crashlog.threads), True, self.crashlog.process_arch
+ )
+ thread.queue = "Application Specific Backtrace"
+ for backtrace in json_app_specific_bts:
if self.parse_asi_backtrace(thread, backtrace):
self.crashlog.threads.append(thread)
+ def parse_last_exception_backtraces(self, json_last_exc_bts):
+ thread = self.crashlog.Thread(
+ len(self.crashlog.threads), True, self.crashlog.process_arch
+ )
+ thread.queue = "Last Exception Backtrace"
+ self.parse_frames(thread, json_last_exc_bts)
+ self.crashlog.threads.append(thread)
+
def parse_thread_registers(self, json_thread_state, prefix=None):
registers = dict()
for key, state in json_thread_state.items():
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157851.549854.patch
Type: text/x-patch
Size: 2987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230814/b27023fa/attachment-0001.bin>
More information about the lldb-commits
mailing list