]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/union-smoke.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / union-smoke.rs
1 // min-lldb-version: 310
2 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
3
4 // ignore-gdb-version: 7.11.90 - 7.12.9
5
6 // compile-flags:-g
7
8 // === GDB TESTS ===================================================================================
9
10 // gdb-command:run
11 // gdb-command:print u
12 // gdbg-check:$1 = {a = {__0 = 2 '\002', __1 = 2 '\002'}, b = 514}
13 // gdbr-check:$1 = union_smoke::U {a: (2, 2), b: 514}
14 // gdb-command:print union_smoke::SU
15 // gdbg-check:$2 = {a = {__0 = 1 '\001', __1 = 1 '\001'}, b = 257}
16 // gdbr-check:$2 = union_smoke::U {a: (1, 1), b: 257}
17
18 // === LLDB TESTS ==================================================================================
19
20 // lldb-command:run
21 // lldb-command:print u
22 // lldbg-check:[...]$0 = { a = { 0 = '\x02' 1 = '\x02' } b = 514 }
23 // lldbr-check:(union_smoke::U) u = { a = { 0 = '\x02' 1 = '\x02' } b = 514 }
24
25 // Don't test this with rust-enabled lldb for now; see
26 // https://github.com/rust-lang-nursery/lldb/issues/18
27 // lldbg-command:print union_smoke::SU
28 // lldbg-check:[...]$1 = { a = { 0 = '\x01' 1 = '\x01' } b = 257 }
29
30 #![allow(unused)]
31 #![feature(omit_gdb_pretty_printer_section)]
32 #![omit_gdb_pretty_printer_section]
33
34 union U {
35     a: (u8, u8),
36     b: u16,
37 }
38
39 static mut SU: U = U { a: (1, 1) };
40
41 fn main() {
42     let u = U { b: (2 << 8) + 2 };
43     unsafe { SU = U { a: (1, 1) } }
44
45     zzz(); // #break
46 }
47
48 fn zzz() {()}