]> git.proxmox.com Git - rustc.git/blame - src/test/debuginfo/tuple-in-struct.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / debuginfo / tuple-in-struct.rs
CommitLineData
1a4d82fc 1// min-lldb-version: 310
970d7e83 2
1a4d82fc 3// compile-flags:-g
970d7e83 4
1a4d82fc 5// gdb-command:run
970d7e83 6
1a4d82fc 7// gdb-command:print no_padding1
c30ab7b3
SL
8// gdbg-check:$1 = {x = {__0 = 0, __1 = 1}, y = 2, z = {__0 = 3, __1 = 4, __2 = 5}}
9// gdbr-check:$1 = tuple_in_struct::NoPadding1 {x: (0, 1), y: 2, z: (3, 4, 5)}
1a4d82fc 10// gdb-command:print no_padding2
c30ab7b3
SL
11// gdbg-check:$2 = {x = {__0 = 6, __1 = 7}, y = {__0 = {__0 = 8, __1 = 9}, __1 = 10}}
12// gdbr-check:$2 = tuple_in_struct::NoPadding2 {x: (6, 7), y: ((8, 9), 10)}
970d7e83 13
1a4d82fc 14// gdb-command:print tuple_internal_padding
c30ab7b3
SL
15// gdbg-check:$3 = {x = {__0 = 11, __1 = 12}, y = {__0 = 13, __1 = 14}}
16// gdbr-check:$3 = tuple_in_struct::TupleInternalPadding {x: (11, 12), y: (13, 14)}
1a4d82fc 17// gdb-command:print struct_internal_padding
c30ab7b3
SL
18// gdbg-check:$4 = {x = {__0 = 15, __1 = 16}, y = {__0 = 17, __1 = 18}}
19// gdbr-check:$4 = tuple_in_struct::StructInternalPadding {x: (15, 16), y: (17, 18)}
1a4d82fc 20// gdb-command:print both_internally_padded
c30ab7b3
SL
21// gdbg-check:$5 = {x = {__0 = 19, __1 = 20, __2 = 21}, y = {__0 = 22, __1 = 23}}
22// gdbr-check:$5 = tuple_in_struct::BothInternallyPadded {x: (19, 20, 21), y: (22, 23)}
970d7e83 23
1a4d82fc 24// gdb-command:print single_tuple
c30ab7b3
SL
25// gdbg-check:$6 = {x = {__0 = 24, __1 = 25, __2 = 26}}
26// gdbr-check:$6 = tuple_in_struct::SingleTuple {x: (24, 25, 26)}
970d7e83 27
1a4d82fc 28// gdb-command:print tuple_padded_at_end
c30ab7b3
SL
29// gdbg-check:$7 = {x = {__0 = 27, __1 = 28}, y = {__0 = 29, __1 = 30}}
30// gdbr-check:$7 = tuple_in_struct::TuplePaddedAtEnd {x: (27, 28), y: (29, 30)}
1a4d82fc 31// gdb-command:print struct_padded_at_end
c30ab7b3
SL
32// gdbg-check:$8 = {x = {__0 = 31, __1 = 32}, y = {__0 = 33, __1 = 34}}
33// gdbr-check:$8 = tuple_in_struct::StructPaddedAtEnd {x: (31, 32), y: (33, 34)}
1a4d82fc 34// gdb-command:print both_padded_at_end
c30ab7b3
SL
35// gdbg-check:$9 = {x = {__0 = 35, __1 = 36, __2 = 37}, y = {__0 = 38, __1 = 39}}
36// gdbr-check:$9 = tuple_in_struct::BothPaddedAtEnd {x: (35, 36, 37), y: (38, 39)}
1a4d82fc
JJ
37
38// gdb-command:print mixed_padding
c30ab7b3
SL
39// gdbg-check:$10 = {x = {__0 = {__0 = 40, __1 = 41, __2 = 42}, __1 = {__0 = 43, __1 = 44}}, y = {__0 = 45, __1 = 46, __2 = 47, __3 = 48}}
40// gdbr-check:$10 = tuple_in_struct::MixedPadding {x: ((40, 41, 42), (43, 44)), y: (45, 46, 47, 48)}
1a4d82fc
JJ
41
42#![allow(unused_variables)]
b039eaaf 43#![feature(omit_gdb_pretty_printer_section)]
1a4d82fc 44#![omit_gdb_pretty_printer_section]
970d7e83
LB
45
46struct NoPadding1 {
47 x: (i32, i32),
48 y: i32,
49 z: (i32, i32, i32)
50}
51
52struct NoPadding2 {
53 x: (i32, i32),
54 y: ((i32, i32), i32)
55}
56
57struct TupleInternalPadding {
58 x: (i16, i32),
59 y: (i32, i64)
60}
61
62struct StructInternalPadding {
63 x: (i16, i16),
64 y: (i64, i64)
65}
66
67struct BothInternallyPadded {
68 x: (i16, i32, i32),
69 y: (i32, i64)
70}
71
72struct SingleTuple {
73 x: (i16, i32, i64)
74}
75
76struct TuplePaddedAtEnd {
77 x: (i32, i16),
78 y: (i64, i32)
79}
80
81struct StructPaddedAtEnd {
82 x: (i64, i64),
83 y: (i16, i16)
84}
85
86struct BothPaddedAtEnd {
87 x: (i32, i32, i16),
88 y: (i64, i32)
89}
90
91// Data-layout (padding signified by dots, one column = 2 bytes):
92// [a.bbc...ddddee..ffffg.hhi...]
93struct MixedPadding {
94 x: ((i16, i32, i16), (i64, i32)),
95 y: (i64, i16, i32, i16)
96}
97
98
99fn main() {
100 let no_padding1 = NoPadding1 {
101 x: (0, 1),
102 y: 2,
103 z: (3, 4, 5)
104 };
105
106 let no_padding2 = NoPadding2 {
107 x: (6, 7),
108 y: ((8, 9), 10)
109 };
110
111 let tuple_internal_padding = TupleInternalPadding {
112 x: (11, 12),
113 y: (13, 14)
114 };
115
116 let struct_internal_padding = StructInternalPadding {
117 x: (15, 16),
118 y: (17, 18)
119 };
120
121 let both_internally_padded = BothInternallyPadded {
122 x: (19, 20, 21),
123 y: (22, 23)
124 };
125
126 let single_tuple = SingleTuple {
127 x: (24, 25, 26)
128 };
129
130 let tuple_padded_at_end = TuplePaddedAtEnd {
131 x: (27, 28),
132 y: (29, 30)
133 };
134
135 let struct_padded_at_end = StructPaddedAtEnd {
136 x: (31, 32),
137 y: (33, 34)
138 };
139
140 let both_padded_at_end = BothPaddedAtEnd {
141 x: (35, 36, 37),
142 y: (38, 39)
143 };
144
145 let mixed_padding = MixedPadding {
146 x: ((40, 41, 42), (43, 44)),
147 y: (45, 46, 47, 48)
148 };
149
1a4d82fc 150 zzz(); // #break
970d7e83
LB
151}
152
1a4d82fc 153fn zzz() {()}