summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Symbol/LineEntry.h13
-rw-r--r--lldb/source/Breakpoint/BreakpointResolver.cpp5
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp4
-rw-r--r--lldb/source/Symbol/LineEntry.cpp16
-rw-r--r--lldb/source/Symbol/LineTable.cpp5
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp1
-rw-r--r--lldb/source/Target/StackFrame.cpp9
-rw-r--r--lldb/source/Target/StackFrameList.cpp29
-rw-r--r--lldb/source/Target/ThreadPlanStepOverRange.cpp6
-rw-r--r--lldb/source/Target/ThreadPlanStepRange.cpp2
10 files changed, 57 insertions, 33 deletions
diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h
index 374c04a7fce..e6a05c10a76 100644
--- a/lldb/include/lldb/Symbol/LineEntry.h
+++ b/lldb/include/lldb/Symbol/LineEntry.h
@@ -168,10 +168,21 @@ struct LineEntry
GetSameLineContiguousAddressRange () const;
//------------------------------------------------------------------
+ /// Apply file mappings from target.source-map to the LineEntry's file.
+ ///
+ /// @param[in] target_sp
+ /// Shared pointer to the target this LineEntry belongs to.
+ //------------------------------------------------------------------
+
+ void
+ ApplyFileMappings(lldb::TargetSP target_sp);
+
+ //------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
AddressRange range; ///< The section offset address range for this line entry.
- FileSpec file;
+ FileSpec file; ///< The source file, possibly mapped by the target.source-map setting
+ FileSpec original_file; ///< The original source file, from debug info.
uint32_t line; ///< The source line number, or zero if there is no line number information.
uint16_t column; ///< The column number of the source line, or zero if there is no column information.
uint16_t is_start_of_statement:1, ///< Indicates this entry is the beginning of a statement.
diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp
index f8787711d22..e757b388550 100644
--- a/lldb/source/Breakpoint/BreakpointResolver.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolver.cpp
@@ -75,6 +75,7 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
bool first_entry = true;
FileSpec match_file_spec;
+ FileSpec match_original_file_spec;
uint32_t closest_line_number = UINT32_MAX;
// Pull out the first entry, and all the others that match its file spec, and stuff them in the tmp list.
@@ -86,11 +87,13 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
if (first_entry)
{
match_file_spec = sc.line_entry.file;
+ match_original_file_spec = sc.line_entry.original_file;
matches = true;
first_entry = false;
}
else
- matches = (sc.line_entry.file == match_file_spec);
+ matches = ((sc.line_entry.file == match_file_spec) ||
+ (sc.line_entry.original_file == match_original_file_spec));
if (matches)
{
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index ac0a8fc8f4b..3541f9bf804 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -897,7 +897,7 @@ protected:
operator == (const SourceInfo &rhs) const
{
return function == rhs.function &&
- line_entry.file == rhs.line_entry.file &&
+ line_entry.original_file == rhs.line_entry.original_file &&
line_entry.line == rhs.line_entry.line;
}
@@ -905,7 +905,7 @@ protected:
operator != (const SourceInfo &rhs) const
{
return function != rhs.function ||
- line_entry.file != rhs.line_entry.file ||
+ line_entry.original_file != rhs.line_entry.original_file ||
line_entry.line != rhs.line_entry.line;
}
diff --git a/lldb/source/Symbol/LineEntry.cpp b/lldb/source/Symbol/LineEntry.cpp
index 815101368bd..9b3a043f6ca 100644
--- a/lldb/source/Symbol/LineEntry.cpp
+++ b/lldb/source/Symbol/LineEntry.cpp
@@ -43,6 +43,7 @@ LineEntry::LineEntry
) :
range(section_sp, section_offset, byte_size),
file(_file),
+ original_file(_file),
line(_line),
column(_column),
is_start_of_statement(_is_start_of_statement),
@@ -58,6 +59,7 @@ LineEntry::Clear()
{
range.Clear();
file.Clear();
+ original_file.Clear();
line = LLDB_INVALID_LINE_NUMBER;
column = 0;
is_start_of_statement = 0;
@@ -260,7 +262,7 @@ LineEntry::GetSameLineContiguousAddressRange () const
if (next_line_sc.line_entry.IsValid()
&& next_line_sc.line_entry.range.GetByteSize() > 0
- && file == next_line_sc.line_entry.file)
+ && original_file == next_line_sc.line_entry.original_file)
{
// Include any line 0 entries - they indicate that this is compiler-generated code
// that does not correspond to user source code.
@@ -283,3 +285,15 @@ LineEntry::GetSameLineContiguousAddressRange () const
}
return complete_line_range;
}
+
+void
+LineEntry::ApplyFileMappings(lldb::TargetSP target_sp)
+{
+ if (target_sp)
+ {
+ // Apply any file remappings to our file
+ FileSpec new_file_spec;
+ if (target_sp->GetSourcePathMap().FindFile(original_file, new_file_spec))
+ file = new_file_spec;
+ }
+}
diff --git a/lldb/source/Symbol/LineTable.cpp b/lldb/source/Symbol/LineTable.cpp
index f9a42a7d14a..965dd689981 100644
--- a/lldb/source/Symbol/LineTable.cpp
+++ b/lldb/source/Symbol/LineTable.cpp
@@ -299,6 +299,7 @@ LineTable::ConvertEntryAtIndexToLineEntry (uint32_t idx, LineEntry &line_entry)
line_entry.range.SetByteSize(0);
line_entry.file = m_comp_unit->GetSupportFiles().GetFileSpecAtIndex (entry.file_idx);
+ line_entry.original_file = m_comp_unit->GetSupportFiles().GetFileSpecAtIndex(entry.file_idx);
line_entry.line = entry.line;
line_entry.column = entry.column;
line_entry.is_start_of_statement = entry.is_start_of_statement;
@@ -462,9 +463,9 @@ LineTable::Dump (Stream *s, Target *target, Address::DumpStyle style, Address::D
for (size_t idx = 0; idx < count; ++idx)
{
ConvertEntryAtIndexToLineEntry (idx, line_entry);
- line_entry.Dump (s, target, prev_file != line_entry.file, style, fallback_style, show_line_ranges);
+ line_entry.Dump (s, target, prev_file != line_entry.original_file, style, fallback_style, show_line_ranges);
s->EOL();
- prev_file = line_entry.file;
+ prev_file = line_entry.original_file;
}
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 4a398420737..4a0947571eb 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -595,6 +595,7 @@ SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc,
next_frame_pc = range.GetBaseAddress();
next_frame_sc.line_entry.range.GetBaseAddress() = next_frame_pc;
next_frame_sc.line_entry.file = curr_inlined_block_inlined_info->GetCallSite().GetFile();
+ next_frame_sc.line_entry.original_file = curr_inlined_block_inlined_info->GetCallSite().GetFile();
next_frame_sc.line_entry.line = curr_inlined_block_inlined_info->GetCallSite().GetLine();
next_frame_sc.line_entry.column = curr_inlined_block_inlined_info->GetCallSite().GetColumn();
return true;
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index d63fa132bc3..c4ebdfe5ecc 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -490,14 +490,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
if ((resolved & eSymbolContextLineEntry) && !m_sc.line_entry.IsValid())
{
m_sc.line_entry = sc.line_entry;
- if (m_sc.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 (m_sc.target_sp->GetSourcePathMap().FindFile (m_sc.line_entry.file, new_file_spec))
- m_sc.line_entry.file = new_file_spec;
- }
+ m_sc.line_entry.ApplyFileMappings(m_sc.target_sp);
}
}
}
diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp
index 3f29c103011..f78337ba7b3 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -350,6 +350,7 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
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 +363,8 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
// 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 +377,18 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
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;
+ next_frame_sc.line_entry.ApplyFileMappings(target_sp);
+ 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);
diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp
index 2e731a84578..95dc2205bbf 100644
--- a/lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -232,7 +232,7 @@ ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
sc = frame_sp->GetSymbolContext (eSymbolContextEverything);
if (sc.line_entry.IsValid())
{
- if (sc.line_entry.file != m_addr_context.line_entry.file
+ if (sc.line_entry.original_file != m_addr_context.line_entry.original_file
&& sc.comp_unit == m_addr_context.comp_unit
&& sc.function == m_addr_context.function)
{
@@ -256,7 +256,7 @@ ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
// some code fragment by using #include <source-fragment.c> directly.
LineEntry prev_line_entry;
if (line_table->GetLineEntryAtIndex(entry_idx - 1, prev_line_entry)
- && prev_line_entry.file == line_entry.file)
+ && prev_line_entry.original_file == line_entry.original_file)
{
SymbolContext prev_sc;
Address prev_address = prev_line_entry.range.GetBaseAddress();
@@ -289,7 +289,7 @@ ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
if (next_line_function != m_addr_context.function)
break;
- if (next_line_entry.file == m_addr_context.line_entry.file)
+ if (next_line_entry.original_file == m_addr_context.line_entry.original_file)
{
const bool abort_other_plans = false;
const RunMode stop_other_threads = RunMode::eAllThreads;
diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index 02667f8236e..f3f85b63918 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -155,7 +155,7 @@ ThreadPlanStepRange::InRange ()
SymbolContext new_context(frame->GetSymbolContext(eSymbolContextEverything));
if (m_addr_context.line_entry.IsValid() && new_context.line_entry.IsValid())
{
- if (m_addr_context.line_entry.file == new_context.line_entry.file)
+ if (m_addr_context.line_entry.original_file == new_context.line_entry.original_file)
{
if (m_addr_context.line_entry.line == new_context.line_entry.line)
{
OpenPOWER on IntegriCloud