Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2022-05-17 00:51:27 +0300
committerJonas Devlieghere <jonas@devlieghere.com>2022-05-17 01:00:36 +0300
commit9defb3b4b4a3ab5a95c449471aaa930cf63a7106 (patch)
tree4985f94242ef15ec7602369f4de1c0f27effb377 /lldb
parent07d549bce94fc86fb1dc37aa0fb328e77208a185 (diff)
[lldb] Prevent underflow in crashlog.py
Avoid a OverflowError (an underflow really) when the pc is zero. This can happen for "unknown frames" where the crashlog generator reports a zero pc. We could omit them altogether, but if they're part of the crashlog it seems fair to display them in lldb as well. rdar://92686666 Differential revision: https://reviews.llvm.org/D125716
Diffstat (limited to 'lldb')
-rwxr-xr-xlldb/examples/python/crashlog.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 49c9a92497eb..a20798ab1194 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -114,14 +114,12 @@ class CrashLog(symbolication.Symbolicator):
for frame_idx, frame in enumerate(self.frames):
disassemble = (
this_thread_crashed or options.disassemble_all_threads) and frame_idx < options.disassemble_depth
- if frame_idx == 0:
- symbolicated_frame_addresses = crash_log.symbolicate(
- frame.pc & crash_log.addr_mask, options.verbose)
- else:
- # Any frame above frame zero and we have to subtract one to
- # get the previous line entry
- symbolicated_frame_addresses = crash_log.symbolicate(
- (frame.pc & crash_log.addr_mask) - 1, options.verbose)
+
+ # Any frame above frame zero and we have to subtract one to
+ # get the previous line entry.
+ pc = frame.pc & crash_log.addr_mask
+ pc = pc if frame_idx == 0 or pc == 0 else pc - 1
+ symbolicated_frame_addresses = crash_log.symbolicate(pc, options.verbose)
if symbolicated_frame_addresses:
symbolicated_frame_address_idx = 0