[Lldb-commits] [lldb] 3e54ea0 - [lldb/crashlog] Fix line entries resolution in interactive mode
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed May 18 18:23:02 PDT 2022
Author: Med Ismail Bennani
Date: 2022-05-18T18:22:47-07:00
New Revision: 3e54ea0cfa3074e36ebee11848e072785437a8b9
URL: https://github.com/llvm/llvm-project/commit/3e54ea0cfa3074e36ebee11848e072785437a8b9
DIFF: https://github.com/llvm/llvm-project/commit/3e54ea0cfa3074e36ebee11848e072785437a8b9.diff
LOG: [lldb/crashlog] Fix line entries resolution in interactive mode
This patch subtracts 1 to the pc of any frame above frame 0 to get the
previous line entry and display the right line in the debugger.
This also rephrase some old comment from `48d157dd4`.
rdar://92686666
Differential Revision: https://reviews.llvm.org/D125928
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Added:
Modified:
lldb/examples/python/crashlog.py
lldb/examples/python/scripted_process/crashlog_scripted_process.py
Removed:
################################################################################
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index a20798ab11940..b2145762d7a8f 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -115,8 +115,8 @@ def dump_symbolicated(self, crash_log, options):
disassemble = (
this_thread_crashed or options.disassemble_all_threads) and frame_idx < options.disassemble_depth
- # Any frame above frame zero and we have to subtract one to
- # get the previous line entry.
+ # Except for the zeroth frame, we should subtract 1 from every
+ # frame pc 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)
diff --git a/lldb/examples/python/scripted_process/crashlog_scripted_process.py b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
index f3b11e3699d98..70198da563aa3 100644
--- a/lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -16,6 +16,7 @@ def parse_crashlog(self):
return
self.pid = crash_log.process_id
+ self.addr_mask = crash_log.addr_mask
self.crashed_thread_idx = crash_log.crashed_thread_idx
self.loaded_images = []
@@ -122,11 +123,13 @@ def create_stackframes(self):
return None
for frame in self.backing_thread.frames:
+ frame_pc = frame.pc & self.scripted_process.addr_mask
+ pc = frame_pc if frame.index == 0 or frame_pc == 0 else frame_pc - 1
sym_addr = lldb.SBAddress()
- sym_addr.SetLoadAddress(frame.pc, self.target)
+ sym_addr.SetLoadAddress(pc, self.target)
if not sym_addr.IsValid():
continue
- self.frames.append({"idx": frame.index, "pc": frame.pc})
+ self.frames.append({"idx": frame.index, "pc": pc})
return self.frames
More information about the lldb-commits
mailing list