[Lldb-commits] [lldb] c9c09ef - [lldb/DWARF] Fix dwp search path in the separate-debug-file case

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 24 08:01:23 PST 2020


Author: Pavel Labath
Date: 2020-02-24T17:01:15+01:00
New Revision: c9c09ef836b49dba0a6fc784f322a96a86a9b985

URL: https://github.com/llvm/llvm-project/commit/c9c09ef836b49dba0a6fc784f322a96a86a9b985
DIFF: https://github.com/llvm/llvm-project/commit/c9c09ef836b49dba0a6fc784f322a96a86a9b985.diff

LOG: [lldb/DWARF] Fix dwp search path in the separate-debug-file case

The convention is that the dwp file name is derived from the name of the
file holding the executable code, even if the linked portion of the
debug info is elsewhere (objcopy --only-keep-debug).

Added: 
    lldb/test/Shell/SymbolFile/DWARF/dwp-separate-debug-file.cpp

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/test/CMakeLists.txt
    lldb/test/Shell/helper/toolchain.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index df1290c91782..c89ccb5bf960 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3880,7 +3880,7 @@ const std::shared_ptr<SymbolFileDWARFDwo> &SymbolFileDWARF::GetDwpSymbolFile() {
     ModuleSpec module_spec;
     module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec();
     module_spec.GetSymbolFileSpec() =
-        FileSpec(m_objfile_sp->GetFileSpec().GetPath() + ".dwp");
+        FileSpec(m_objfile_sp->GetModule()->GetFileSpec().GetPath() + ".dwp");
 
     FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
     FileSpec dwp_filespec =

diff  --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 21a0ca47b716..d5b9fab1cd14 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -126,6 +126,7 @@ add_lldb_test_dependency(
   lli
   llvm-config
   llvm-dwarfdump
+  llvm-dwp
   llvm-nm
   llvm-mc
   llvm-objcopy

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/dwp-separate-debug-file.cpp b/lldb/test/Shell/SymbolFile/DWARF/dwp-separate-debug-file.cpp
new file mode 100644
index 000000000000..26fd34d374a7
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/dwp-separate-debug-file.cpp
@@ -0,0 +1,17 @@
+// REQUIRES: lld
+
+// RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -c %s -o %t.o
+// RUN: ld.lld %t.o -o %t
+// RUN: llvm-dwp %t.dwo -o %t.dwp
+// RUN: rm %t.dwo
+// RUN: llvm-objcopy --only-keep-debug %t %t.debug
+// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.debug %t
+// RUN: %lldb %t -o "target variable a" -b | FileCheck %s
+
+// CHECK: (A) a = (x = 47)
+
+struct A {
+  int x = 47;
+};
+A a;
+int main() {}

diff  --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py
index a4bd9f20feb1..99e04b2b6e35 100644
--- a/lldb/test/Shell/helper/toolchain.py
+++ b/lldb/test/Shell/helper/toolchain.py
@@ -149,7 +149,7 @@ def use_support_substitutions(config):
         config.available_features.add('lld')
 
 
-    support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil',
+    support_tools = ['yaml2obj', 'obj2yaml', 'llvm-dwp', 'llvm-pdbutil',
                      'llvm-mc', 'llvm-readobj', 'llvm-objdump',
                      'llvm-objcopy', 'lli']
     additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir]


        


More information about the lldb-commits mailing list