Author: enrico Date: Thu Jul 23 19:57:19 2015 New Revision: 243077 URL: http://llvm.org/viewvc/llvm-project?rev=243077&view=rev Log: Fix an issue where LLDB would run out of stack space trying to decide if a deeply nested child can be updated in the face of an invalid execution context
The issue is that a child can't really ask the root object, since this decision could actually hinge on whether a dynamic and/or synthetic value is present To do this, make values vote lazily for whether they are willing to allow this, so that we can navigate up the chain without recursively invoking ourselves Tentative fix for rdar://21949558 Modified: lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/include/lldb/Core/ValueObjectChild.h lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h lldb/trunk/source/Core/ValueObjectChild.cpp Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=243077&r1=243076&r2=243077&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Jul 23 19:57:19 2015 @@ -861,7 +861,7 @@ public: bool NeedsUpdating () { - const bool accept_invalid_exe_ctx = CanUpdateWithInvalidExecutionContext(); + const bool accept_invalid_exe_ctx = (CanUpdateWithInvalidExecutionContext() == eLazyBoolYes); return m_update_point.NeedsUpdating(accept_invalid_exe_ctx); } @@ -1172,10 +1172,10 @@ protected: virtual bool UpdateValue () = 0; - virtual bool + virtual LazyBool CanUpdateWithInvalidExecutionContext () { - return false; + return eLazyBoolCalculate; } virtual void Modified: lldb/trunk/include/lldb/Core/ValueObjectChild.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectChild.h?rev=243077&r1=243076&r2=243077&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObjectChild.h (original) +++ lldb/trunk/include/lldb/Core/ValueObjectChild.h Thu Jul 23 19:57:19 2015 @@ -84,7 +84,7 @@ protected: virtual bool UpdateValue (); - virtual bool + virtual LazyBool CanUpdateWithInvalidExecutionContext (); virtual ClangASTType Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=243077&r1=243076&r2=243077&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original) +++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Thu Jul 23 19:57:19 2015 @@ -109,10 +109,10 @@ protected: virtual bool UpdateValue (); - virtual bool + virtual LazyBool CanUpdateWithInvalidExecutionContext () { - return true; + return eLazyBoolYes; } virtual lldb::DynamicValueType Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=243077&r1=243076&r2=243077&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original) +++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Thu Jul 23 19:57:19 2015 @@ -156,10 +156,10 @@ protected: virtual bool UpdateValue (); - virtual bool + virtual LazyBool CanUpdateWithInvalidExecutionContext () { - return true; + return eLazyBoolYes; } virtual ClangASTType Modified: lldb/trunk/source/Core/ValueObjectChild.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=243077&r1=243076&r2=243077&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp (original) +++ lldb/trunk/source/Core/ValueObjectChild.cpp Thu Jul 23 19:57:19 2015 @@ -109,12 +109,14 @@ ValueObjectChild::GetDisplayTypeName() return display_name; } -bool +LazyBool ValueObjectChild::CanUpdateWithInvalidExecutionContext () { - if (m_parent) - return m_parent->CanUpdateWithInvalidExecutionContext(); - return this->ValueObject::CanUpdateWithInvalidExecutionContext(); + ValueObject* opinionated_ancestor = FollowParentChain([] (ValueObject* vo) -> bool { + return (vo->CanUpdateWithInvalidExecutionContext() == eLazyBoolCalculate); + }); + + return opinionated_ancestor ? opinionated_ancestor->CanUpdateWithInvalidExecutionContext() : this->ValueObject::CanUpdateWithInvalidExecutionContext(); } bool _______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits