[Lldb-commits] [lldb] 21658b7 - [lldb/crashlog] Fix exception signal parsing
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 16 11:45:18 PST 2022
Author: Med Ismail Bennani
Date: 2022-02-16T11:44:07-08:00
New Revision: 21658b77a5965217eb67f8e1ccd4307111c775f7
URL: https://github.com/llvm/llvm-project/commit/21658b77a5965217eb67f8e1ccd4307111c775f7
DIFF: https://github.com/llvm/llvm-project/commit/21658b77a5965217eb67f8e1ccd4307111c775f7.diff
LOG: [lldb/crashlog] Fix exception signal parsing
In some cases, it can happen that crashlogs don't have any signal in
the exception, which causes the parser to crash.
This fixes the parsing by checking if the `signal` field is in the
`exception` dictionary before trying to access it.
rdar://84552251
Differential Revision: https://reviews.llvm.org/D119504
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Added:
Modified:
lldb/examples/python/crashlog.py
Removed:
################################################################################
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 2f5cafc49503..8c20fa71d3e2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -466,14 +466,17 @@ def parse_process_info(self, json_data):
def parse_crash_reason(self, json_exception):
exception_type = json_exception['type']
- exception_signal = json_exception['signal']
+ exception_signal = " "
+ if 'signal' in json_exception:
+ exception_signal += "({})".format(json_exception['signal'])
+
if 'codes' in json_exception:
exception_extra = " ({})".format(json_exception['codes'])
elif 'subtype' in json_exception:
exception_extra = " ({})".format(json_exception['subtype'])
else:
exception_extra = ""
- return "{} ({}){}".format(exception_type, exception_signal,
+ return "{}{}{}".format(exception_type, exception_signal,
exception_extra)
def parse_images(self, json_images):
More information about the lldb-commits
mailing list