[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@gmail.com>
This commit is contained in:
@@ -16,6 +16,7 @@ class CrashLogScriptedProcess(ScriptedProcess):
|
||||
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 @@ class CrashLogScriptedThread(ScriptedThread):
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user