This revision was automatically updated to reflect the committed changes.
Closed by commit rG98186def3f1f: [LLDB][Reliability] Fix accessing invalid 
iterator (authored by fixathon).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130312/new/

https://reviews.llvm.org/D130312

Files:
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp


Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -610,8 +610,10 @@
     // Also copy over the uuid from the old entry to the removed entry so we
     // can use it to lookup the module in the module list.
 
-    ImageInfo::collection::iterator pos, end = m_dyld_image_infos.end();
-    for (pos = m_dyld_image_infos.begin(); pos != end; pos++) {
+    bool found = false;
+
+    for (ImageInfo::collection::iterator pos = m_dyld_image_infos.begin();
+         pos != m_dyld_image_infos.end(); pos++) {
       if (image_infos[idx].address == (*pos).address) {
         image_infos[idx].uuid = (*pos).uuid;
 
@@ -635,11 +637,12 @@
         // Then remove it from the m_dyld_image_infos:
 
         m_dyld_image_infos.erase(pos);
+        found = true;
         break;
       }
     }
 
-    if (pos == end) {
+    if (!found) {
       if (log) {
         LLDB_LOGF(log, "Could not find image_info entry for unloading image:");
         image_infos[idx].PutToLog(log);


Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -610,8 +610,10 @@
     // Also copy over the uuid from the old entry to the removed entry so we
     // can use it to lookup the module in the module list.
 
-    ImageInfo::collection::iterator pos, end = m_dyld_image_infos.end();
-    for (pos = m_dyld_image_infos.begin(); pos != end; pos++) {
+    bool found = false;
+
+    for (ImageInfo::collection::iterator pos = m_dyld_image_infos.begin();
+         pos != m_dyld_image_infos.end(); pos++) {
       if (image_infos[idx].address == (*pos).address) {
         image_infos[idx].uuid = (*pos).uuid;
 
@@ -635,11 +637,12 @@
         // Then remove it from the m_dyld_image_infos:
 
         m_dyld_image_infos.erase(pos);
+        found = true;
         break;
       }
     }
 
-    if (pos == end) {
+    if (!found) {
       if (log) {
         LLDB_LOGF(log, "Could not find image_info entry for unloading image:");
         image_infos[idx].PutToLog(log);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to