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

Ilia K ki.stfu at gmail.com
Fri Mar 6 14:33:21 PST 2015


Add the same comment to SBValue::GetValueDidChange


http://reviews.llvm.org/D8103

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

Index: include/lldb/API/SBValue.h
===================================================================
--- include/lldb/API/SBValue.h
+++ include/lldb/API/SBValue.h
@@ -84,6 +84,7 @@
     ValueType
     GetValueType ();
 
+    // It will be only valid starting from the second time.
     bool
     GetValueDidChange ();
 
Index: include/lldb/Core/ValueObject.h
===================================================================
--- include/lldb/Core/ValueObject.h
+++ include/lldb/Core/ValueObject.h
@@ -649,6 +649,7 @@
     bool
     GetValueIsValid () const;
 
+    // It will be only valid starting from the second time.
     bool
     GetValueDidChange ();
 
Index: test/python_api/value_var_update/TestValueVarUpdate.py
===================================================================
--- test/python_api/value_var_update/TestValueVarUpdate.py
+++ test/python_api/value_var_update/TestValueVarUpdate.py
@@ -52,6 +52,12 @@
 
         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 @@
         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
Index: test/python_api/value_var_update/main.c
===================================================================
--- test/python_api/value_var_update/main.c
+++ test/python_api/value_var_update/main.c
@@ -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;

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8103.21400.patch
Type: text/x-patch
Size: 2411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150306/c9c51cf5/attachment.bin>


More information about the lldb-commits mailing list