ted updated this revision to Diff 113317.
ted marked an inline comment as done.
ted added a comment.

Updated with Greg's suggestion.

Removed second call to GetValueDidChange() because it's handled at the top of 
the recursive call. This way we get 1 extra call to ExamineSBValueForChange() 
on a changed child, but avoid 2 calls to GetValueDidChange() for each child.


https://reviews.llvm.org/D37154

Files:
  tools/lldb-mi/MICmdCmdVar.cpp


Index: tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdVar.cpp
+++ tools/lldb-mi/MICmdCmdVar.cpp
@@ -509,19 +509,19 @@
     return MIstatus::success;
   }
 
-  lldb::SBType valueType = vrwValue.GetType();
-
   const MIuint nChildren = vrwValue.GetNumChildren();
   for (MIuint i = 0; i < nChildren; ++i) {
     lldb::SBValue member = vrwValue.GetChildAtIndex(i);
     if (!member.IsValid())
       continue;
 
-    if (member.GetValueDidChange()) {
-      vrwbChanged = true;
-      return MIstatus::success;
-    } else if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
-      // Handle composite types (i.e. struct or arrays)
+    // skip pointers and references to avoid infinite loop
+    if (member.GetType().GetTypeFlags() &
+        (lldb::eTypeIsPointer | lldb::eTypeIsReference))
+      continue;
+
+    // Handle composite types (i.e. struct or arrays)
+    if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
       return MIstatus::success;
   }
   vrwbChanged = false;


Index: tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdVar.cpp
+++ tools/lldb-mi/MICmdCmdVar.cpp
@@ -509,19 +509,19 @@
     return MIstatus::success;
   }
 
-  lldb::SBType valueType = vrwValue.GetType();
-
   const MIuint nChildren = vrwValue.GetNumChildren();
   for (MIuint i = 0; i < nChildren; ++i) {
     lldb::SBValue member = vrwValue.GetChildAtIndex(i);
     if (!member.IsValid())
       continue;
 
-    if (member.GetValueDidChange()) {
-      vrwbChanged = true;
-      return MIstatus::success;
-    } else if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
-      // Handle composite types (i.e. struct or arrays)
+    // skip pointers and references to avoid infinite loop
+    if (member.GetType().GetTypeFlags() &
+        (lldb::eTypeIsPointer | lldb::eTypeIsReference))
+      continue;
+
+    // Handle composite types (i.e. struct or arrays)
+    if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
       return MIstatus::success;
   }
   vrwbChanged = false;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to