]> git.proxmox.com Git - rustc.git/blame - src/test/debuginfo/union-smoke.rs
New upstream version 1.25.0+dfsg1
[rustc.git] / src / test / debuginfo / union-smoke.rs
CommitLineData
9e0c209e
SL
1// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11// min-lldb-version: 310
2c00a5a8
XL
12// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
13
8bb4bdeb 14// ignore-gdb-version: 7.11.90 - 7.12.9
9e0c209e
SL
15
16// compile-flags:-g
17
18// === GDB TESTS ===================================================================================
19
20// gdb-command:run
21// gdb-command:print u
c30ab7b3
SL
22// gdbg-check:$1 = {a = {__0 = 2 '\002', __1 = 2 '\002'}, b = 514}
23// gdbr-check:$1 = union_smoke::U {a: (2, 2), b: 514}
9e0c209e 24// gdb-command:print union_smoke::SU
c30ab7b3
SL
25// gdbg-check:$2 = {a = {__0 = 1 '\001', __1 = 1 '\001'}, b = 257}
26// gdbr-check:$2 = union_smoke::U {a: (1, 1), b: 257}
9e0c209e
SL
27
28// === LLDB TESTS ==================================================================================
29
30// lldb-command:run
31// lldb-command:print u
32a655c1 32// lldb-check:[...]$0 = U { a: ('\x02', '\x02'), b: 514 }
9e0c209e 33// lldb-command:print union_smoke::SU
32a655c1 34// lldb-check:[...]$1 = U { a: ('\x01', '\x01'), b: 257 }
9e0c209e
SL
35
36#![allow(unused)]
37#![feature(omit_gdb_pretty_printer_section)]
38#![omit_gdb_pretty_printer_section]
9e0c209e
SL
39
40union U {
41 a: (u8, u8),
42 b: u16,
43}
44
45static mut SU: U = U { a: (1, 1) };
46
47fn main() {
48 let u = U { b: (2 << 8) + 2 };
49 unsafe { SU = U { a: (1, 1) } }
50
51 zzz(); // #break
52}
53
54fn zzz() {()}