10000 Fix race condition during iteration through modules (#139283) (#139862) by JDevlieghere · Pull Request #10906 · swiftlang/llvm-project · GitHub
[go: up one dir, main page]

Skip to content

Fix race condition during iteration through modules (#139283) (#139862) #10906

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? Si 10000 gn in to your account

Merged
Merged
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
10 changes: 6 additions & 4 deletions lldb/source/Target/Target.cpp
5199
Original file line number Diff line number Diff line change
Expand Up @@ -1451,16 +1451,18 @@ bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id,
}

ModuleSP Target::GetExecutableModule() {
// search for the first executable in the module list
for (size_t i = 0; i < m_images.GetSize(); ++i) {
ModuleSP module_sp = m_images.GetModuleAtIndex(i);
std::lock_guard<std::recursive_mutex> lock(m_images.GetMutex());

// Search for the first executable in the module list.
for (ModuleSP module_sp : m_images.ModulesNoLocking()) {
lldb_private::ObjectFile *obj = module_sp->GetObjectFile();
if (obj == nullptr)
continue;
if (obj->GetType() == ObjectFile::Type::eTypeExecutable)
return module_sp;
}
// as fall back return the first module loaded

// If there is none, fall back return the first module loaded.
return m_images.GetModuleAtIndex(0);
}

Expand Down
0