2 Test that dynamic values update their child count correctly
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class DynamicValueChildCountTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
18 # Call super's setUp().
21 # Find the line number to break for main.c.
23 self.main_third_call_line = line_number(
24 'pass-to-base.cpp', '// Break here and check b has 0 children')
25 self.main_fourth_call_line = line_number(
26 'pass-to-base.cpp', '// Break here and check b still has 0 children')
27 self.main_fifth_call_line = line_number(
28 'pass-to-base.cpp', '// Break here and check b has one child now')
29 self.main_sixth_call_line = line_number(
30 'pass-to-base.cpp', '// Break here and check b has 0 children again')
32 @add_test_categories(['pyapi'])
33 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663")
34 def test_get_dynamic_vals(self):
35 """Test fetching C++ dynamic values from pointers & references."""
36 """Get argument vals for the call stack when stopped on a breakpoint."""
37 self.build(dictionary=self.getBuildFlags())
38 exe = self.getBuildArtifact("a.out")
40 # Create a target from the debugger.
42 target = self.dbg.CreateTarget(exe)
43 self.assertTrue(target, VALID_TARGET)
45 # Set up our breakpoints:
47 third_call_bpt = target.BreakpointCreateByLocation(
48 'pass-to-base.cpp', self.main_third_call_line)
49 self.assertTrue(third_call_bpt,
51 fourth_call_bpt = target.BreakpointCreateByLocation(
52 'pass-to-base.cpp', self.main_fourth_call_line)
53 self.assertTrue(fourth_call_bpt,
55 fifth_call_bpt = target.BreakpointCreateByLocation(
56 'pass-to-base.cpp', self.main_fifth_call_line)
57 self.assertTrue(fifth_call_bpt,
59 sixth_call_bpt = target.BreakpointCreateByLocation(
60 'pass-to-base.cpp', self.main_sixth_call_line)
61 self.assertTrue(sixth_call_bpt,
64 # Now launch the process, and do not stop at the entry point.
65 process = target.LaunchSimple(
66 None, None, self.get_process_working_directory())
68 self.assertTrue(process.GetState() == lldb.eStateStopped,
71 b = self.frame().FindVariable("b").GetDynamicValue(lldb.eDynamicCanRunTarget)
72 self.assertTrue(b.GetNumChildren() == 0, "b has 0 children")
73 self.runCmd("continue")
74 self.assertTrue(b.GetNumChildren() == 0, "b still has 0 children")
75 self.runCmd("continue")
76 self.assertTrue(b.GetNumChildren() != 0, "b now has 1 child")
77 self.runCmd("continue")
79 b.GetNumChildren() == 0,
80 "b didn't go back to 0 children")