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

Yuval Deutscher via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 20 04:11:36 PDT 2025


yuvald-sweet-security wrote:

> Kind of yes, but the two issues are related. The issue with symlinks is that once you resolve them, there's no way to go back. I'm asking why (in the scenario you describe in that PR) does `GetModuleFileSpecForHostAddress` return "lldb-server-19" (instead of "/usr/bin/lldb-server-19" or "/usr/lib/llvm-19/bin/lldb-server")

So, regarding that issue - first of all, `GetModuleFileSpecForHostAddress` doesn't follow symlinks. I'm not sure if that's a bug or intended behavior but I don't see anything in `FileSystem::Resolve` that attempts to follow symlinks - it just makes a relative or `~`-path absolute.

Now, what you said about resolving relative to cwd instead of relative to $PATH also happens there, but that's actually the reason the entire thing works in the first place - the fact that this resolves relative to cwd causes `ComputePathRelativeToLibrary` to fail and then `ComputeSupportExeDirectory` falls back to using `GetProgramFileSpec`. So, this bug masks the first bug. 

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


More information about the lldb-commits mailing list