[Lldb-commits] [PATCH] D20035: Add source file mapping to inline frames' SymbolContext line_entry.file
Ted Woodward via lldb-commits
lldb-commits at lists.llvm.org
Fri May 6 15:04:04 PDT 2016
ted created this revision.
ted added a reviewer: jingham.
ted added a subscriber: lldb-commits.
new StackFrame objects created in StackFrameList::GetFramesUpTo are constructed with SymbolContext set to nullptr, except for inline frames. Calling the ctor with nullptr causes StackFrame::GetSymbolContext to apply the target.source-map to line_entry.file. Calling it with a valid SC will cause line_entry.file to have the original file from the DWARF info, so the file comparison in ThreadPlanStepRange::InRange will fail when it should succeed.
This patch adds the mapping from StackFrame::GetSymbolContext to the inline frame case in StackFrameList::GetFramesUpTo.
http://reviews.llvm.org/D20035
Files:
source/Target/StackFrameList.cpp
Index: source/Target/StackFrameList.cpp
===================================================================
--- source/Target/StackFrameList.cpp
+++ source/Target/StackFrameList.cpp
@@ -350,6 +350,8 @@
if (unwind_block)
{
Address curr_frame_address (unwind_frame_sp->GetFrameCodeAddress());
+ TargetSP target_sp = m_thread.CalculateTarget();
+
// Be sure to adjust the frame address to match the address
// that was used to lookup the symbol context above. If we are
// in the first concrete frame, then we lookup using the current
@@ -362,9 +364,8 @@
// If curr_frame_address points to the first address in a section then after
// adjustment it will point to an other section. In that case resolve the
// address again to the correct section plus offset form.
- TargetSP target = m_thread.CalculateTarget();
- addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress(target.get(), eAddressClassCode);
- curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, target.get(), eAddressClassCode);
+ addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress(target_sp.get(), eAddressClassCode);
+ curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, target_sp.get(), eAddressClassCode);
}
else
{
@@ -377,17 +378,25 @@
while (unwind_sc.GetParentOfInlinedScope(curr_frame_address, next_frame_sc, next_frame_address))
{
- StackFrameSP frame_sp(new StackFrame (m_thread.shared_from_this(),
- m_frames.size(),
- idx,
- unwind_frame_sp->GetRegisterContextSP (),
- cfa,
- next_frame_address,
- &next_frame_sc));
-
- m_frames.push_back (frame_sp);
- unwind_sc = next_frame_sc;
- curr_frame_address = next_frame_address;
+ if (target_sp)
+ {
+ // Be sure to apply and file remappings to our file and line
+ // entries when handing out a line entry
+ FileSpec new_file_spec;
+ if (target_sp->GetSourcePathMap().FindFile(next_frame_sc.line_entry.file, new_file_spec))
+ next_frame_sc.line_entry.file = new_file_spec;
+ }
+ StackFrameSP frame_sp(new StackFrame(m_thread.shared_from_this(),
+ m_frames.size(),
+ idx,
+ unwind_frame_sp->GetRegisterContextSP (),
+ cfa,
+ next_frame_address,
+ &next_frame_sc));
+
+ m_frames.push_back (frame_sp);
+ unwind_sc = next_frame_sc;
+ curr_frame_address = next_frame_address;
}
}
} while (m_frames.size() - 1 < end_idx);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20035.56468.patch
Type: text/x-patch
Size: 3812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160506/eb2390c5/attachment.bin>
More information about the lldb-commits
mailing list