[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).
This commit is contained in:
Pavel Labath 2020-02-24 16:45:37 +01:00
parent c008716417
commit c9c09ef836
4 changed files with 20 additions and 2 deletions

View File

@ -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 =

View File

@ -126,6 +126,7 @@ add_lldb_test_dependency(
lli
llvm-config
llvm-dwarfdump
llvm-dwp
llvm-nm
llvm-mc
llvm-objcopy

View File

@ -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() {}

View File

@ -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]