11
11
mydir = os.path.join("lang", "c", "anonymous")
14
def test_expr_with_dsym(self):
18
@skipIfGcc # llvm.org/pr15036: LLDB is unable to parse DWARF generated by GCC
14
def test_expr_nest_with_dsym(self):
19
def test_expr_child_with_dsym(self):
24
def test_expr_grandchild_with_dsym(self):
26
self.expr_grandchild()
29
def test_expr_parent(self):
33
@unittest2.expectedFailure # llvm.org/pr15591
35
def test_expr_null(self):
39
@skipIfGcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by GCC
19
40
@skipIfIcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC
21
def test_expr_with_dwarf(self):
42
def test_expr_nest_with_dwarf(self):
47
def test_expr_child_with_dwarf(self):
48
self.skipTest("Skipped because LLDB asserts due to an incorrect AST layout for an anonymous struct: see llvm.org/pr15036")
52
@skipIfGcc # llvm.org/pr15036: This particular regression was introduced by r181498
53
@skipIfIcc # llvm.org/pr15036: This particular regression was introduced by r181498
55
def test_expr_grandchild_with_dwarf(self):
57
self.expr_grandchild()
60
def test_expr_parent(self):
64
@unittest2.expectedFailure # llvm.org/pr15591
66
def test_expr_null(self):
26
71
# Call super's setUp().
27
72
TestBase.setUp(self)
28
# Find the line number to break inside main().
29
self.line = line_number('main.c', '// Set breakpoint 0 here.')
73
# Find the line numbers to break in main.c.
74
self.line0 = line_number('main.c', '// Set breakpoint 0 here.')
75
self.line1 = line_number('main.c', '// Set breakpoint 1 here.')
76
self.line2 = line_number('main.c', '// Set breakpoint 2 here.')
31
def common_setup(self):
78
def common_setup(self, line):
32
79
exe = os.path.join(os.getcwd(), "a.out")
33
80
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
35
# Break inside the foo function which takes a bar_ptr argument.
36
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
82
# Set breakpoints inside and outside methods that take pointers to the containing struct.
83
lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
38
85
self.runCmd("run", RUN_SUCCEEDED)
46
93
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
47
94
substrs = [' resolved, hit count = 1'])
52
# This should display correctly.
97
self.common_setup(self.line0)
99
# These should display correctly.
100
self.expect("expression n->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
103
self.expect("expression n->b", VARIABLES_DISPLAYED_CORRECTLY,
106
def expr_child(self):
107
self.common_setup(self.line1)
109
# These should display correctly.
53
110
self.expect("expression c->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
54
111
substrs = ["= 4"])
56
self.expect("expression c->b", VARIABLES_DISPLAYED_CORRECTLY,
113
self.expect("expression c->grandchild.b", VARIABLES_DISPLAYED_CORRECTLY,
116
def expr_grandchild(self):
117
self.common_setup(self.line2)
119
# These should display correctly.
120
self.expect("expression g.child.foo.d", VARIABLES_DISPLAYED_CORRECTLY,
123
self.expect("expression g.child.b", VARIABLES_DISPLAYED_CORRECTLY,
126
def expr_parent(self):
127
self.common_setup(self.line2)
129
# These should display correctly.
130
self.expect("expression pz", VARIABLES_DISPLAYED_CORRECTLY,
131
substrs = ["(type_z *) $0 = 0x0000"])
133
self.expect("expression z.y", VARIABLES_DISPLAYED_CORRECTLY,
134
substrs = ["(type_y) $1 = {"])
136
self.expect("expression z", VARIABLES_DISPLAYED_CORRECTLY,
137
substrs = ["dummy = 2"])
140
self.common_setup(self.line2)
142
# This should fail because pz is 0, but it succeeds on OS/X.
143
# This fails on Linux with an upstream error "Couldn't dematerialize struct", as does "p *n" with "int *n = 0".
144
# Note that this can also trigger llvm.org/pr15036 when run interactively at the lldb command prompt.
145
self.expect("expression *(type_z *)pz",
146
substrs = ["Cannot access memory at address 0x0"], error = True)
59
149
if __name__ == '__main__':