From d4ec5a70eadfb49f34530fe4de8737b4812f5edc Mon Sep 17 00:00:00 2001 From: Ilia K Date: Fri, 6 Mar 2015 22:35:08 +0000 Subject: [PATCH] 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 llvm-svn: 231526 --- lldb/include/lldb/API/SBValue.h | 1 + lldb/include/lldb/Core/ValueObject.h | 1 + .../python_api/value_var_update/TestValueVarUpdate.py | 9 +++++++++ lldb/test/python_api/value_var_update/main.c | 8 +++++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index 1dc5cc2981ce..0dd1bea87508 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -84,6 +84,7 @@ public: ValueType GetValueType (); + // It will be only valid starting from the second time. bool GetValueDidChange (); diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index eedce3d28d92..cf4032ad4341 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -649,6 +649,7 @@ public: bool GetValueIsValid () const; + // It will be only valid starting from the second time. bool GetValueDidChange (); diff --git a/lldb/test/python_api/value_var_update/TestValueVarUpdate.py b/lldb/test/python_api/value_var_update/TestValueVarUpdate.py index 793ea4f13e06..395982374d24 100644 --- a/lldb/test/python_api/value_var_update/TestValueVarUpdate.py +++ b/lldb/test/python_api/value_var_update/TestValueVarUpdate.py @@ -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 diff --git a/lldb/test/python_api/value_var_update/main.c b/lldb/test/python_api/value_var_update/main.c index 115bc10a372d..9ffca5cbb9f8 100644 --- a/lldb/test/python_api/value_var_update/main.c +++ b/lldb/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;