diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index e25c4ff55e408..8bf01aa168342 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -871,7 +871,6 @@ void DynamicLoaderDarwin::PrivateInitialize(Process *process) { StateAsCString(m_process->GetState())); Clear(true); m_process = process; - m_process->GetTarget().ClearAllLoadedSections(); } // Member function that gets called when the process state changes. diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 13ff12b4ff953..7c5512598bbb6 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2763,6 +2763,7 @@ Status Process::LaunchPrivate(ProcessLaunchInfo &launch_info, StateType &state, } if (state == eStateStopped || state == eStateCrashed) { + GetTarget().ClearAllLoadedSections(); DidLaunch(); // Now that we know the process type, update its signal responses from the @@ -2799,6 +2800,7 @@ Status Process::LaunchPrivate(ProcessLaunchInfo &launch_info, StateType &state, } Status Process::LoadCore() { + GetTarget().ClearAllLoadedSections(); Status error = DoLoadCore(); if (error.Success()) { ListenerSP listener_sp( @@ -3094,6 +3096,8 @@ void Process::CompleteAttach() { Log *log(GetLog(LLDBLog::Process | LLDBLog::Target)); LLDB_LOGF(log, "Process::%s()", __FUNCTION__); + GetTarget().ClearAllLoadedSections(); + // Let the process subclass figure out at much as it can about the process // before we go looking for a dynamic loader plug-in. ArchSpec process_arch; diff --git a/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py b/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py index cd95a9ff3fe8c..faa35421ff60b 100644 --- a/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py +++ b/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py @@ -282,7 +282,6 @@ def test_from_forward_decl(self): @no_debug_info_test @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663") - @expectedFailureDarwin # dynamic loader unloads modules @expectedFailureAll(archs=["arm"]) # Minidump saving not implemented def test_from_core_file(self): """Test fetching C++ dynamic values from core files. Specifically, test