1 """Test SBValue::GetValueDidChange"""
5 from lldbsuite
.test
.decorators
import *
6 from lldbsuite
.test
.lldbtest
import *
7 from lldbsuite
.test
import lldbutil
10 class ValueVarUpdateTestCase(TestBase
):
11 def test_with_process_launch_api(self
):
12 """Test SBValue::GetValueDidChange"""
13 # Get the full path to our executable to be attached/debugged.
14 exe
= self
.getBuildArtifact(self
.testMethodName
)
16 self
.build(dictionary
=d
)
17 self
.setTearDownCleanup(dictionary
=d
)
18 target
= self
.dbg
.CreateTarget(exe
)
20 breakpoint
= target
.BreakpointCreateBySourceRegex(
21 "break here", lldb
.SBFileSpec("main.c")
24 self
.runCmd("run", RUN_SUCCEEDED
)
26 # The stop reason of the thread should be breakpoint.
29 STOPPED_DUE_TO_BREAKPOINT
,
30 substrs
=["stopped", "stop reason = breakpoint"],
33 i
= self
.frame().FindVariable("i")
34 i_val
= i
.GetValueAsUnsigned(0)
35 c
= self
.frame().FindVariable("c")
37 # Update any values from the SBValue objects so we can ask them if they
38 # changed after a continue
40 c
.GetChildAtIndex(1).GetValueDidChange()
41 c
.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()
44 self
.runCmd("frame variable")
46 self
.runCmd("continue")
49 self
.runCmd("frame variable")
52 i_val
, i
.GetValueAsUnsigned(0), "GetValue() is saying a lie"
54 self
.assertTrue(i
.GetValueDidChange(), "GetValueDidChange() is saying a lie")
58 c
.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()
59 and not c
.GetChildAtIndex(1).GetValueDidChange(),
60 "GetValueDidChange() is saying a lie",