[Lldb-commits] [PATCH] D71770: [lldb] Don't process symlinks deep inside DWARFUnit
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 23 02:24:19 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3cfb6677b2aa: [lldb] Don't process symlinks deep inside DWARFUnit (authored by labath).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71770/new/
https://reviews.llvm.org/D71770
Files:
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -453,6 +453,17 @@
void SymbolFileDWARF::InitializeObject() {
Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+ Module &module = *GetObjectFile()->GetModule();
+
+ for (const FileSpec &symlink : GetSymlinkPaths()) {
+ FileSpec resolved;
+ Status status = FileSystem::Instance().Readlink(symlink, resolved);
+ if (status.Success())
+ module.GetSourceMappingList().Append(ConstString(symlink.GetPath()),
+ ConstString(resolved.GetPath()),
+ /*notify=*/true);
+ }
+
if (!GetGlobalPluginProperties()->IgnoreFileIndexes()) {
DWARFDataExtractor apple_names, apple_namespaces, apple_types, apple_objc;
LoadSectionData(eSectionTypeDWARFAppleNames, apple_names);
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -732,25 +732,6 @@
return path;
}
-static FileSpec resolveCompDir(const FileSpec &path) {
- bool is_symlink = SymbolFileDWARF::GetSymlinkPaths().FindFileIndex(
- 0, path, /*full*/ true) != UINT32_MAX;
-
- if (!is_symlink)
- return path;
-
- namespace fs = llvm::sys::fs;
- if (fs::get_file_type(path.GetPath(), false) != fs::file_type::symlink_file)
- return path;
-
- FileSpec resolved_symlink;
- const auto error = FileSystem::Instance().Readlink(path, resolved_symlink);
- if (error.Success())
- return resolved_symlink;
-
- return path;
-}
-
void DWARFUnit::ComputeCompDirAndGuessPathStyle() {
m_comp_dir = FileSpec();
const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly();
@@ -762,7 +743,7 @@
if (!comp_dir.empty()) {
FileSpec::Style comp_dir_style =
FileSpec::GuessPathStyle(comp_dir).getValueOr(FileSpec::Style::native);
- m_comp_dir = resolveCompDir(FileSpec(comp_dir, comp_dir_style));
+ m_comp_dir = FileSpec(comp_dir, comp_dir_style);
} else {
// Try to detect the style based on the DW_AT_name attribute, but just store
// the detected style in the m_comp_dir field.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71770.235120.patch
Type: text/x-patch
Size: 2450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191223/ffb8bced/attachment.bin>
More information about the lldb-commits
mailing list