Skip to content

Commit 9d6d280

Browse files
committed
[lldb] Call Target::ClearAllLoadedSections even earlier
This reapplies llvm#138892, which was reverted in 5fb9dca due to failures on windows. Windows loads modules from the Process class, and it does that quite early, and it kinda makes sense which is why I'm moving the clearing code even earlier.
1 parent 438daf6 commit 9d6d280

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lldb/source/Target/Process.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,7 @@ Status Process::LaunchPrivate(ProcessLaunchInfo &launch_info, StateType &state,
26752675
m_jit_loaders_up.reset();
26762676
m_system_runtime_up.reset();
26772677
m_os_up.reset();
2678+
GetTarget().ClearAllLoadedSections();
26782679

26792680
{
26802681
std::lock_guard<std::mutex> guard(m_process_input_reader_mutex);
@@ -2763,7 +2764,6 @@ Status Process::LaunchPrivate(ProcessLaunchInfo &launch_info, StateType &state,
27632764
}
27642765

27652766
if (state == eStateStopped || state == eStateCrashed) {
2766-
GetTarget().ClearAllLoadedSections();
27672767
DidLaunch();
27682768

27692769
// Now that we know the process type, update its signal responses from the
@@ -2986,6 +2986,7 @@ Status Process::Attach(ProcessAttachInfo &attach_info) {
29862986
m_jit_loaders_up.reset();
29872987
m_system_runtime_up.reset();
29882988
m_os_up.reset();
2989+
GetTarget().ClearAllLoadedSections();
29892990

29902991
lldb::pid_t attach_pid = attach_info.GetProcessID();
29912992
Status error;
@@ -3096,8 +3097,6 @@ void Process::CompleteAttach() {
30963097
Log *log(GetLog(LLDBLog::Process | LLDBLog::Target));
30973098
LLDB_LOGF(log, "Process::%s()", __FUNCTION__);
30983099

3099-
GetTarget().ClearAllLoadedSections();
3100-
31013100
// Let the process subclass figure out at much as it can about the process
31023101
// before we go looking for a dynamic loader plug-in.
31033102
ArchSpec process_arch;

0 commit comments

Comments
 (0)