[Lldb-commits] [lldb] r193663 - <rdar://problem/15045059>

Enrico Granata egranata at apple.com
Tue Oct 29 17:04:29 PDT 2013


Author: enrico
Date: Tue Oct 29 19:04:29 2013
New Revision: 193663

URL: http://llvm.org/viewvc/llvm-project?rev=193663&view=rev
Log:
<rdar://problem/15045059>

One of the things that dynamic typing affects is the count of children a type has
Clear out the flag that makes us blindly believe the children count when a dynamic type change is detected


Modified:
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py
    lldb/trunk/test/lang/cpp/dynamic-value/pass-to-base.cpp

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=193663&r1=193662&r2=193663&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Oct 29 19:04:29 2013
@@ -272,6 +272,7 @@ ValueObject::SetNeedsUpdate ()
 void
 ValueObject::ClearDynamicTypeInformation ()
 {
+    m_children_count_valid = false;
     m_did_calculate_complete_objc_class_type = false;
     m_last_format_mgr_revision = 0;
     m_override_type = ClangASTType();

Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py?rev=193663&r1=193662&r2=193663&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py (original)
+++ lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py Tue Oct 29 19:04:29 2013
@@ -40,6 +40,16 @@ class DynamicValueTestCase(TestBase):
         self.main_second_call_line = line_number('pass-to-base.cpp',
                                                        '// Break here and get real address of reallyA.')
 
+        self.main_third_call_line = line_number('pass-to-base.cpp',
+                                                       '// Break here and check b has 0 children')
+        self.main_fourth_call_line = line_number('pass-to-base.cpp',
+                                                       '// Break here and check b still has 0 children')
+        self.main_fifth_call_line = line_number('pass-to-base.cpp',
+                                                       '// Break here and check b has one child now')
+
+
+
+
     def examine_value_object_of_this_ptr (self, this_static, this_dynamic, dynamic_location):
 
         # Get "this" as its static value
@@ -119,6 +129,15 @@ class DynamicValueTestCase(TestBase):
         second_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_second_call_line)
         self.assertTrue(second_call_bpt,
                         VALID_BREAKPOINT)
+        third_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_third_call_line)
+        self.assertTrue(third_call_bpt,
+                        VALID_BREAKPOINT)
+        fourth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_fourth_call_line)
+        self.assertTrue(fourth_call_bpt,
+                        VALID_BREAKPOINT)
+        fifth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_fifth_call_line)
+        self.assertTrue(fifth_call_bpt,
+                        VALID_BREAKPOINT)
 
         # Now launch the process, and do not stop at the entry point.
         process = target.LaunchSimple (None, None, os.getcwd())
@@ -232,6 +251,14 @@ class DynamicValueTestCase(TestBase):
         self.assertTrue (anotherA_loc == reallyA_loc)
         self.assertTrue (anotherA_value.GetTypeName().find ('B') == -1)
 
+        self.runCmd("continue")
+        b = self.frame().FindVariable("b").GetDynamicValue(lldb.eDynamicCanRunTarget)
+        self.assertTrue(b.GetNumChildren() == 0, "b has 0 children")
+        self.runCmd("continue")
+        self.assertTrue(b.GetNumChildren() == 0, "b still has 0 children")
+        self.runCmd("continue")
+        self.assertTrue(b.GetNumChildren() == 1, "b now has 1 child")
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/trunk/test/lang/cpp/dynamic-value/pass-to-base.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/pass-to-base.cpp?rev=193663&r1=193662&r2=193663&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/dynamic-value/pass-to-base.cpp (original)
+++ lldb/trunk/test/lang/cpp/dynamic-value/pass-to-base.cpp Tue Oct 29 19:04:29 2013
@@ -52,6 +52,31 @@ private:
 
 static A* my_global_A_ptr;
 
+class BaseClass
+{
+public:
+    BaseClass();
+    virtual ~BaseClass() { }
+};
+
+class DerivedClass : public BaseClass
+{
+public:
+    DerivedClass();
+    virtual ~DerivedClass() { }
+protected:
+    int mem;
+};
+
+BaseClass::BaseClass()
+{
+}
+
+DerivedClass::DerivedClass() : BaseClass()
+{
+    mem = 101;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -65,5 +90,8 @@ main (int argc, char **argv)
   A reallyA (500);
   myB.doSomething (reallyA);  // Break here and get real address of reallyA.
 
+  BaseClass *b = nullptr; // Break here and check b has 0 children
+  b = new DerivedClass();  // Break here and check b still has 0 children
+  b = nullptr;  // Break here and check b has one child now
   return 0;
 }





More information about the lldb-commits mailing list