2 Test that dynamic values update their child count correctly
5 from __future__ import print_function
12 import lldbsuite.test.lldbutil as lldbutil
13 from lldbsuite.test.lldbtest import *
15 class DynamicValueChildCountTestCase(TestBase):
17 mydir = TestBase.compute_mydir(__file__)
20 # Call super's setUp().
23 # Find the line number to break for main.c.
25 self.main_third_call_line = line_number('pass-to-base.cpp',
26 '// Break here and check b has 0 children')
27 self.main_fourth_call_line = line_number('pass-to-base.cpp',
28 '// Break here and check b still has 0 children')
29 self.main_fifth_call_line = line_number('pass-to-base.cpp',
30 '// Break here and check b has one child now')
31 self.main_sixth_call_line = line_number('pass-to-base.cpp',
32 '// Break here and check b has 0 children again')
34 @expectedFailureLinux("llvm.org/pr23039")
35 @expectedFailureFreeBSD("llvm.org/pr19311") # continue at a breakpoint does not work
36 @expectedFailureWindows("llvm.org/pr24663")
37 @expectedFailurei386("to be figured out")
38 @add_test_categories(['pyapi'])
39 def test_get_dynamic_vals(self):
40 """Test fetching C++ dynamic values from pointers & references."""
41 """Get argument vals for the call stack when stopped on a breakpoint."""
42 self.build(dictionary=self.getBuildFlags())
43 exe = os.path.join(os.getcwd(), "a.out")
45 # Create a target from the debugger.
47 target = self.dbg.CreateTarget (exe)
48 self.assertTrue(target, VALID_TARGET)
50 # Set up our breakpoints:
52 third_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_third_call_line)
53 self.assertTrue(third_call_bpt,
55 fourth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_fourth_call_line)
56 self.assertTrue(fourth_call_bpt,
58 fifth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_fifth_call_line)
59 self.assertTrue(fifth_call_bpt,
61 sixth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_sixth_call_line)
62 self.assertTrue(sixth_call_bpt,
65 # Now launch the process, and do not stop at the entry point.
66 process = target.LaunchSimple (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")
78 self.assertTrue(b.GetNumChildren() == 0, "b didn't go back to 0 children")