diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h @@ -12,6 +12,7 @@ #include "lldb/Target/Process.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/ScriptedMetadata.h" +#include "lldb/Utility/State.h" #include "lldb/Utility/Status.h" #include "ScriptedThread.h" @@ -93,6 +94,11 @@ void *GetImplementation() override; void ForceScriptedState(lldb::StateType state) override { + // If we're about to stop, we should fetch the loaded dynamic libraries + // dictionary before emitting the private stop event to avoid having the + // module loading happen while the process state is changing. + if (StateIsStoppedState(state, true)) + GetLoadedDynamicLibrariesInfos(); SetPrivateState(state); } diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -166,7 +166,6 @@ void ScriptedProcess::DidResume() { // Update the PID again, in case the user provided a placeholder pid at launch m_pid = GetInterface().GetProcessID(); - GetLoadedDynamicLibrariesInfos(); } Status ScriptedProcess::DoResume() {