From 4873e52733b25c12a17be42f6fc14f3457f770d7 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Thu, 11 Apr 2013 22:48:58 +0000 Subject: This patch fixes the issue that we were using the C stack as a measure of depth of ValueObject hierarchies, in the sense that we were assuming that recursive ValueObject operations would never be deeper than the stack allows. This assumption is easy to prove wrong, however. For instance, after ~10k runs through this loop: struct node { int value; node* child; node (int x) { value = x; child = nullptr; } }; int main () { node root(1); node* ptr = &root; int j = 2; while (1) { ptr->child = new node(j++); ptr = ptr->child; } return 0; } the deepmost child object will be deeper than the stack on most architectures, and we would be unable to display it This checkin fixes the issue by introducing a notion of root of ValueObject hierarchies. In a couple cases, we have to use an iterative algorithm instead of going to the root because we want to allow deeper customizations (e.g. formats, dynamic values). While the patch passes our test suite without regressions, it is a good idea to keep eyes open for any unexpected behavior (recursion can be subtle..) Also, I am hesitant to introduce a test case since failing at this will not just be marked as an "F", but most definitely crash LLDB. llvm-svn: 179330 --- lldb/source/Core/ValueObjectChild.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lldb/source/Core/ValueObjectChild.cpp') diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index 8aeb005512a..cf69ea5da68 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -229,5 +229,8 @@ ValueObjectChild::UpdateValue () bool ValueObjectChild::IsInScope () { - return m_parent->IsInScope (); + ValueObject* root(GetRoot()); + if (root) + return root->IsInScope (); + return false; } -- cgit v1.2.3