diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h @@ -267,6 +267,8 @@ bool FindMetadata(const char *name, PThreadField field, uint32_t &value); + bool IsCoreFile() const; + enum RendezvousAction { eNoAction, eTakeSnapshot, diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -171,6 +171,15 @@ if (!(cursor = ReadPointer(cursor + padding, &info.ldbase))) return false; + // If we have a core file, we will read the current rendezvous state + // from the core file's memory which will indicate there is nothing + // to do, but we need it to load all of the shared libraries. If we + // don't change this, then "info.state" will be set to eAdd and the + // m_previous.state will be eConsistent and GetAction() will return + // eNoAction when we need it to return eTakeSnapshot. + if (IsCoreFile()) + info.state = eConsistent; + // The rendezvous was successfully read. Update our internal state. m_rendezvous_addr = info_addr; m_previous = m_current; @@ -664,3 +673,7 @@ LLDB_LOGF(log, " Prev : %" PRIx64, I->prev); } } + +bool DYLDRendezvous::IsCoreFile() const { + return !m_process->IsLiveDebugSession(); +} diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -91,6 +91,9 @@ std::map> m_loaded_modules; + /// Returns true if the process is for a core file. + bool IsCoreFile() const; + /// If possible sets a breakpoint on a function called by the runtime /// linker each time a module is loaded or unloaded. bool SetRendezvousBreakpoint(); diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -213,6 +213,10 @@ void DynamicLoaderPOSIXDYLD::ProbeEntry() { Log *log = GetLog(LLDBLog::DynamicLoader); + // If we have a core file, we don't need any breakpoints. + if (IsCoreFile()) + return; + const addr_t entry = GetEntryPoint(); if (entry == LLDB_INVALID_ADDRESS) { LLDB_LOGF( @@ -297,6 +301,11 @@ bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() { Log *log = GetLog(LLDBLog::DynamicLoader); + + // If we have a core file, we don't need any breakpoints. + if (IsCoreFile()) + return false; + if (m_dyld_bid != LLDB_INVALID_BREAK_ID) { LLDB_LOG(log, "Rendezvous breakpoint breakpoint id {0} for pid {1}" @@ -829,3 +838,7 @@ return module_sp->GetFileSpec().GetPath() == "[vdso]"; } + +bool DynamicLoaderPOSIXDYLD::IsCoreFile() const { + return !m_process->IsLiveDebugSession(); +}