2 Test diamond inheritance.
6 from lldbsuite
.test
.lldbtest
import *
7 from lldbsuite
.test
.decorators
import *
8 import lldbsuite
.test
.lldbutil
as lldbutil
11 class TestCase(TestBase
):
13 def test_with_sbvalue(self
):
15 Test that virtual base classes work in when SBValue objects are
16 used to explore the class.
19 lldbutil
.run_to_source_breakpoint(
20 self
, "// breakpoint 1", lldb
.SBFileSpec("main.cpp")
23 self
.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
25 j1
= self
.frame().FindVariable("j1")
26 j1_Derived1
= j1
.GetChildAtIndex(0)
27 j1_Derived2
= j1
.GetChildAtIndex(1)
28 j1_Derived1_VBase
= j1_Derived1
.GetChildAtIndex(0)
29 j1_Derived2_VBase
= j1_Derived2
.GetChildAtIndex(0)
30 j1_Derived1_VBase_m_value
= j1_Derived1_VBase
.GetChildAtIndex(0)
31 j1_Derived2_VBase_m_value
= j1_Derived2_VBase
.GetChildAtIndex(0)
34 j1_Derived1_VBase
.GetLoadAddress(),
35 j1_Derived2_VBase
.GetLoadAddress(),
36 "ensure virtual base class is the same between Derived1 and Derived2",
39 j1_Derived1_VBase_m_value
.GetValueAsUnsigned(1),
40 j1_Derived2_VBase_m_value
.GetValueAsUnsigned(2),
41 "ensure m_value in VBase is the same",
48 .GetValueAsUnsigned(0),
50 "ensure Derived2 from j1 is correct",
53 # This reassigns 'd' to point to 'j2'.
54 self
.thread().StepOver()
61 .GetValueAsUnsigned(0),
63 "ensure Derived2 from j2 is correct",
69 lldbutil
.run_to_source_breakpoint(
70 self
, "// breakpoint 1", lldb
.SBFileSpec("main.cpp")
73 # All the children of j1.
81 ValueCheck(type="int", name
="m_value", value
="12345")
92 ValueCheck(type="int", name
="m_value", value
="12345")
97 ValueCheck(type="long", value
="1"),
99 # Try using the class with expression evaluator/variable paths.
100 self
.expect_expr("j1", result_type
="Joiner1", result_children
=children
)
101 self
.expect_var_path("j1", type="Joiner1", children
=children
)
103 # Use the expression evaluator to access the members.
104 self
.expect_expr("j1.x", result_type
="long", result_value
="1")
105 self
.expect_expr("j1.m_value", result_type
="int", result_value
="12345")
107 # Use variable paths to access the members.
108 self
.expect_var_path("j1.x", type="long", value
="1")
114 lldbutil
.run_to_source_breakpoint(
115 self
, "// breakpoint 1", lldb
.SBFileSpec("main.cpp")
117 # FIXME: This is completely broken and 'succeeds' with an error that
118 # there is noch such value/member in Joiner1. Move this up to the test
120 self
.expect_var_path("j1.m_value", type="int", value
="12345")