]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/struct-in-struct.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / src / test / debuginfo / struct-in-struct.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6
7 // gdb-command:run
8
9 // gdb-command:print three_simple_structs
10 // gdbg-check:$1 = {x = {x = 1}, y = {x = 2}, z = {x = 3}}
11 // gdbr-check:$1 = struct_in_struct::ThreeSimpleStructs {x: struct_in_struct::Simple {x: 1}, y: struct_in_struct::Simple {x: 2}, z: struct_in_struct::Simple {x: 3}}
12
13 // gdb-command:print internal_padding_parent
14 // gdbg-check:$2 = {x = {x = 4, y = 5}, y = {x = 6, y = 7}, z = {x = 8, y = 9}}
15 // gdbr-check:$2 = struct_in_struct::InternalPaddingParent {x: struct_in_struct::InternalPadding {x: 4, y: 5}, y: struct_in_struct::InternalPadding {x: 6, y: 7}, z: struct_in_struct::InternalPadding {x: 8, y: 9}}
16
17 // gdb-command:print padding_at_end_parent
18 // gdbg-check:$3 = {x = {x = 10, y = 11}, y = {x = 12, y = 13}, z = {x = 14, y = 15}}
19 // gdbr-check:$3 = struct_in_struct::PaddingAtEndParent {x: struct_in_struct::PaddingAtEnd {x: 10, y: 11}, y: struct_in_struct::PaddingAtEnd {x: 12, y: 13}, z: struct_in_struct::PaddingAtEnd {x: 14, y: 15}}
20
21
22 // === LLDB TESTS ==================================================================================
23
24 // lldb-command:run
25
26 // lldb-command:print three_simple_structs
27 // lldbg-check:[...]$0 = { x = { x = 1 } y = { x = 2 } z = { x = 3 } }
28 // lldbr-check:(struct_in_struct::ThreeSimpleStructs) three_simple_structs = { x = { x = 1 } y = { x = 2 } z = { x = 3 } }
29
30 // lldb-command:print internal_padding_parent
31 // lldbg-check:[...]$1 = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } }
32 // lldbr-check:(struct_in_struct::InternalPaddingParent) internal_padding_parent = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } }
33
34 // lldb-command:print padding_at_end_parent
35 // lldbg-check:[...]$2 = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } }
36 // lldbr-check:(struct_in_struct::PaddingAtEndParent) padding_at_end_parent = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } }
37
38 // lldb-command:print mixed
39 // lldbg-check:[...]$3 = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 }
40 // lldbr-check:(struct_in_struct::Mixed) mixed = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 }
41
42 // lldb-command:print bag
43 // lldbg-check:[...]$4 = { x = { x = 22 } }
44 // lldbr-check:(struct_in_struct::Bag) bag = { x = { x = 22 } }
45
46 // lldb-command:print bag_in_bag
47 // lldbg-check:[...]$5 = { x = { x = { x = 23 } } }
48 // lldbr-check:(struct_in_struct::BagInBag) bag_in_bag = { x = { x = { x = 23 } } }
49
50 // lldb-command:print tjo
51 // lldbg-check:[...]$6 = { x = { x = { x = { x = 24 } } } }
52 // lldbr-check:(struct_in_struct::ThatsJustOverkill) tjo = { x = { x = { x = { x = 24 } } } }
53
54 // lldb-command:print tree
55 // lldbg-check:[...]$7 = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } }
56 // lldbr-check:(struct_in_struct::Tree) tree = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } }
57
58 #![allow(unused_variables)]
59 #![feature(omit_gdb_pretty_printer_section)]
60 #![omit_gdb_pretty_printer_section]
61
62 struct Simple {
63 x: i32
64 }
65
66 struct InternalPadding {
67 x: i32,
68 y: i64
69 }
70
71 struct PaddingAtEnd {
72 x: i64,
73 y: i32
74 }
75
76 struct ThreeSimpleStructs {
77 x: Simple,
78 y: Simple,
79 z: Simple
80 }
81
82 struct InternalPaddingParent {
83 x: InternalPadding,
84 y: InternalPadding,
85 z: InternalPadding
86 }
87
88 struct PaddingAtEndParent {
89 x: PaddingAtEnd,
90 y: PaddingAtEnd,
91 z: PaddingAtEnd
92 }
93
94 struct Mixed {
95 x: PaddingAtEnd,
96 y: InternalPadding,
97 z: Simple,
98 w: i16
99 }
100
101 struct Bag {
102 x: Simple
103 }
104
105 struct BagInBag {
106 x: Bag
107 }
108
109 struct ThatsJustOverkill {
110 x: BagInBag
111 }
112
113 struct Tree {
114 x: Simple,
115 y: InternalPaddingParent,
116 z: BagInBag
117 }
118
119 fn main() {
120
121 let three_simple_structs = ThreeSimpleStructs {
122 x: Simple { x: 1 },
123 y: Simple { x: 2 },
124 z: Simple { x: 3 }
125 };
126
127 let internal_padding_parent = InternalPaddingParent {
128 x: InternalPadding { x: 4, y: 5 },
129 y: InternalPadding { x: 6, y: 7 },
130 z: InternalPadding { x: 8, y: 9 }
131 };
132
133 let padding_at_end_parent = PaddingAtEndParent {
134 x: PaddingAtEnd { x: 10, y: 11 },
135 y: PaddingAtEnd { x: 12, y: 13 },
136 z: PaddingAtEnd { x: 14, y: 15 }
137 };
138
139 let mixed = Mixed {
140 x: PaddingAtEnd { x: 16, y: 17 },
141 y: InternalPadding { x: 18, y: 19 },
142 z: Simple { x: 20 },
143 w: 21
144 };
145
146 let bag = Bag { x: Simple { x: 22 } };
147 let bag_in_bag = BagInBag {
148 x: Bag {
149 x: Simple { x: 23 }
150 }
151 };
152
153 let tjo = ThatsJustOverkill {
154 x: BagInBag {
155 x: Bag {
156 x: Simple { x: 24 }
157 }
158 }
159 };
160
161 let tree = Tree {
162 x: Simple { x: 25 },
163 y: InternalPaddingParent {
164 x: InternalPadding { x: 26, y: 27 },
165 y: InternalPadding { x: 28, y: 29 },
166 z: InternalPadding { x: 30, y: 31 }
167 },
168 z: BagInBag {
169 x: Bag {
170 x: Simple { x: 32 }
171 }
172 }
173 };
174
175 zzz(); // #break
176 }
177
178 fn zzz() {()}