[Lldb-commits] [lldb] b225c5f - [lldb] Parse and display reporting errors from JSON crashlogs
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 7 15:53:59 PDT 2021
Author: Jonas Devlieghere
Date: 2021-10-07T15:53:52-07:00
New Revision: b225c5f7861c7f99de3d52dc1ed23e358c5cce36
URL: https://github.com/llvm/llvm-project/commit/b225c5f7861c7f99de3d52dc1ed23e358c5cce36
DIFF: https://github.com/llvm/llvm-project/commit/b225c5f7861c7f99de3d52dc1ed23e358c5cce36.diff
LOG: [lldb] Parse and display reporting errors from JSON crashlogs
JSON crashlogs have an optional field named reportNotes that contains
any potential errors encountered by the crash reporter when generating
the crashlog. Parse and display them in LLDB.
Differential revision: https://reviews.llvm.org/D111339
Added:
Modified:
lldb/examples/python/crashlog.py
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/json.test
Removed:
################################################################################
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index ae4263b76cba..242ded01817f 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -334,6 +334,7 @@ def __init__(self, debugger, path, verbose):
self.threads = list()
self.backtraces = list() # For application specific backtraces
self.idents = list() # A list of the required identifiers for doing all stack backtraces
+ self.errors = list()
self.crashed_thread_idx = -1
self.version = -1
self.target = None
@@ -437,6 +438,7 @@ def parse(self):
self.parse_process_info(self.data)
self.parse_images(self.data['usedImages'])
self.parse_threads(self.data['threads'])
+ self.parse_errors(self.data)
thread = self.crashlog.threads[self.crashlog.crashed_thread_idx]
reason = self.parse_crash_reason(self.data['exception'])
if thread.reason:
@@ -528,6 +530,10 @@ def parse_thread_registers(self, json_thread_state):
pass
return registers
+ def parse_errors(self, json_data):
+ if 'reportNotes' in json_data:
+ self.crashlog.errors = json_data['reportNotes']
+
class CrashLogParseMode:
NORMAL = 0
@@ -1067,6 +1073,11 @@ def SymbolicateCrashLog(crash_log, options):
thread.dump_symbolicated(crash_log, options)
print()
+ if crash_log.errors:
+ print("Errors:")
+ for error in crash_log.errors:
+ print(error)
+
def CreateSymbolicateCrashLogOptions(
command_name,
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
index 5446d0d9973a..109ac2ba2485 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
@@ -170,5 +170,9 @@
"threadTriggered" : {
"queue" : "com.apple.main-thread"
}
-}
+},
+ "reportNotes" : [
+ "invalid foo",
+ "invalid bar"
+]
}
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/json.test b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/json.test
index 0c522e9d202b..b70cd44c0c8e 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/json.test
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/json.test
@@ -13,3 +13,5 @@
# CHECK: [ 1] {{.*}}out`bar + 8 at test.c
# CHECK: [ 2] {{.*}}out`main + 19 at test.c
# CHECK: rbp = 0x00007ffeec22a530
+# CHECK: invalid foo
+# CHECK: invalid bar
More information about the lldb-commits
mailing list