llvm-project/lldb/source/Plugins/DynamicLoader
Greg Clayton c338516463 Improve dynamic loader support in DynamicLoaderPOSIXDYLD when using core files.
Prior to this fix, no shared libraries would be loaded for a core file, even if they exist on the current machine. The issue was the DYLDRendezvous would read a DYLDRendezvous::Rendezvous from memory of the process in DYLDRendezvous::Resolve() which would read some ld.so structures as they existed in the middle of a process' lifetime. In core files we see, the DYLDRendezvous::Rendezvous::state would be set to eAdd for running processes. When ProcessELFCore.cpp would load the core file, it would call DynamicLoaderPOSIXDYLD::DidAttach(), which would call the above Rendezvous functions. The issue came when during the DidAttach function it call DYLDRendezvous::GetAction() which would return eNoAction if the DYLDRendezvous::m_current.state was read from memory as eAdd. This caused no shared libraries to be loaded for any ELF core files. We now detect if we have a core file and after reading the DYLDRendezvous::m_current.state from memory we set it to eConsistent, which causes DYLDRendezvous::GetAction() to return the correct action of eTakeSnapshot and shared libraries get loaded.

We also improve the DynamicLoaderPOSIXDYLD class to not try and set any breakpoints to catch shared library loads/unloads when we have a core file, which saves a bit of time.

Differential Revision: https://reviews.llvm.org/D134842
2022-10-13 17:40:23 -07:00
..
Darwin-Kernel PlatformDarwinKernel calls the ctor directly, not setting no-jit 2022-10-13 16:28:18 -07:00
Hexagon-DYLD Use llvm::is_contained (NFC) 2022-08-07 00:16:17 -07:00
MacOSX-DYLD Fix inconsistent target arch when attaching to arm64 binaries on 2022-09-01 16:39:35 -07:00
POSIX-DYLD Improve dynamic loader support in DynamicLoaderPOSIXDYLD when using core files. 2022-10-13 17:40:23 -07:00
Static Remove ConstString from DynamicLoader, JITLoader and Instruction plugin names 2021-10-25 10:32:35 +02:00
Windows-DYLD [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
wasm-DYLD [lldb] Avoid duplicate vdso modules when opening core files 2022-04-05 11:22:37 +02:00
CMakeLists.txt