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

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 30 14:59:26 PDT 2017


clayborg added inline comments.


================
Comment at: tools/lldb-mi/MICmdCmdVar.cpp:522
+      continue;
+
+    // Handle composite types (i.e. struct or arrays)
----------------
Or even cleaner:

```
bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue,
                                                 bool &vrwbChanged) {
  vrwbChanged = vrwValue.GetValueDidChange();
  if (vrwbChanged)
    return MIstatus::success;

  // Skip children of pointers and references to avoid infinite loop
  if (vrwValue.GetType().GetTypeFlags() & 
      (lldb::eTypeIsPointer | lldb::eTypeIsReference)) {
    return MIstatus::success;
  }

  const MIuint nChildren = vrwValue.GetNumChildren();
  for (MIuint i = 0; i < nChildren && !vrwbChanged; ++i) {
    ExamineSBValueForChange(vrwValue.GetChildAtIndex(i), vrwbChanged);
  }
  return MIstatus::success;
}```


https://reviews.llvm.org/D37154





More information about the lldb-commits mailing list