[Lldb-commits] [lldb] [lldb] Use correct path for lldb-server executable (PR #131519)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 18 03:54:32 PDT 2025


https://github.com/labath commented:

> Ah, turns out there's a HostInfo::GetProgramFileSpec() function which solves both these issues.

I am aware of that function. The reason I did not suggest it is because `GetProgramFileSpec` (on linux) returns the canonical path (with all symlinks resolved). That's something I am generally trying to avoid because it can break some instalation types -- where the installation consists of a symlink farm and the expected installation layout is given by the symlink tree. (It can also fix some installations which expect exactly the opposite -- the debian use case in one of them).

It's very hard to come up with a solution which makes everyone happy, which is why e.g. gcc/clang have a flag (`-no-canonical-prefixes`) to control this kind of behavior. I'm not thrilled by the idea of adding that to lldb, nor I think it would be practical for an interactive tool.

Whatever we do, I think it is better to resolve the symlink as late as possible as that gives us more options down the line. What I don't understand is why doesn't this work for your use case already -- `GetModuleFileSpecForHostAddress` calls `FileSystem::Resolve`, which should give you the canonical path for the library. Does that fail for some reason? It is it because the (relative) path returned by `GetModuleFileSpecForHostAddress` is resolved relative to CWD (but in reality we've executed it by finding the executable on the path)?

https://github.com/llvm/llvm-project/pull/131519


More information about the lldb-commits mailing list