2014-02-07 13:08:32 -06:00
|
|
|
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
2013-07-02 03:33:51 -05:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2014-07-09 07:46:09 -05:00
|
|
|
// ignore-tidy-linelength
|
2014-10-09 09:31:03 -05:00
|
|
|
// min-lldb-version: 310
|
2013-12-13 17:45:08 -06:00
|
|
|
|
2014-02-06 21:57:09 -06:00
|
|
|
// compile-flags:-g
|
2014-07-09 07:46:09 -05:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:run
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print tuple_interior_padding
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$1 = {__0 = 0, __1 = OneHundred}
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print tuple_padding_at_end
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$2 = {__0 = {__0 = 1, __1 = OneThousand}, __1 = 2}
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print tuple_different_enums
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$3 = {__0 = OneThousand, __1 = MountainView, __2 = OneMillion, __3 = Vienna}
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print padded_struct
|
|
|
|
// gdb-check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5}
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print packed_struct
|
|
|
|
// gdb-check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8}
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print non_padded_struct
|
|
|
|
// gdb-check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto}
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print struct_with_drop
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$7 = {__0 = {a = OneHundred, b = Vienna}, __1 = 9}
|
2013-07-02 03:33:51 -05:00
|
|
|
|
2014-07-09 07:46:09 -05:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
|
|
|
// lldb-command:print tuple_interior_padding
|
|
|
|
// lldb-check:[...]$0 = (0, OneHundred)
|
|
|
|
|
|
|
|
// lldb-command:print tuple_padding_at_end
|
|
|
|
// lldb-check:[...]$1 = ((1, OneThousand), 2)
|
|
|
|
// lldb-command:print tuple_different_enums
|
|
|
|
// lldb-check:[...]$2 = (OneThousand, MountainView, OneMillion, Vienna)
|
|
|
|
|
|
|
|
// lldb-command:print padded_struct
|
|
|
|
// lldb-check:[...]$3 = PaddedStruct { a: 3, b: OneMillion, c: 4, d: Toronto, e: 5 }
|
|
|
|
|
|
|
|
// lldb-command:print packed_struct
|
|
|
|
// lldb-check:[...]$4 = PackedStruct { a: 6, b: OneHundred, c: 7, d: Vienna, e: 8 }
|
|
|
|
|
|
|
|
// lldb-command:print non_padded_struct
|
|
|
|
// lldb-check:[...]$5 = NonPaddedStruct { a: OneMillion, b: MountainView, c: OneThousand, d: Toronto }
|
|
|
|
|
|
|
|
// lldb-command:print struct_with_drop
|
|
|
|
// lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9)
|
|
|
|
|
2014-10-27 17:37:07 -05:00
|
|
|
#![allow(unused_variables)]
|
2014-12-03 16:48:18 -06:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
2013-08-17 10:37:42 -05:00
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
use self::AnEnum::{OneHundred, OneThousand, OneMillion};
|
|
|
|
use self::AnotherEnum::{MountainView, Toronto, Vienna};
|
|
|
|
|
2013-07-02 03:33:51 -05: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 01:56:52 -05:00
|
|
|
#[repr(packed)]
|
2013-07-02 03:33:51 -05: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-16 20:18:07 -05:00
|
|
|
fn drop(&mut self) {()}
|
2013-07-02 03:33:51 -05: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 07:46:09 -05:00
|
|
|
zzz(); // #break
|
2013-07-02 03:33:51 -05:00
|
|
|
}
|
|
|
|
|
2014-07-09 07:46:09 -05:00
|
|
|
fn zzz() { () }
|