[all-commits] [llvm/llvm-project] c33851: Improve dynamic loader support in DynamicLoaderPOS...
Greg Clayton via All-commits
all-commits at lists.llvm.org
Thu Oct 13 17:40:44 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c338516463ff9bb7183c8322847f2eddf6febec9
https://github.com/llvm/llvm-project/commit/c338516463ff9bb7183c8322847f2eddf6febec9
Author: Greg Clayton <gclayton at fb.com>
Date: 2022-10-13 (Thu, 13 Oct 2022)
Changed paths:
M lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
M lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
M lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
M lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
Log Message:
-----------
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
More information about the All-commits
mailing list