]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/boxed-struct.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / boxed-struct.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6
7 // gdb-command:run
8
9 // gdb-command:print *boxed_with_padding
10 // gdbg-check:$1 = {x = 99, y = 999, z = 9999, w = 99999}
11 // gdbr-check:$1 = boxed_struct::StructWithSomePadding {x: 99, y: 999, z: 9999, w: 99999}
12
13 // gdb-command:print *boxed_with_dtor
14 // gdbg-check:$2 = {x = 77, y = 777, z = 7777, w = 77777}
15 // gdbr-check:$2 = boxed_struct::StructWithDestructor {x: 77, y: 777, z: 7777, w: 77777}
16
17
18 // === LLDB TESTS ==================================================================================
19
20 // lldb-command:run
21
22 // lldb-command:print *boxed_with_padding
23 // lldbg-check:[...]$0 = { x = 99 y = 999 z = 9999 w = 99999 }
24 // lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = { x = 99 y = 999 z = 9999 w = 99999 }
25
26 // lldb-command:print *boxed_with_dtor
27 // lldbg-check:[...]$1 = { x = 77 y = 777 z = 7777 w = 77777 }
28 // lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 }
29
30 #![allow(unused_variables)]
31 #![feature(omit_gdb_pretty_printer_section)]
32 #![omit_gdb_pretty_printer_section]
33
34 struct StructWithSomePadding {
35     x: i16,
36     y: i32,
37     z: i32,
38     w: i64
39 }
40
41 struct StructWithDestructor {
42     x: i16,
43     y: i32,
44     z: i32,
45     w: i64
46 }
47
48 impl Drop for StructWithDestructor {
49     fn drop(&mut self) {}
50 }
51
52 fn main() {
53
54     let boxed_with_padding: Box<_> = Box::new(StructWithSomePadding {
55         x: 99,
56         y: 999,
57         z: 9999,
58         w: 99999,
59     });
60
61     let boxed_with_dtor: Box<_> = Box::new(StructWithDestructor {
62         x: 77,
63         y: 777,
64         z: 7777,
65         w: 77777,
66     });
67     zzz(); // #break
68 }
69
70 fn zzz() { () }