2016-08-22 21:11:22 +03:00
|
|
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
// min-lldb-version: 310
|
2016-12-20 19:34:57 -08:00
|
|
|
// ignore-macos FIXME(#37479)
|
2016-08-22 21:11:22 +03:00
|
|
|
|
|
|
|
// compile-flags:-g
|
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// gdb-command:run
|
|
|
|
// gdb-command:print u
|
2016-10-25 23:32:04 +02:00
|
|
|
// gdbg-check:$1 = {a = {__0 = 2 '\002', __1 = 2 '\002'}, b = 514}
|
|
|
|
// gdbr-check:$1 = union_smoke::U {a: (2, 2), b: 514}
|
2016-08-22 21:11:22 +03:00
|
|
|
// gdb-command:print union_smoke::SU
|
2016-10-25 23:32:04 +02:00
|
|
|
// gdbg-check:$2 = {a = {__0 = 1 '\001', __1 = 1 '\001'}, b = 257}
|
|
|
|
// gdbr-check:$2 = union_smoke::U {a: (1, 1), b: 257}
|
2016-08-22 21:11:22 +03:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
2016-08-26 19:23:42 +03:00
|
|
|
// lldb-command:print u
|
|
|
|
// lldb-check:[...]$0 = { a = ('\x02', '\x02') b = 514 }
|
2016-08-22 21:11:22 +03:00
|
|
|
// lldb-command:print union_smoke::SU
|
2016-08-26 19:23:42 +03:00
|
|
|
// lldb-check:[...]$1 = 257
|
2016-08-22 21:11:22 +03:00
|
|
|
|
|
|
|
#![allow(unused)]
|
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
|
|
|
#![omit_gdb_pretty_printer_section]
|
|
|
|
#![feature(untagged_unions)]
|
|
|
|
|
|
|
|
union U {
|
2016-08-26 19:23:42 +03:00
|
|
|
a: (u8, u8),
|
|
|
|
b: u16,
|
2016-08-22 21:11:22 +03:00
|
|
|
}
|
|
|
|
|
2016-08-26 19:23:42 +03:00
|
|
|
static mut SU: U = U { a: (1, 1) };
|
2016-08-22 21:11:22 +03:00
|
|
|
|
|
|
|
fn main() {
|
2016-08-26 19:23:42 +03:00
|
|
|
let u = U { b: (2 << 8) + 2 };
|
|
|
|
unsafe { SU = U { a: (1, 1) } }
|
2016-08-22 21:11:22 +03:00
|
|
|
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn zzz() {()}
|