about summary refs log tree commit diff
path: root/tests/debuginfo/union-smoke.rs
blob: bd253794bd852dc64bee14eaf83c3fc1e239c8a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//@ compile-flags:-g
//@ disable-gdb-pretty-printers

// === GDB TESTS ===================================================================================

// gdb-command:run
// gdb-command:print u
// gdb-check:$1 = union_smoke::U {a: (2, 2), b: 514}
// gdb-command:print union_smoke::SU
// gdb-check:$2 = union_smoke::U {a: (1, 1), b: 257}

// === LLDB TESTS ==================================================================================

// lldb-command:run
// lldb-command:v u
// lldb-check:[...] { a = { 0 = '\x02' 1 = '\x02' } b = 514 }

// lldb-command:print union_smoke::SU
// lldb-check:[...] { a = { 0 = '\x01' 1 = '\x01' } b = 257 }

#![allow(unused)]

union U {
    a: (u8, u8),
    b: u16,
}

static mut SU: U = U { a: (1, 1) };

fn main() {
    let u = U { b: (2 << 8) + 2 };
    unsafe { SU = U { a: (1, 1) } }

    zzz(); // #break
}

fn zzz() {()}