2014-02-07 13:08:32 -06:00
|
|
|
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
2013-06-20 08:25:30 -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.
|
|
|
|
|
2015-04-06 13:39:51 -05:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
2014-10-09 09:31:03 -05:00
|
|
|
// min-lldb-version: 310
|
2013-11-04 00:53:01 -06:00
|
|
|
|
2014-02-06 21:57:09 -06:00
|
|
|
// compile-flags:-g
|
2014-10-29 01:13:29 -05:00
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:run
|
|
|
|
|
|
|
|
// gdb-command:print no_padding1
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$1 = {x = {__0 = 0, __1 = 1}, y = 2, z = {__0 = 3, __1 = 4, __2 = 5}}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print no_padding2
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$2 = {x = {__0 = 6, __1 = 7}, y = {__0 = {__0 = 8, __1 = 9}, __1 = 10}}
|
2014-04-24 04:35:48 -05:00
|
|
|
|
|
|
|
// gdb-command:print tuple_internal_padding
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$3 = {x = {__0 = 11, __1 = 12}, y = {__0 = 13, __1 = 14}}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print struct_internal_padding
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$4 = {x = {__0 = 15, __1 = 16}, y = {__0 = 17, __1 = 18}}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print both_internally_padded
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$5 = {x = {__0 = 19, __1 = 20, __2 = 21}, y = {__0 = 22, __1 = 23}}
|
2014-04-24 04:35:48 -05:00
|
|
|
|
|
|
|
// gdb-command:print single_tuple
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$6 = {x = {__0 = 24, __1 = 25, __2 = 26}}
|
2014-04-24 04:35:48 -05:00
|
|
|
|
|
|
|
// gdb-command:print tuple_padded_at_end
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$7 = {x = {__0 = 27, __1 = 28}, y = {__0 = 29, __1 = 30}}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print struct_padded_at_end
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$8 = {x = {__0 = 31, __1 = 32}, y = {__0 = 33, __1 = 34}}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print both_padded_at_end
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$9 = {x = {__0 = 35, __1 = 36, __2 = 37}, y = {__0 = 38, __1 = 39}}
|
2014-04-24 04:35:48 -05:00
|
|
|
|
|
|
|
// gdb-command:print mixed_padding
|
2015-04-06 13:39:51 -05:00
|
|
|
// gdb-check:$10 = {x = {__0 = {__0 = 40, __1 = 41, __2 = 42}, __1 = {__0 = 43, __1 = 44}}, y = {__0 = 45, __1 = 46, __2 = 47, __3 = 48}}
|
2013-06-20 08:25:30 -05:00
|
|
|
|
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
|
|
|
|
2013-06-20 08:25:30 -05:00
|
|
|
struct NoPadding1 {
|
|
|
|
x: (i32, i32),
|
|
|
|
y: i32,
|
|
|
|
z: (i32, i32, i32)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NoPadding2 {
|
|
|
|
x: (i32, i32),
|
|
|
|
y: ((i32, i32), i32)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct TupleInternalPadding {
|
|
|
|
x: (i16, i32),
|
|
|
|
y: (i32, i64)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct StructInternalPadding {
|
|
|
|
x: (i16, i16),
|
|
|
|
y: (i64, i64)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct BothInternallyPadded {
|
|
|
|
x: (i16, i32, i32),
|
|
|
|
y: (i32, i64)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SingleTuple {
|
|
|
|
x: (i16, i32, i64)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct TuplePaddedAtEnd {
|
|
|
|
x: (i32, i16),
|
|
|
|
y: (i64, i32)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct StructPaddedAtEnd {
|
|
|
|
x: (i64, i64),
|
|
|
|
y: (i16, i16)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct BothPaddedAtEnd {
|
|
|
|
x: (i32, i32, i16),
|
|
|
|
y: (i64, i32)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Data-layout (padding signified by dots, one column = 2 bytes):
|
|
|
|
// [a.bbc...ddddee..ffffg.hhi...]
|
|
|
|
struct MixedPadding {
|
|
|
|
x: ((i16, i32, i16), (i64, i32)),
|
|
|
|
y: (i64, i16, i32, i16)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2013-06-20 09:45:47 -05:00
|
|
|
let no_padding1 = NoPadding1 {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (0, 1),
|
|
|
|
y: 2,
|
|
|
|
z: (3, 4, 5)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let no_padding2 = NoPadding2 {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (6, 7),
|
|
|
|
y: ((8, 9), 10)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let tuple_internal_padding = TupleInternalPadding {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (11, 12),
|
|
|
|
y: (13, 14)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let struct_internal_padding = StructInternalPadding {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (15, 16),
|
|
|
|
y: (17, 18)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let both_internally_padded = BothInternallyPadded {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (19, 20, 21),
|
|
|
|
y: (22, 23)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let single_tuple = SingleTuple {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (24, 25, 26)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let tuple_padded_at_end = TuplePaddedAtEnd {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (27, 28),
|
|
|
|
y: (29, 30)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let struct_padded_at_end = StructPaddedAtEnd {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (31, 32),
|
|
|
|
y: (33, 34)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let both_padded_at_end = BothPaddedAtEnd {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: (35, 36, 37),
|
|
|
|
y: (38, 39)
|
|
|
|
};
|
|
|
|
|
2013-06-20 09:45:47 -05:00
|
|
|
let mixed_padding = MixedPadding {
|
2013-06-20 08:25:30 -05:00
|
|
|
x: ((40, 41, 42), (43, 44)),
|
|
|
|
y: (45, 46, 47, 48)
|
|
|
|
};
|
|
|
|
|
2014-10-29 01:13:29 -05:00
|
|
|
zzz(); // #break
|
2013-06-20 08:25:30 -05:00
|
|
|
}
|
|
|
|
|
2013-08-17 10:37:42 -05:00
|
|
|
fn zzz() {()}
|