[Lldb-commits] [PATCH] D157851: [lldb/crashlog] Add support for Last Exception Backtrace
This revision was automatically updated to reflect the committed changes. Closed by commit rG4c4f0d81f47c: [lldb/crashlog] Add support for Last Exception Backtrace (authored by mib). Changed prior to commit: https://reviews.llvm.org/D157851?vs=549854&id=551613#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157851/new/ https://reviews.llvm.org/D157851 Files: lldb/examples/python/crashlog.py lldb/examples/python/scripted_process/crashlog_scripted_process.py lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/asi.txt lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/leb.txt lldb/test/Shell/ScriptInterpreter/Python/Crashlog/last_exception_backtrace_crashlog.test Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/last_exception_backtrace_crashlog.test === --- /dev/null +++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/last_exception_backtrace_crashlog.test @@ -0,0 +1,52 @@ +# REQUIRES: python, native && target-aarch64 && system-darwin + +# RUN: mkdir -p %t.dir +# RUN: yaml2obj %S/Inputs/application_specific_info/asi.yaml > %t.dir/asi +# RUN: %lldb -o 'command script import lldb.macosx.crashlog' \ +# RUN: -o 'crashlog -a -i -t %t.dir/asi %S/Inputs/application_specific_info/leb.txt' \ +# RUN: -o "thread list" -o "bt all" 2>&1 | FileCheck %s + +# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands + +# CHECK: (lldb) process status --verbose +# CHECK-NEXT: Process 96535 stopped +# CHECK-NEXT: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_CRASH (code=0, subcode=0x0) +# CHECK-NEXT: frame #0: 0x0001a08c7224{{.*}}[artificial] +# CHECK: Extended Crash Information: +# CHECK: Application Specific Information: +# CHECK-NEXT: CoreFoundation: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** __boundsFail: index 10 beyond bounds [0 .. 3]' +# CHECK-NEXT: libc++abi.dylib: terminating with uncaught exception of type NSException +# CHECK-NEXT: libsystem_c.dylib: abort() called + + +# CHECK: (lldb) thread backtrace --extended true +# CHECK: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_CRASH (code=0, subcode=0x0) +# CHECK-NEXT: * frame #0: 0x0001a08c7224{{.*}}[artificial] +# CHECK-NEXT: frame #1: 0x0001a08fdceb{{.*}}[artificial] +# CHECK-NEXT: frame #2: 0x0001a08372c7{{.*}}[artificial] +# CHECK-NEXT: frame #3: 0x0001a08b7b17{{.*}}[artificial] +# CHECK-NEXT: frame #4: 0x0001a08a7a0b{{.*}}[artificial] +# CHECK-NEXT: frame #5: 0x0001a05ab763{{.*}}[artificial] +# CHECK-NEXT: frame #6: 0x0001a08b6eb3{{.*}}[artificial] +# CHECK-NEXT: frame #7: 0x0001a08b9c2b{{.*}}[artificial] +# CHECK-NEXT: frame #8: 0x0001a08b9bd7{{.*}}[artificial] +# CHECK-NEXT: frame #9: 0x0001a05a3007{{.*}}[artificial] +# CHECK-NEXT: frame #10: 0x0001a0b3dcc3{{.*}}[artificial] +# CHECK-NEXT: frame #11: 0x0001a0b46af3{{.*}}[artificial] +# CHECK-NEXT: frame #12: 0x0001a09a12a3{{.*}}[artificial] +# CHECK-NEXT: frame #13: 0x0001047e3ecf asi`main{{.*}}[artificial] +# CHECK-NEXT: frame #14: 0x0001a05d3e4f{{.*}}[artificial] + +# CHECK: thread #4294967295: tid = 0x0001, 0x0001a0a5840c{{.*}}, queue = 'Application Specific Backtrace' +# CHECK-NEXT: frame #0: 0x0001a0a5840c{{.*}} +# CHECK-NEXT: frame #1: 0x0001a05a2ea7{{.*}} +# CHECK-NEXT: frame #2: 0x0001a0b3dcc3{{.*}} +# CHECK-NEXT: frame #3: 0x0001a0b46af3{{.*}} +# CHECK-NEXT: frame #4: 0x0001a09a12a3{{.*}} +# CHECK-NEXT: frame #5: 0x0001047e3ecf asi`main{{.*}} +# CHECK-NEXT: frame #6: 0x0001a05d3e4f + + +# CHECK: (lldb) thread list +# CHECK-NEXT: Process 96535 stopped +# CHECK-NEXT: * thread #1: tid = 0x1af8f3, 0x0001a08c7224{{.*}}, queue = 'com.apple.main-thread', stop reason = EXC_CRASH (code=0, subcode=0x0) Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/asi.txt === --- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/asi.txt +++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/asi.txt @@ -37,7 +37,6 @@ "asi" : {"CoreFoundation":["*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** __boundsFail: index 10 beyond bounds [0 .. 3]'"],"libsystem_c.dylib":["abort() called"],"libc++abi.dylib":["terminating with uncaught exception of type NSException"]}, "asiBacktraces" : ["0 CoreFoundation 0x0001a0a58418 __exceptionPreprocess + 176\n1 libobjc.A.dylib 0x0001a05a2ea8 objc_exception_throw + 60\n2 CoreFoundation 0x0001a0b3dcc4 -[__NS
[Lldb-commits] [PATCH] D157851: [lldb/crashlog] Add support for Last Exception Backtrace
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. LGTM with Alex' comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157851/new/ https://reviews.llvm.org/D157851 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D157851: [lldb/crashlog] Add support for Last Exception Backtrace
mib added inline comments. Comment at: lldb/examples/python/crashlog.py:800-806 +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) bulbazord wrote: > Conceptually it looks like this is creating a new thread and adding it over > and over to the crashlog list of threads? How does this work? Indeed, this is bogus :p Good catch! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157851/new/ https://reviews.llvm.org/D157851 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D157851: [lldb/crashlog] Add support for Last Exception Backtrace
bulbazord added inline comments. Comment at: lldb/examples/python/crashlog.py:800-806 +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) Conceptually it looks like this is creating a new thread and adding it over and over to the crashlog list of threads? How does this work? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157851/new/ https://reviews.llvm.org/D157851 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D157851: [lldb/crashlog] Add support for Last Exception Backtrace
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 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(): 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: