1 // ignore-tidy-linelength
2 // min-lldb-version: 310
6 // === GDB TESTS ===================================================================================
10 // gdb-command:print tuple_interior_padding
11 // gdbg-check:$1 = {__0 = 0, __1 = OneHundred}
12 // gdbr-check:$1 = (0, c_style_enum_in_composite::AnEnum::OneHundred)
14 // gdb-command:print tuple_padding_at_end
15 // gdbg-check:$2 = {__0 = {__0 = 1, __1 = OneThousand}, __1 = 2}
16 // gdbr-check:$2 = ((1, c_style_enum_in_composite::AnEnum::OneThousand), 2)
18 // gdb-command:print tuple_different_enums
19 // gdbg-check:$3 = {__0 = OneThousand, __1 = MountainView, __2 = OneMillion, __3 = Vienna}
20 // 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)
22 // gdb-command:print padded_struct
23 // gdbg-check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5}
24 // 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}
26 // gdb-command:print packed_struct
27 // gdbg-check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8}
28 // 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}
30 // gdb-command:print non_padded_struct
31 // gdbg-check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto}
32 // 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}
34 // gdb-command:print struct_with_drop
35 // gdbg-check:$7 = {__0 = {a = OneHundred, b = Vienna}, __1 = 9}
36 // 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)
38 // === LLDB TESTS ==================================================================================
42 // lldb-command:print tuple_interior_padding
43 // lldbg-check:[...]$0 = { 0 = 0 1 = OneHundred }
44 // lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { 0 = 0 1 = OneHundred }
46 // lldb-command:print tuple_padding_at_end
47 // lldbg-check:[...]$1 = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 }
48 // lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 }
50 // lldb-command:print tuple_different_enums
51 // lldbg-check:[...]$2 = { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna }
52 // lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { 0 = c_style_enum_in_composite::AnEnum::OneThousand 1 = c_style_enum_in_composite::AnotherEnum::MountainView 2 = c_style_enum_in_composite::AnEnum::OneMillion 3 = c_style_enum_in_composite::AnotherEnum::Vienna }
54 // lldb-command:print padded_struct
55 // lldbg-check:[...]$3 = { a = 3 b = OneMillion c = 4 d = Toronto e = 5 }
56 // lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = { a = 3 b = c_style_enum_in_composite::AnEnum::OneMillion c = 4 d = Toronto e = 5 }
58 // lldb-command:print packed_struct
59 // lldbg-check:[...]$4 = { a = 6 b = OneHundred c = 7 d = Vienna e = 8 }
60 // lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = { a = 6 b = c_style_enum_in_composite::AnEnum::OneHundred c = 7 d = Vienna e = 8 }
62 // lldb-command:print non_padded_struct
63 // lldbg-check:[...]$5 = { a = OneMillion b = MountainView c = OneThousand d = Toronto }
64 // lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = { 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 }
66 // lldb-command:print struct_with_drop
67 // lldbg-check:[...]$6 = { 0 = { a = OneHundred b = Vienna } 1 = 9 }
68 // lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { 0 = { a = c_style_enum_in_composite::AnEnum::OneHundred b = c_style_enum_in_composite::AnotherEnum::Vienna } 1 = 9 }
70 #![allow(unused_variables)]
71 #![feature(omit_gdb_pretty_printer_section)]
72 #![omit_gdb_pretty_printer_section]
74 use self::AnEnum::{OneHundred, OneThousand, OneMillion};
75 use self::AnotherEnum::{MountainView, Toronto, Vienna};
106 struct NonPaddedStruct {
113 struct StructWithDrop {
118 impl Drop for StructWithDrop {
119 fn drop(&mut self) {()}
124 let tuple_interior_padding = (0_i16, OneHundred);
125 // It will depend on the machine architecture if any padding is actually involved here
126 let tuple_padding_at_end = ((1_u64, OneThousand), 2_u64);
127 let tuple_different_enums = (OneThousand, MountainView, OneMillion, Vienna);
129 let padded_struct = PaddedStruct {
137 let packed_struct = PackedStruct {
145 let non_padded_struct = NonPaddedStruct {
152 let struct_with_drop = (StructWithDrop { a: OneHundred, b: Vienna }, 9_i64);