[Lldb-commits] [lldb] r231526 - Improve ValueObject::GetValueDidChange test; Add a comment for it

Ilia K ki.stfu at gmail.com
Fri Mar 6 14:35:08 PST 2015


Author: ki.stfu
Date: Fri Mar  6 16:35:08 2015
New Revision: 231526

URL: http://llvm.org/viewvc/llvm-project?rev=231526&view=rev
Log:
Improve ValueObject::GetValueDidChange test; Add a comment for it

Summary: This patch adds a few comments for GetValueDidChange and contains improvements for TestValueVarUpdate.py test which checks ValueObject::GetValueDidChange for complex types.

Reviewers: zturner, granata.enrico, clayborg

Reviewed By: clayborg

Subscribers: jingham, lldb-commits, granata.enrico, zturner, clayborg

Differential Revision: http://reviews.llvm.org/D8103

Modified:
    lldb/trunk/include/lldb/API/SBValue.h
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py
    lldb/trunk/test/python_api/value_var_update/main.c

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=231526&r1=231525&r2=231526&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Fri Mar  6 16:35:08 2015
@@ -84,6 +84,7 @@ public:
     ValueType
     GetValueType ();
 
+    // It will be only valid starting from the second time.
     bool
     GetValueDidChange ();
 

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=231526&r1=231525&r2=231526&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Fri Mar  6 16:35:08 2015
@@ -649,6 +649,7 @@ public:
     bool
     GetValueIsValid () const;
 
+    // It will be only valid starting from the second time.
     bool
     GetValueDidChange ();
 

Modified: lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py?rev=231526&r1=231525&r2=231526&view=diff
==============================================================================
--- lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py (original)
+++ lldb/trunk/test/python_api/value_var_update/TestValueVarUpdate.py Fri Mar  6 16:35:08 2015
@@ -52,6 +52,12 @@ class HelloWorldTestCase(TestBase):
 
         i = self.frame().FindVariable("i")
         i_val = i.GetValueAsUnsigned(0)
+        c = self.frame().FindVariable("c")
+
+        # Update any values from the SBValue objects so we can ask them if they changed after a continue
+        i.GetValueDidChange()
+        c.GetChildAtIndex(1).GetValueDidChange()
+        c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()
         
         if self.TraceOn(): self.runCmd("frame variable")
         
@@ -62,6 +68,9 @@ class HelloWorldTestCase(TestBase):
         self.assertTrue(i_val != i.GetValueAsUnsigned(0), "GetValue() is saying a lie")
         self.assertTrue(i.GetValueDidChange(), "GetValueDidChange() is saying a lie")
 
+        # Check complex type
+        self.assertTrue(c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange() and
+                        not c.GetChildAtIndex(1).GetValueDidChange(), "GetValueDidChange() is saying a lie")
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/python_api/value_var_update/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value_var_update/main.c?rev=231526&r1=231525&r2=231526&view=diff
==============================================================================
--- lldb/trunk/test/python_api/value_var_update/main.c (original)
+++ lldb/trunk/test/python_api/value_var_update/main.c Fri Mar  6 16:35:08 2015
@@ -1,8 +1,14 @@
+struct complex_type {
+    struct { long l; } inner;
+    struct complex_type *complex_ptr;
+};
+
 int main() {
     int i = 0;
+    struct complex_type c = { { 1L }, &c };
     for (int j = 3; j < 20; j++)
     {
-        i += j;
+        c.inner.l += (i += j);
         i = i - 1; // break here
     }
     return i;





More information about the lldb-commits mailing list