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::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::PackedInPacked {a: 1111, b: packed_struct::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct::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::PackedInUnpacked {a: -1111, b: packed_struct::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct::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, w = 543}, c = {x = 432, y = 321, z = 210, w = 109}, d = -98}
34 // gdbr-check:$4 = packed_struct::UnpackedInPacked {a: 987, b: packed_struct::Unpacked {x: 876, y: 765, z: 654, w: 543}, c: packed_struct::Unpacked {x: 432, y: 321, z: 210, w: 109}, d: -98}
36 // gdb-command:print sizeof(packed)
39 // gdb-command:print sizeof(packedInPacked)
43 // === LLDB TESTS ==================================================================================
47 // lldb-command:print packed
48 // lldb-check:[...]$0 = Packed { x: 123, y: 234, z: 345 }
50 // lldb-command:print packedInPacked
51 // lldb-check:[...]$1 = PackedInPacked { a: 1111, b: Packed { x: 2222, y: 3333, z: 4444 }, c: 5555, d: Packed { x: 6666, y: 7777, z: 8888 } }
53 // lldb-command:print packedInUnpacked
54 // lldb-check:[...]$2 = PackedInUnpacked { a: -1111, b: Packed { x: -2222, y: -3333, z: -4444 }, c: -5555, d: Packed { x: -6666, y: -7777, z: -8888 } }
56 // lldb-command:print unpackedInPacked
57 // 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 }
59 // lldb-command:print sizeof(packed)
60 // lldb-check:[...]$4 = 14
62 // lldb-command:print sizeof(packedInPacked)
63 // lldb-check:[...]$5 = 40
65 #![allow(unused_variables)]
66 #![feature(omit_gdb_pretty_printer_section)]
67 #![omit_gdb_pretty_printer_section]
77 struct PackedInPacked {
84 // layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd..
85 struct PackedInUnpacked {
92 // layout (64 bit): xx.. yyyy zz.. .... wwww wwww
100 // layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd
102 struct UnpackedInPacked {
110 let packed = Packed { x: 123, y: 234, z: 345 };
112 let packedInPacked = PackedInPacked {
114 b: Packed { x: 2222, y: 3333, z: 4444 },
116 d: Packed { x: 6666, y: 7777, z: 8888 }
119 let packedInUnpacked = PackedInUnpacked {
121 b: Packed { x: -2222, y: -3333, z: -4444 },
123 d: Packed { x: -6666, y: -7777, z: -8888 }
126 let unpackedInPacked = UnpackedInPacked {
128 b: Unpacked { x: 876, y: 765, z: 654, w: 543 },
129 c: Unpacked { x: 432, y: 321, z: 210, w: 109 },