Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / python_api / value_var_update / TestValueVarUpdate.py
blob5db116957e786bc6016fb7a9bbdbc11cab029a08
1 """Test SBValue::GetValueDidChange"""
4 import lldb
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)
15 d = {"EXE": exe}
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.
27 self.expect(
28 "thread list",
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
39 i.GetValueDidChange()
40 c.GetChildAtIndex(1).GetValueDidChange()
41 c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()
43 if self.TraceOn():
44 self.runCmd("frame variable")
46 self.runCmd("continue")
48 if self.TraceOn():
49 self.runCmd("frame variable")
51 self.assertNotEqual(
52 i_val, i.GetValueAsUnsigned(0), "GetValue() is saying a lie"
54 self.assertTrue(i.GetValueDidChange(), "GetValueDidChange() is saying a lie")
56 # Check complex type
57 self.assertTrue(
58 c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()
59 and not c.GetChildAtIndex(1).GetValueDidChange(),
60 "GetValueDidChange() is saying a lie",