2014-02-07 03:57:09 +00:00
|
|
|
//@ compile-flags:-g
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:run
|
2013-07-02 08:33:51 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print tuple_interior_padding
|
2024-08-17 21:31:49 +00:00
|
|
|
// gdb-check:$1 = (0, c_style_enum_in_composite::AnEnum::OneHundred)
|
2013-07-02 08:33:51 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print tuple_padding_at_end
|
2024-08-17 21:31:49 +00:00
|
|
|
// gdb-check:$2 = ((1, c_style_enum_in_composite::AnEnum::OneThousand), 2)
|
2013-07-02 08:33:51 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print tuple_different_enums
|
2024-08-17 21:31:49 +00:00
|
|
|
// gdb-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)
|
2013-07-02 08:33:51 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print padded_struct
|
2024-08-17 21:31:49 +00:00
|
|
|
// gdb-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}
|
2013-07-02 08:33:51 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print packed_struct
|
2024-08-17 21:31:49 +00:00
|
|
|
// gdb-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}
|
2013-07-02 08:33:51 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print non_padded_struct
|
2024-08-17 21:31:49 +00:00
|
|
|
// gdb-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}
|
2013-07-02 08:33:51 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print struct_with_drop
|
2024-08-17 21:31:49 +00:00
|
|
|
// gdb-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)
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v tuple_interior_padding
|
2024-08-18 21:00:33 +00:00
|
|
|
// lldb-check:[...] { 0 = 0 1 = OneHundred }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v tuple_padding_at_end
|
2024-08-18 21:00:33 +00:00
|
|
|
// lldb-check:[...] { 0 = { 0 = 1 1 = OneThousand } 1 = 2 }
|
2019-05-14 12:50:58 +00:00
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v tuple_different_enums
|
2024-08-18 21:00:33 +00:00
|
|
|
// lldb-check:[...] { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v padded_struct
|
2024-08-18 21:00:33 +00:00
|
|
|
// lldb-check:[...] { a = 3 b = OneMillion c = 4 d = Toronto e = 5 }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v packed_struct
|
2024-08-18 21:00:33 +00:00
|
|
|
// lldb-check:[...] { a = 6 b = OneHundred c = 7 d = Vienna e = 8 }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v non_padded_struct
|
2024-08-18 21:00:33 +00:00
|
|
|
// lldb-check:[...] { a = OneMillion b = MountainView c = OneThousand d = Toronto }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v struct_with_drop
|
2024-08-18 21:00:33 +00:00
|
|
|
// lldb-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
2014-10-27 22:37:07 +00:00
|
|
|
#![allow(unused_variables)]
|
2015-09-19 20:33:47 +00:00
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
2014-12-03 22:48:18 +00:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
2013-08-17 15:37:42 +00:00
|
|
|
|
2014-11-06 08:05:53 +00:00
|
|
|
use self::AnEnum::{OneHundred, OneThousand, OneMillion};
|
|
|
|
use self::AnotherEnum::{MountainView, Toronto, Vienna};
|
|
|
|
|
2013-07-02 08:33:51 +00:00
|
|
|
enum AnEnum {
|
|
|
|
OneHundred = 100,
|
|
|
|
OneThousand = 1000,
|
|
|
|
OneMillion = 1000000
|
|
|
|
}
|
|
|
|
|
|
|
|
enum AnotherEnum {
|
|
|
|
MountainView,
|
|
|
|
Toronto,
|
|
|
|
Vienna
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PaddedStruct {
|
|
|
|
a: i16,
|
|
|
|
b: AnEnum,
|
|
|
|
c: i16,
|
|
|
|
d: AnotherEnum,
|
|
|
|
e: i16
|
|
|
|
}
|
|
|
|
|
2014-05-27 06:56:52 +00:00
|
|
|
#[repr(packed)]
|
2013-07-02 08:33:51 +00:00
|
|
|
struct PackedStruct {
|
|
|
|
a: i16,
|
|
|
|
b: AnEnum,
|
|
|
|
c: i16,
|
|
|
|
d: AnotherEnum,
|
|
|
|
e: i16
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NonPaddedStruct {
|
|
|
|
a: AnEnum,
|
|
|
|
b: AnotherEnum,
|
|
|
|
c: AnEnum,
|
|
|
|
d: AnotherEnum
|
|
|
|
}
|
|
|
|
|
|
|
|
struct StructWithDrop {
|
|
|
|
a: AnEnum,
|
|
|
|
b: AnotherEnum
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for StructWithDrop {
|
2013-09-17 01:18:07 +00:00
|
|
|
fn drop(&mut self) {()}
|
2013-07-02 08:33:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
|
|
|
let tuple_interior_padding = (0_i16, OneHundred);
|
|
|
|
// It will depend on the machine architecture if any padding is actually involved here
|
|
|
|
let tuple_padding_at_end = ((1_u64, OneThousand), 2_u64);
|
|
|
|
let tuple_different_enums = (OneThousand, MountainView, OneMillion, Vienna);
|
|
|
|
|
|
|
|
let padded_struct = PaddedStruct {
|
|
|
|
a: 3,
|
|
|
|
b: OneMillion,
|
|
|
|
c: 4,
|
|
|
|
d: Toronto,
|
|
|
|
e: 5
|
|
|
|
};
|
|
|
|
|
|
|
|
let packed_struct = PackedStruct {
|
|
|
|
a: 6,
|
|
|
|
b: OneHundred,
|
|
|
|
c: 7,
|
|
|
|
d: Vienna,
|
|
|
|
e: 8
|
|
|
|
};
|
|
|
|
|
|
|
|
let non_padded_struct = NonPaddedStruct {
|
|
|
|
a: OneMillion,
|
|
|
|
b: MountainView,
|
|
|
|
c: OneThousand,
|
|
|
|
d: Toronto
|
|
|
|
};
|
|
|
|
|
|
|
|
let struct_with_drop = (StructWithDrop { a: OneHundred, b: Vienna }, 9_i64);
|
|
|
|
|
2014-07-09 12:46:09 +00:00
|
|
|
zzz(); // #break
|
2013-07-02 08:33:51 +00:00
|
|
|
}
|
|
|
|
|
2014-07-09 12:46:09 +00:00
|
|
|
fn zzz() { () }
|