Author: alexshap Date: Tue Oct 10 16:28:34 2017 New Revision: 315387 URL: http://llvm.org/viewvc/llvm-project?rev=315387&view=rev Log: [lldb] Enable using out-of-tree dwps
Previously LLDB required the DWP file to be located next to the executable file. This diff uses the helper function Symbols::LocateExecutableSymbolFile to search for DWP files in the standard locations for debug symbols. Test plan: Build a toy test example: main.cpp clang -gsplit-dwarf -g -O0 main.cpp -o main.exe llvm-dwp -e main.exe -o main.exe.dwp mkdir -p debug_symbols mv main.exe.dwp debug_symbols/main.exe.dwp Run lldb: lldb settings set target.debug-file-search-paths ./debug_symbols file ./main.exe br set --name f run Check that debugging works: setting breakpoints, printing local variables. Differential revision: https://reviews.llvm.org/D38568 Modified: lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Host/common/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=315387&r1=315386&r2=315387&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Symbols.cpp (original) +++ lldb/trunk/source/Host/common/Symbols.cpp Tue Oct 10 16:28:34 2017 @@ -285,7 +285,12 @@ FileSpec Symbols::LocateExecutableSymbol if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - if (mspec.GetUUID() == module_uuid) + // Skip the uuids check if module_uuid is invalid. + // For example, this happens for *.dwp files since + // at the moment llvm-dwp doesn't output build ids, + // nor does binutils dwp. + if (!module_uuid.IsValid() || + module_uuid == mspec.GetUUID()) return file_spec; } } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=315387&r1=315386&r2=315387&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Oct 10 16:28:34 2017 @@ -30,6 +30,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueProperties.h" @@ -4352,7 +4353,11 @@ SymbolFileDWARF::GetLocationListFormat() SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { - FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); + ModuleSpec module_spec; + module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); + module_spec.GetSymbolFileSpec() = + FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); + FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (dwp_filespec.Exists()) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits