From: Pavel Labath Date: Mon, 24 Feb 2020 15:45:37 +0000 (+0100) Subject: [lldb/DWARF] Fix dwp search path in the separate-debug-file case X-Git-Tag: llvmorg-12-init~13826 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9c09ef836b49dba0a6fc784f322a96a86a9b985;p=platform%2Fupstream%2Fllvm.git [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). --- diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index df1290c..c89ccb5 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 &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 21a0ca4..d5b9fab 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 0000000..26fd34d --- /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 a4bd9f2..99e04b2 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]