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 tuple_interior_padding
21 // gdbg-check:$1 = {__0 = 0, __1 = OneHundred}
22 // gdbr-check:$1 = (0, c_style_enum_in_composite::AnEnum::OneHundred)
24 // gdb-command:print tuple_padding_at_end
25 // gdbg-check:$2 = {__0 = {__0 = 1, __1 = OneThousand}, __1 = 2}
26 // gdbr-check:$2 = ((1, c_style_enum_in_composite::AnEnum::OneThousand), 2)
28 // gdb-command:print tuple_different_enums
29 // gdbg-check:$3 = {__0 = OneThousand, __1 = MountainView, __2 = OneMillion, __3 = Vienna}
30 // gdbr-check:$3 = (c_style_enum_in_composite::AnEnum::OneThousand, c_style_enum_in_composite::AnotherEnum::MountainView, c_style_enum_in_composite::AnEnum::OneMillion, c_style_enum_in_composite::AnotherEnum::Vienna)
32 // gdb-command:print padded_struct
33 // gdbg-check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5}
34 // gdbr-check:$4 = c_style_enum_in_composite::PaddedStruct {a: 3, b: c_style_enum_in_composite::AnEnum::OneMillion, c: 4, d: c_style_enum_in_composite::AnotherEnum::Toronto, e: 5}
36 // gdb-command:print packed_struct
37 // gdbg-check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8}
38 // gdbr-check:$5 = c_style_enum_in_composite::PackedStruct {a: 6, b: c_style_enum_in_composite::AnEnum::OneHundred, c: 7, d: c_style_enum_in_composite::AnotherEnum::Vienna, e: 8}
40 // gdb-command:print non_padded_struct
41 // gdbg-check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto}
42 // gdbr-check:$6 = c_style_enum_in_composite::NonPaddedStruct {a: c_style_enum_in_composite::AnEnum::OneMillion, b: c_style_enum_in_composite::AnotherEnum::MountainView, c: c_style_enum_in_composite::AnEnum::OneThousand, d: c_style_enum_in_composite::AnotherEnum::Toronto}
44 // gdb-command:print struct_with_drop
45 // gdbg-check:$7 = {__0 = {a = OneHundred, b = Vienna}, __1 = 9}
46 // gdbr-check:$7 = (c_style_enum_in_composite::StructWithDrop {a: c_style_enum_in_composite::AnEnum::OneHundred, b: c_style_enum_in_composite::AnotherEnum::Vienna}, 9)
48 // === LLDB TESTS ==================================================================================
52 // lldb-command:print tuple_interior_padding
53 // lldb-check:[...]$0 = (0, OneHundred)
55 // lldb-command:print tuple_padding_at_end
56 // lldb-check:[...]$1 = ((1, OneThousand), 2)
57 // lldb-command:print tuple_different_enums
58 // lldb-check:[...]$2 = (OneThousand, MountainView, OneMillion, Vienna)
60 // lldb-command:print padded_struct
61 // lldb-check:[...]$3 = PaddedStruct { a: 3, b: OneMillion, c: 4, d: Toronto, e: 5 }
63 // lldb-command:print packed_struct
64 // lldb-check:[...]$4 = PackedStruct { a: 6, b: OneHundred, c: 7, d: Vienna, e: 8 }
66 // lldb-command:print non_padded_struct
67 // lldb-check:[...]$5 = NonPaddedStruct { a: OneMillion, b: MountainView, c: OneThousand, d: Toronto }
69 // lldb-command:print struct_with_drop
70 // lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9)
72 #![allow(unused_variables)]
73 #![feature(omit_gdb_pretty_printer_section)]
74 #![omit_gdb_pretty_printer_section]
76 use self::AnEnum::{OneHundred, OneThousand, OneMillion};
77 use self::AnotherEnum::{MountainView, Toronto, Vienna};
100 struct PackedStruct {
108 struct NonPaddedStruct {
115 struct StructWithDrop {
120 impl Drop for StructWithDrop {
121 fn drop(&mut self) {()}
126 let tuple_interior_padding = (0_i16, OneHundred);
127 // It will depend on the machine architecture if any padding is actually involved here
128 let tuple_padding_at_end = ((1_u64, OneThousand), 2_u64);
129 let tuple_different_enums = (OneThousand, MountainView, OneMillion, Vienna);
131 let padded_struct = PaddedStruct {
139 let packed_struct = PackedStruct {
147 let non_padded_struct = NonPaddedStruct {
154 let struct_with_drop = (StructWithDrop { a: OneHundred, b: Vienna }, 9_i64);