Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 1ce6b49

Browse files
author
Ted Woodward
committedAug 31, 2017
lldb-mi: -var-update can hang when traversing complex types with pointers
Summary: -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. Reviewers: ki.stfu, zturner, clayborg, abidh Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D37154 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@312270 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 77c3c57 commit 1ce6b49

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎tools/lldb-mi/MICmdCmdVar.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -509,19 +509,19 @@ bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue,
509509
return MIstatus::success;
510510
}
511511

512-
lldb::SBType valueType = vrwValue.GetType();
513-
514512
const MIuint nChildren = vrwValue.GetNumChildren();
515513
for (MIuint i = 0; i < nChildren; ++i) {
516514
lldb::SBValue member = vrwValue.GetChildAtIndex(i);
517515
if (!member.IsValid())
518516
continue;
519517

520-
if (member.GetValueDidChange()) {
521-
vrwbChanged = true;
522-
return MIstatus::success;
523-
} else if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
524-
// Handle composite types (i.e. struct or arrays)
518+
// skip pointers and references to avoid infinite loop
519+
if (member.GetType().GetTypeFlags() &
520+
(lldb::eTypeIsPointer | lldb::eTypeIsReference))
521+
continue;
522+
523+
// Handle composite types (i.e. struct or arrays)
524+
if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
525525
return MIstatus::success;
526526
}
527527
vrwbChanged = false;

0 commit comments

Comments
 (0)