1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
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.
11 // ignore-tidy-linelength
12 // min-lldb-version: 310
16 // === GDB TESTS ===================================================================================
20 // gdb-command:print packed
21 // gdbg-check:$1 = {x = 123, y = 234, z = 345}
22 // gdbr-check:$1 = packed_struct_with_destructor::Packed {x: 123, y: 234, z: 345}
24 // gdb-command:print packedInPacked
25 // gdbg-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
26 // gdbr-check:$2 = packed_struct_with_destructor::PackedInPacked {a: 1111, b: packed_struct_with_destructor::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct_with_destructor::Packed {x: 6666, y: 7777, z: 8888}}
28 // gdb-command:print packedInUnpacked
29 // gdbg-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
30 // gdbr-check:$3 = packed_struct_with_destructor::PackedInUnpacked {a: -1111, b: packed_struct_with_destructor::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct_with_destructor::Packed {x: -6666, y: -7777, z: -8888}}
32 // gdb-command:print unpackedInPacked
33 // gdbg-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654}, c = {x = 543, y = 432, z = 321}, d = 210}
34 // gdbr-check:$4 = packed_struct_with_destructor::UnpackedInPacked {a: 987, b: packed_struct_with_destructor::Unpacked {x: 876, y: 765, z: 654}, c: packed_struct_with_destructor::Unpacked {x: 543, y: 432, z: 321}, d: 210}
37 // gdb-command:print packedInPackedWithDrop
38 // gdbg-check:$5 = {a = 11, b = {x = 22, y = 33, z = 44}, c = 55, d = {x = 66, y = 77, z = 88}}
39 // gdbr-check:$5 = packed_struct_with_destructor::PackedInPackedWithDrop {a: 11, b: packed_struct_with_destructor::Packed {x: 22, y: 33, z: 44}, c: 55, d: packed_struct_with_destructor::Packed {x: 66, y: 77, z: 88}}
41 // gdb-command:print packedInUnpackedWithDrop
42 // gdbg-check:$6 = {a = -11, b = {x = -22, y = -33, z = -44}, c = -55, d = {x = -66, y = -77, z = -88}}
43 // gdbr-check:$6 = packed_struct_with_destructor::PackedInUnpackedWithDrop {a: -11, b: packed_struct_with_destructor::Packed {x: -22, y: -33, z: -44}, c: -55, d: packed_struct_with_destructor::Packed {x: -66, y: -77, z: -88}}
45 // gdb-command:print unpackedInPackedWithDrop
46 // gdbg-check:$7 = {a = 98, b = {x = 87, y = 76, z = 65}, c = {x = 54, y = 43, z = 32}, d = 21}
47 // gdbr-check:$7 = packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 98, b: packed_struct_with_destructor::Unpacked {x: 87, y: 76, z: 65}, c: packed_struct_with_destructor::Unpacked {x: 54, y: 43, z: 32}, d: 21}
49 // gdb-command:print deeplyNested
50 // gdbg-check:$8 = {a = {a = 1, b = {x = 2, y = 3, z = 4}, c = 5, d = {x = 6, y = 7, z = 8}}, b = {a = 9, b = {x = 10, y = 11, z = 12}, c = {x = 13, y = 14, z = 15}, d = 16}, c = {a = 17, b = {x = 18, y = 19, z = 20}, c = 21, d = {x = 22, y = 23, z = 24}}, d = {a = 25, b = {x = 26, y = 27, z = 28}, c = 29, d = {x = 30, y = 31, z = 32}}, e = {a = 33, b = {x = 34, y = 35, z = 36}, c = {x = 37, y = 38, z = 39}, d = 40}, f = {a = 41, b = {x = 42, y = 43, z = 44}, c = 45, d = {x = 46, y = 47, z = 48}}}
51 // gdbr-check:$8 = packed_struct_with_destructor::DeeplyNested {a: packed_struct_with_destructor::PackedInPacked {a: 1, b: packed_struct_with_destructor::Packed {x: 2, y: 3, z: 4}, c: 5, d: packed_struct_with_destructor::Packed {x: 6, y: 7, z: 8}}, b: packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 9, b: packed_struct_with_destructor::Unpacked {x: 10, y: 11, z: 12}, c: packed_struct_with_destructor::Unpacked {x: 13, y: 14, z: 15}, d: 16}, c: packed_struct_with_destructor::PackedInUnpacked {a: 17, b: packed_struct_with_destructor::Packed {x: 18, y: 19, z: 20}, c: 21, d: packed_struct_with_destructor::Packed {x: 22, y: 23, z: 24}}, d: packed_struct_with_destructor::PackedInUnpackedWithDrop {a: 25, b: packed_struct_with_destructor::Packed {x: 26, y: 27, z: 28}, c: 29, d: packed_struct_with_destructor::Packed {x: 30, y: 31, z: 32}}, e: packed_struct_with_destructor::UnpackedInPacked {a: 33, b: packed_struct_with_destructor::Unpacked {x: 34, y: 35, z: 36}, c: packed_struct_with_destructor::Unpacked {x: 37, y: 38, z: 39}, d: 40}, f: packed_struct_with_destructor::PackedInPackedWithDrop {a: 41, b: packed_struct_with_destructor::Packed {x: 42, y: 43, z: 44}, c: 45, d: packed_struct_with_destructor::Packed {x: 46, y: 47, z: 48}}}
54 // === LLDB TESTS ==================================================================================
58 // lldb-command:print packed
59 // lldb-check:[...]$0 = Packed { x: 123, y: 234, z: 345 }
61 // lldb-command:print packedInPacked
62 // lldb-check:[...]$1 = PackedInPacked { a: 1111, b: Packed { x: 2222, y: 3333, z: 4444 }, c: 5555, d: Packed { x: 6666, y: 7777, z: 8888 } }
64 // lldb-command:print packedInUnpacked
65 // lldb-check:[...]$2 = PackedInUnpacked { a: -1111, b: Packed { x: -2222, y: -3333, z: -4444 }, c: -5555, d: Packed { x: -6666, y: -7777, z: -8888 } }
67 // lldb-command:print unpackedInPacked
68 // lldb-check:[...]$3 = UnpackedInPacked { a: 987, b: Unpacked { x: 876, y: 765, z: 654 }, c: Unpacked { x: 543, y: 432, z: 321 }, d: 210 }
70 // lldb-command:print packedInPackedWithDrop
71 // lldb-check:[...]$4 = PackedInPackedWithDrop { a: 11, b: Packed { x: 22, y: 33, z: 44 }, c: 55, d: Packed { x: 66, y: 77, z: 88 } }
73 // lldb-command:print packedInUnpackedWithDrop
74 // lldb-check:[...]$5 = PackedInUnpackedWithDrop { a: -11, b: Packed { x: -22, y: -33, z: -44 }, c: -55, d: Packed { x: -66, y: -77, z: -88 } }
76 // lldb-command:print unpackedInPackedWithDrop
77 // lldb-check:[...]$6 = UnpackedInPackedWithDrop { a: 98, b: Unpacked { x: 87, y: 76, z: 65 }, c: Unpacked { x: 54, y: 43, z: 32 }, d: 21 }
79 // lldb-command:print deeplyNested
80 // lldb-check:[...]$7 = DeeplyNested { a: PackedInPacked { a: 1, b: Packed { x: 2, y: 3, z: 4 }, c: 5, d: Packed { x: 6, y: 7, z: 8 } }, b: UnpackedInPackedWithDrop { a: 9, b: Unpacked { x: 10, y: 11, z: 12 }, c: Unpacked { x: 13, y: 14, z: 15 }, d: 16 }, c: PackedInUnpacked { a: 17, b: Packed { x: 18, y: 19, z: 20 }, c: 21, d: Packed { x: 22, y: 23, z: 24 } }, d: PackedInUnpackedWithDrop { a: 25, b: Packed { x: 26, y: 27, z: 28 }, c: 29, d: Packed { x: 30, y: 31, z: 32 } }, e: UnpackedInPacked { a: 33, b: Unpacked { x: 34, y: 35, z: 36 }, c: Unpacked { x: 37, y: 38, z: 39 }, d: 40 }, f: PackedInPackedWithDrop { a: 41, b: Packed { x: 42, y: 43, z: 44 }, c: 45, d: Packed { x: 46, y: 47, z: 48 } } }
83 #![allow(unused_variables)]
84 #![feature(omit_gdb_pretty_printer_section)]
85 #![omit_gdb_pretty_printer_section]
94 impl Drop
for Packed
{
99 struct PackedInPacked
{
106 struct PackedInUnpacked
{
119 impl Drop
for Unpacked
{
120 fn drop(&mut self) {}
124 struct UnpackedInPacked
{
132 struct PackedInPackedWithDrop
{
139 impl Drop
for PackedInPackedWithDrop
{
140 fn drop(&mut self) {}
143 struct PackedInUnpackedWithDrop
{
150 impl Drop
for PackedInUnpackedWithDrop
{
151 fn drop(&mut self) {}
155 struct UnpackedInPackedWithDrop
{
162 impl Drop
for UnpackedInPackedWithDrop
{
163 fn drop(&mut self) {}
166 struct DeeplyNested
{
168 b
: UnpackedInPackedWithDrop
,
170 d
: PackedInUnpackedWithDrop
,
172 f
: PackedInPackedWithDrop
176 let packed
= Packed { x: 123, y: 234, z: 345 }
;
178 let packedInPacked
= PackedInPacked
{
180 b
: Packed { x: 2222, y: 3333, z: 4444 }
,
182 d
: Packed { x: 6666, y: 7777, z: 8888 }
185 let packedInUnpacked
= PackedInUnpacked
{
187 b
: Packed { x: -2222, y: -3333, z: -4444 }
,
189 d
: Packed { x: -6666, y: -7777, z: -8888 }
192 let unpackedInPacked
= UnpackedInPacked
{
194 b
: Unpacked { x: 876, y: 765, z: 654 }
,
195 c
: Unpacked { x: 543, y: 432, z: 321 }
,
199 let packedInPackedWithDrop
= PackedInPackedWithDrop
{
201 b
: Packed { x: 22, y: 33, z: 44 }
,
203 d
: Packed { x: 66, y: 77, z: 88 }
206 let packedInUnpackedWithDrop
= PackedInUnpackedWithDrop
{
208 b
: Packed { x: -22, y: -33, z: -44 }
,
210 d
: Packed { x: -66, y: -77, z: -88 }
213 let unpackedInPackedWithDrop
= UnpackedInPackedWithDrop
{
215 b
: Unpacked { x: 87, y: 76, z: 65 }
,
216 c
: Unpacked { x: 54, y: 43, z: 32 }
,
220 let deeplyNested
= DeeplyNested
{
223 b
: Packed { x: 2, y: 3, z: 4 }
,
225 d
: Packed { x: 6, y: 7, z: 8 }
227 b
: UnpackedInPackedWithDrop
{
229 b
: Unpacked { x: 10, y: 11, z: 12 }
,
230 c
: Unpacked { x: 13, y: 14, z: 15 }
,
233 c
: PackedInUnpacked
{
235 b
: Packed { x: 18, y: 19, z: 20 }
,
237 d
: Packed { x: 22, y: 23, z: 24 }
239 d
: PackedInUnpackedWithDrop
{
241 b
: Packed { x: 26, y: 27, z: 28 }
,
243 d
: Packed { x: 30, y: 31, z: 32 }
245 e
: UnpackedInPacked
{
247 b
: Unpacked { x: 34, y: 35, z: 36 }
,
248 c
: Unpacked { x: 37, y: 38, z: 39 }
,
251 f
: PackedInPackedWithDrop
{
253 b
: Packed { x: 42, y: 43, z: 44 }
,
255 d
: Packed { x: 46, y: 47, z: 48 }