summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Core/Module.cpp7
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp18
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp15
-rw-r--r--lldb/source/Target/PathMappingList.cpp21
4 files changed, 46 insertions, 15 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 8372b53afe3..dea7b1f4b0b 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1165,3 +1165,10 @@ Module::FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const
return m_source_mappings.FindFile (orig_spec, new_spec);
}
+bool
+Module::RemapSourceFile (const char *path, std::string &new_path) const
+{
+ Mutex::Locker locker (m_mutex);
+ return m_source_mappings.RemapPath(path, new_path);
+}
+
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index d084bd26aa1..0367f50e94a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -497,6 +497,7 @@ DWARFDebugLine::ParseSupportFiles (const lldb::ModuleSP &module_sp,
break;
}
std::string fullpath;
+ std::string remapped_fullpath;
while (offset < end_prologue_offset)
{
const char* path = debug_line_data.GetCStr( &offset );
@@ -509,7 +510,10 @@ DWARFDebugLine::ParseSupportFiles (const lldb::ModuleSP &module_sp,
if (path[0] == '/')
{
// The path starts with a directory delimiter, so we are done.
- fullpath = path;
+ if (module_sp->RemapSourceFile (path, fullpath))
+ support_files.Append(FileSpec (fullpath.c_str(), false));
+ else
+ support_files.Append(FileSpec (path, false));
}
else
{
@@ -538,16 +542,12 @@ DWARFDebugLine::ParseSupportFiles (const lldb::ModuleSP &module_sp,
fullpath += '/';
}
fullpath += path;
+ if (module_sp->RemapSourceFile (fullpath.c_str(), remapped_fullpath))
+ support_files.Append(FileSpec (remapped_fullpath.c_str(), false));
+ else
+ support_files.Append(FileSpec (fullpath.c_str(), false));
}
- // We don't need to realpath files in the debug_line tables.
- FileSpec file_spec(fullpath.c_str(), false);
-
- FileSpec remapped_file_spec;
- if (module_sp->FindSourceFile(file_spec, remapped_file_spec))
- support_files.Append(remapped_file_spec);
- else
- support_files.Append(file_spec);
}
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index ec683363c65..d3f00e2c286 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -723,13 +723,17 @@ SymbolFileDWARF::ParseCompileUnit (DWARFCompileUnit* curr_cu, CompUnitSP& compil
LanguageType cu_language = (LanguageType)cu_die->GetAttributeValueAsUnsigned(this, curr_cu, DW_AT_language, 0);
if (cu_die_name)
{
+ std::string ramapped_file;
FileSpec cu_file_spec;
if (cu_die_name[0] == '/' || cu_comp_dir == NULL || cu_comp_dir[0] == '\0')
{
// If we have a full path to the compile unit, we don't need to resolve
// the file. This can be expensive e.g. when the source files are NFS mounted.
- cu_file_spec.SetFile (cu_die_name, false);
+ if (module_sp->RemapSourceFile(cu_die_name, ramapped_file))
+ cu_file_spec.SetFile (ramapped_file.c_str(), false);
+ else
+ cu_file_spec.SetFile (cu_die_name, false);
}
else
{
@@ -737,13 +741,12 @@ SymbolFileDWARF::ParseCompileUnit (DWARFCompileUnit* curr_cu, CompUnitSP& compil
if (*fullpath.rbegin() != '/')
fullpath += '/';
fullpath += cu_die_name;
- cu_file_spec.SetFile (fullpath.c_str(), false);
+ if (module_sp->RemapSourceFile (fullpath.c_str(), ramapped_file))
+ cu_file_spec.SetFile (ramapped_file.c_str(), false);
+ else
+ cu_file_spec.SetFile (fullpath.c_str(), false);
}
- FileSpec remapped_file_spec;
- if (module_sp->FindSourceFile(cu_file_spec, remapped_file_spec))
- cu_file_spec = remapped_file_spec;
-
compile_unit_sp.reset(new CompileUnit (module_sp,
curr_cu,
cu_file_spec,
diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp
index 6acd8bfe46d..345bbed3b14 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -174,6 +174,27 @@ PathMappingList::RemapPath (const ConstString &path, ConstString &new_path) cons
}
bool
+PathMappingList::RemapPath (const char *path, std::string &new_path) const
+{
+ if (!m_pairs.empty() || path == NULL || path[0] == '\0')
+ return false;
+
+ const_iterator pos, end = m_pairs.end();
+ for (pos = m_pairs.begin(); pos != end; ++pos)
+ {
+ const size_t prefix_len = pos->first.GetLength();
+
+ if (::strncmp (pos->first.GetCString(), path, prefix_len) == 0)
+ {
+ new_path = pos->second.GetCString();
+ new_path.append(path + prefix_len);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool
PathMappingList::FindFile (const FileSpec &orig_spec, FileSpec &new_spec) const
{
if (!m_pairs.empty())
OpenPOWER on IntegriCloud