Skip to content

[lldb] Call Target::ClearAllLoadedSections earlier #138892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Target/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading