diff options
| author | Ted Woodward <ted.woodward@codeaurora.org> | 2017-08-31 19:22:33 +0000 |
|---|---|---|
| committer | Ted Woodward <ted.woodward@codeaurora.org> | 2017-08-31 19:22:33 +0000 |
| commit | 91635e0ceff86caf99c6dcf4f15ee7fc5e3191b8 (patch) | |
| tree | beb2f2358bf653f32f5ef3dd4d268e37b5abd3a1 | |
| parent | 082e9a7528f8f88f526c6b45cb2bdf5f94582125 (diff) | |
| download | bcm5719-llvm-91635e0ceff86caf99c6dcf4f15ee7fc5e3191b8.tar.gz bcm5719-llvm-91635e0ceff86caf99c6dcf4f15ee7fc5e3191b8.zip | |
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
llvm-svn: 312270
| -rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdVar.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdVar.cpp b/lldb/tools/lldb-mi/MICmdCmdVar.cpp index 66b392be6be..85f14ec29b9 100644 --- a/lldb/tools/lldb-mi/MICmdCmdVar.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdVar.cpp @@ -509,19 +509,19 @@ bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue, 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; |

