]> git.proxmox.com Git - rustc.git/blame - src/test/debuginfo/struct-in-struct.rs
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / debuginfo / struct-in-struct.rs
CommitLineData
1a4d82fc 1// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
970d7e83
LB
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
1a4d82fc 11// ignore-tidy-linelength
1a4d82fc 12// min-lldb-version: 310
970d7e83 13
1a4d82fc 14// compile-flags:-g
970d7e83 15
1a4d82fc 16// === GDB TESTS ===================================================================================
970d7e83 17
1a4d82fc 18// gdb-command:run
970d7e83 19
1a4d82fc 20// gdb-command:print three_simple_structs
c30ab7b3
SL
21// gdbg-check:$1 = {x = {x = 1}, y = {x = 2}, z = {x = 3}}
22// 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}}
970d7e83 23
1a4d82fc 24// gdb-command:print internal_padding_parent
c30ab7b3
SL
25// gdbg-check:$2 = {x = {x = 4, y = 5}, y = {x = 6, y = 7}, z = {x = 8, y = 9}}
26// 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}}
1a4d82fc
JJ
27
28// gdb-command:print padding_at_end_parent
c30ab7b3
SL
29// gdbg-check:$3 = {x = {x = 10, y = 11}, y = {x = 12, y = 13}, z = {x = 14, y = 15}}
30// 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}}
1a4d82fc
JJ
31
32
33// === LLDB TESTS ==================================================================================
34
35// lldb-command:run
36
37// lldb-command:print three_simple_structs
0bf4aa26
XL
38// lldbg-check:[...]$0 = ThreeSimpleStructs { x: Simple { x: 1 }, y: Simple { x: 2 }, z: Simple { x: 3 } }
39// lldbr-check:(struct_in_struct::ThreeSimpleStructs) three_simple_structs = ThreeSimpleStructs { x: Simple { x: 1 }, y: Simple { x: 2 }, z: Simple { x: 3 } }
1a4d82fc
JJ
40
41// lldb-command:print internal_padding_parent
0bf4aa26
XL
42// lldbg-check:[...]$1 = InternalPaddingParent { x: InternalPadding { x: 4, y: 5 }, y: InternalPadding { x: 6, y: 7 }, z: InternalPadding { x: 8, y: 9 } }
43// lldbr-check:(struct_in_struct::InternalPaddingParent) internal_padding_parent = InternalPaddingParent { x: InternalPadding { x: 4, y: 5 }, y: InternalPadding { x: 6, y: 7 }, z: InternalPadding { x: 8, y: 9 } }
1a4d82fc
JJ
44
45// lldb-command:print padding_at_end_parent
0bf4aa26
XL
46// lldbg-check:[...]$2 = PaddingAtEndParent { x: PaddingAtEnd { x: 10, y: 11 }, y: PaddingAtEnd { x: 12, y: 13 }, z: PaddingAtEnd { x: 14, y: 15 } }
47// lldbr-check:(struct_in_struct::PaddingAtEndParent) padding_at_end_parent = PaddingAtEndParent { x: PaddingAtEnd { x: 10, y: 11 }, y: PaddingAtEnd { x: 12, y: 13 }, z: PaddingAtEnd { x: 14, y: 15 } }
1a4d82fc
JJ
48
49// lldb-command:print mixed
0bf4aa26
XL
50// lldbg-check:[...]$3 = Mixed { x: PaddingAtEnd { x: 16, y: 17 }, y: InternalPadding { x: 18, y: 19 }, z: Simple { x: 20 }, w: 21 }
51// lldbr-check:(struct_in_struct::Mixed) mixed = Mixed { x: PaddingAtEnd { x: 16, y: 17 }, y: InternalPadding { x: 18, y: 19 }, z: Simple { x: 20 }, w: 21 }
1a4d82fc
JJ
52
53// lldb-command:print bag
0bf4aa26
XL
54// lldbg-check:[...]$4 = Bag { x: Simple { x: 22 } }
55// lldbr-check:(struct_in_struct::Bag) bag = Bag { x: Simple { x: 22 } }
1a4d82fc
JJ
56
57// lldb-command:print bag_in_bag
0bf4aa26
XL
58// lldbg-check:[...]$5 = BagInBag { x: Bag { x: Simple { x: 23 } } }
59// lldbr-check:(struct_in_struct::BagInBag) bag_in_bag = BagInBag { x: Bag { x: Simple { x: 23 } } }
1a4d82fc
JJ
60
61// lldb-command:print tjo
0bf4aa26
XL
62// lldbg-check:[...]$6 = ThatsJustOverkill { x: BagInBag { x: Bag { x: Simple { x: 24 } } } }
63// lldbr-check:(struct_in_struct::ThatsJustOverkill) tjo = ThatsJustOverkill { x: BagInBag { x: Bag { x: Simple { x: 24 } } } }
1a4d82fc
JJ
64
65// lldb-command:print tree
0bf4aa26
XL
66// lldbg-check:[...]$7 = Tree { x: Simple { x: 25 }, y: InternalPaddingParent { x: InternalPadding { x: 26, y: 27 }, y: InternalPadding { x: 28, y: 29 }, z: InternalPadding { x: 30, y: 31 } }, z: BagInBag { x: Bag { x: Simple { x: 32 } } } }
67// lldbr-check:(struct_in_struct::Tree) tree = Tree { x: Simple { x: 25 }, y: InternalPaddingParent { x: InternalPadding { x: 26, y: 27 }, y: InternalPadding { x: 28, y: 29 }, z: InternalPadding { x: 30, y: 31 } }, z: BagInBag { x: Bag { x: Simple { x: 32 } } } }
1a4d82fc
JJ
68
69#![allow(unused_variables)]
b039eaaf 70#![feature(omit_gdb_pretty_printer_section)]
1a4d82fc 71#![omit_gdb_pretty_printer_section]
970d7e83
LB
72
73struct Simple {
74 x: i32
75}
76
77struct InternalPadding {
78 x: i32,
79 y: i64
80}
81
82struct PaddingAtEnd {
83 x: i64,
84 y: i32
85}
86
87struct ThreeSimpleStructs {
88 x: Simple,
89 y: Simple,
90 z: Simple
91}
92
93struct InternalPaddingParent {
94 x: InternalPadding,
95 y: InternalPadding,
96 z: InternalPadding
97}
98
99struct PaddingAtEndParent {
100 x: PaddingAtEnd,
101 y: PaddingAtEnd,
102 z: PaddingAtEnd
103}
104
105struct Mixed {
106 x: PaddingAtEnd,
107 y: InternalPadding,
108 z: Simple,
109 w: i16
110}
111
112struct Bag {
113 x: Simple
114}
115
116struct BagInBag {
117 x: Bag
118}
119
120struct ThatsJustOverkill {
121 x: BagInBag
122}
123
124struct Tree {
125 x: Simple,
126 y: InternalPaddingParent,
127 z: BagInBag
128}
129
130fn main() {
131
132 let three_simple_structs = ThreeSimpleStructs {
133 x: Simple { x: 1 },
134 y: Simple { x: 2 },
135 z: Simple { x: 3 }
136 };
137
138 let internal_padding_parent = InternalPaddingParent {
139 x: InternalPadding { x: 4, y: 5 },
140 y: InternalPadding { x: 6, y: 7 },
141 z: InternalPadding { x: 8, y: 9 }
142 };
143
144 let padding_at_end_parent = PaddingAtEndParent {
145 x: PaddingAtEnd { x: 10, y: 11 },
146 y: PaddingAtEnd { x: 12, y: 13 },
147 z: PaddingAtEnd { x: 14, y: 15 }
148 };
149
150 let mixed = Mixed {
151 x: PaddingAtEnd { x: 16, y: 17 },
152 y: InternalPadding { x: 18, y: 19 },
153 z: Simple { x: 20 },
154 w: 21
155 };
156
157 let bag = Bag { x: Simple { x: 22 } };
158 let bag_in_bag = BagInBag {
159 x: Bag {
160 x: Simple { x: 23 }
161 }
162 };
163
164 let tjo = ThatsJustOverkill {
165 x: BagInBag {
166 x: Bag {
167 x: Simple { x: 24 }
168 }
169 }
170 };
171
172 let tree = Tree {
173 x: Simple { x: 25 },
174 y: InternalPaddingParent {
175 x: InternalPadding { x: 26, y: 27 },
176 y: InternalPadding { x: 28, y: 29 },
177 z: InternalPadding { x: 30, y: 31 }
178 },
179 z: BagInBag {
180 x: Bag {
181 x: Simple { x: 32 }
182 }
183 }
184 };
185
1a4d82fc 186 zzz(); // #break
970d7e83
LB
187}
188
1a4d82fc 189fn zzz() {()}