https://github.com/nd updated https://github.com/llvm/llvm-project/pull/139862

>From f6b1c03607582e580f0b3167c0e337c35c31cbeb Mon Sep 17 00:00:00 2001
From: "Dmitry.Neverov" <dmitry.neve...@jetbrains.com>
Date: Wed, 14 May 2025 11:09:07 +0200
Subject: [PATCH] [lldb] Fix race condition during iteration through modules
 (#139283)

Use of ModuleIterable ensures modules don't change during iteration.
---
 lldb/source/Target/Target.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 7f61f8689fb95..9660fc97970b0 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1511,8 +1511,7 @@ 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);
+  for (ModuleSP module_sp : m_images.Modules()) {
     lldb_private::ObjectFile *obj = module_sp->GetObjectFile();
     if (obj == nullptr)
       continue;

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to