[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
Fri Aug 25 10:58:57 PDT 2017


ted created this revision.

-var-update calls CMICmdCmdVarUpdate::ExamineSBValueForChange to check if a varObj has been updated. It checks that the varObj is updated, then recurses on all of its children. If a child is a pointer pointing back to a parent node, this will result in an infinite loop, and lldb-mi hanging.

The problem is exposed by packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py, but this test is skipped everywhere.

This patch changes ExamineSBValueForChange to not traverse children of varObjs that are pointers.


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
@@ -516,6 +516,13 @@
     lldb::SBValue member = vrwValue.GetChildAtIndex(i);
     if (!member.IsValid())
       continue;
+    if (member.TypeIsPointerType()) {
+      if (member.GetValueDidChange()) {
+        vrwbChanged = true;
+        return MIstatus::success;
+      }
+      continue;
+    }
 
     if (member.GetValueDidChange()) {
       vrwbChanged = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37154.112717.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170825/78c37e3e/attachment.bin>


More information about the lldb-commits mailing list