[Lldb-commits] [PATCH] D37154: lldb-mi: -var-update can hang when traversing complex types with pointers

Ted Woodward via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 30 14:44:28 PDT 2017


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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37154.113317.patch
Type: text/x-patch
Size: 1086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170830/27ac7860/attachment.bin>


More information about the lldb-commits mailing list