[Lldb-commits] [PATCH] D97786: LLDB: Use path relative to binary, not relative to debugger CWD, for finding .dwo files.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 5 10:25:11 PST 2021


labath added a comment.

In D97786#2603656 <https://reviews.llvm.org/D97786#2603656>, @cmtice wrote:

> I'm not sure about using target.debug-file-search-paths, and what the changes Pavel is suggesting would entail.

I imagine it would involve calling Symbols::LocateExecutableSymbolFile to locate the dwo file, similar to how we do that for dwp files (see `SymbolFileDWARF::GetDwpSymbolFile`). (Disclaimer: I have not tried doing this, so I don't know if that function would work out-of-the-box.)
Note that I myself am not convinced that this is the right solution (that function is rather heavy), but it does solve the problem of "how do we let the user specify/choose the location of the dwo files" (answer: put the path in the target.debug-file-search-paths setting), and it would search the cwd and the module directory automatically. And the "heavy-ness" of the function is moderated by the fact that it is a no-op for absolute paths to existing files.

> But the real question I am trying to resolve here is not "what are all the places we should be searching for the .dwo files?" but "When we're given a *relative path* in the DWARF for finding the files, what should it be relative TO?".

I'm sorry, but what's the difference between those two questions? Is it about the fact that the second question sort of implies that there should only be one correct location where we should be searching?

> I still think the most correct answer to that question is "relative to the location of the binary" (I know, this is assuming that the binary has not been moved since it was built, or all bets are off).  If you like, I can update this patch so that it continues to search relative to the cwd (where the debugger was launched), and IN ADDITION, will search relative to where the binary is.

I don't really have a strong opinion either way -- the thing I'm mostly interested in is some sort of consistency between lldb & gdb. Have you already discussed this with the gdb folks? If they want to move to the binary-relative mechanism, then I don't see a problem with us doing the same. If they want to keep the existing behavior, then I think it would be good to preserve that in lldb as well (but I don't have a problem with searching in other places too; and `LocateExecutableSymbolFile` is one way to achieve that).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97786/new/

https://reviews.llvm.org/D97786



More information about the lldb-commits mailing list