llvm-project/lldb/tools/lldb-server
Pavel Labath 004a264f8c [lldb] Fix shared library directory computation on windows
Our code for locating the shared library directory works via dladdr (or
the windows equivalent) to locate the path of an address known to reside
in liblldb. This works great for C++ programs, but there's a catch.

When (lib)lldb is used from python (like in our test suite), this dladdr
call will return a path to the _lldb.so (or such) file in the python
directory. To compensate for this, we have code which attempts to
resolve this symlink, to ensure we get the canonical location. However,
here's the second catch.

On windows, this file is not a symlink (but a copy), so this logic
fails. Since most of our other paths are derived from the liblldb
location, all of these paths will be wrong, when running the test suite.
One effect of this was the failure to find lldb-server in D96202.

To fix this issue, I add some windows-specific code to locate the
liblldb directory. Since it cannot rely on symlinks, it works by
manually walking the directory tree -- essentially doing the opposite of
what we do when computing the python directory.

To avoid python leaking back into the host code, I implement this with
the help of a callback which can be passed to HostInfo::Initialize in
order to assist with the directory location. The callback lives inside
the python plugin.

I also strenghten the existing path test to ensure the returned path is
the right one.

Differential Revision: https://reviews.llvm.org/D96779
2021-02-18 15:37:52 +01:00
..
Darwin/resources Update com.apple.diagnosticd.diagnostic entitlement 2019-03-01 03:34:51 +00:00
Acceptor.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
Acceptor.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
CMakeLists.txt [lldb] Rename FreeBSDRemote to FreeBSD (NFC) 2021-02-15 13:04:11 +01:00
LLDBServerUtilities.cpp Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
LLDBServerUtilities.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
LLGSOptions.td [lldb] Port lldb gdb-server to libOption 2020-10-21 16:16:18 +02:00
SystemInitializerLLGS.cpp lldb-server: LLGS: support 32-bit on 64-bit hosts 2019-05-21 01:25:48 +00:00
SystemInitializerLLGS.h [lldb] Fix shared library directory computation on windows 2021-02-18 15:37:52 +01:00
lldb-gdbserver.cpp [lldb] Rename FreeBSDRemote to FreeBSD (NFC) 2021-02-15 13:04:11 +01:00
lldb-platform.cpp [lldb] Use llvm::Optional for port in LaunchGDBServer 2020-11-30 11:20:39 +00:00
lldb-server.cpp [Signal] Allow llvm clients to opt into one-shot SIGPIPE handling 2019-11-18 10:27:27 -08:00
lldb-server.exports