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 // ignore-android: FIXME(#10381)
13 // min-lldb-version: 310
17 // === GDB TESTS ===================================================================================
21 // gdb-command:print packed
22 // gdb-check:$1 = {x = 123, y = 234, z = 345}
24 // gdb-command:print packedInPacked
25 // gdb-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
27 // gdb-command:print packedInUnpacked
28 // gdb-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
30 // gdb-command:print unpackedInPacked
31 // gdb-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654, w = 543}, c = {x = 432, y = 321, z = 210, w = 109}, d = -98}
33 // gdb-command:print sizeof(packed)
36 // gdb-command:print sizeof(packedInPacked)
40 // === LLDB TESTS ==================================================================================
44 // lldb-command:print packed
45 // lldb-check:[...]$0 = Packed { x: 123, y: 234, z: 345 }
47 // lldb-command:print packedInPacked
48 // lldb-check:[...]$1 = PackedInPacked { a: 1111, b: Packed { x: 2222, y: 3333, z: 4444 }, c: 5555, d: Packed { x: 6666, y: 7777, z: 8888 } }
50 // lldb-command:print packedInUnpacked
51 // lldb-check:[...]$2 = PackedInUnpacked { a: -1111, b: Packed { x: -2222, y: -3333, z: -4444 }, c: -5555, d: Packed { x: -6666, y: -7777, z: -8888 } }
53 // lldb-command:print unpackedInPacked
54 // lldb-check:[...]$3 = UnpackedInPacked { a: 987, b: Unpacked { x: 876, y: 765, z: 654, w: 543 }, c: Unpacked { x: 432, y: 321, z: 210, w: 109 }, d: -98 }
56 // lldb-command:print sizeof(packed)
57 // lldb-check:[...]$4 = 14
59 // lldb-command:print sizeof(packedInPacked)
60 // lldb-check:[...]$5 = 40
62 #![allow(unused_variables)]
72 struct PackedInPacked {
79 // layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd..
80 struct PackedInUnpacked {
87 // layout (64 bit): xx.. yyyy zz.. .... wwww wwww
95 // layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd
97 struct UnpackedInPacked {
105 let packed = Packed { x: 123, y: 234, z: 345 };
107 let packedInPacked = PackedInPacked {
109 b: Packed { x: 2222, y: 3333, z: 4444 },
111 d: Packed { x: 6666, y: 7777, z: 8888 }
114 let packedInUnpacked = PackedInUnpacked {
116 b: Packed { x: -2222, y: -3333, z: -4444 },
118 d: Packed { x: -6666, y: -7777, z: -8888 }
121 let unpackedInPacked = UnpackedInPacked {
123 b: Unpacked { x: 876, y: 765, z: 654, w: 543 },
124 c: Unpacked { x: 432, y: 321, z: 210, w: 109 },