Page MenuHomePhabricator

[lldb] Enable using out-of-tree dwps

Authored by alexshap on Oct 4 2017, 4:14 PM.



Previously LLDB required the DWP file to be located next to the executable file
(see the code in SymbolFileDWARF::GetDwpSymbolFile).
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
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
rm -f main.dwo

Run lldb:
settings set target.debug-file-search-paths ./debug_symbols
file ./main.exe
br set --name f

Check that debugging works
(setting breakpoints, printing local variables (this was not working before))

Diff Detail


Event Timeline

alexshap created this revision.Oct 4 2017, 4:14 PM
alexshap edited the summary of this revision. (Show Details)Oct 4 2017, 4:14 PM
alexshap added a subscriber: sas.
tberghammer added inline comments.Oct 9 2017, 3:01 AM
288–294 ↗(On Diff #117755)

What do you think about adding a new argument to Symbols::LocateExecutableSymbolFile (with a potential default value) to specify if we want to check the UUID and then move this logic to the place where we are looking for the dwp file? I think that would make dwp specific logic more concise in one place.

clayborg added inline comments.Oct 9 2017, 8:29 AM
288–294 ↗(On Diff #117755)

An easier fix is to clear the UUID field from in "module_spec" _before_ you call this function. The module spec can be filled in as much as is needed, so either clear the UUID in module_spec if it is set, or just don't set it. This function should ignore the UUID comparison if the UUID field is not valid in module_spec, so if it isn't doing this, then it should

clayborg edited edge metadata.Oct 9 2017, 8:36 AM

(sorry for the delay, I was out on vacation for a week)

alexshap updated this revision to Diff 118250.Oct 9 2017, 12:03 PM

Ignore the UUID comparison if the UUID field is not valid (in this case the interface seems to be a bit cleaner (module_spec is the single source of truth (without extra parameters))

clayborg accepted this revision.Oct 9 2017, 1:18 PM

Looks good.

This revision is now accepted and ready to land.Oct 9 2017, 1:18 PM
tberghammer accepted this revision.Oct 10 2017, 5:02 AM

Looks good. Thanks for fixing it.

This revision was automatically updated to reflect the committed changes.