File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ //@ compile-flags: -g -Copt-level=3
2
+
3
+ // Checks that we still can access dead variables from debuginfos.
4
+
5
+ // === GDB TESTS ===================================================================================
6
+
7
+ // gdb-command:run
8
+ // gdb-command:print *ref_v0
9
+ // gdb-check:$1 = 0
10
+
11
+ // gdb-command:print *ref_v1
12
+ // gdb-check:$2 = 1
13
+
14
+ // gdb-command:print *ref_v2
15
+ // gdb-check:$3 = 2
16
+
17
+ // === LLDB TESTS ==================================================================================
18
+
19
+ // lldb-command:run
20
+ // lldb-command:v *ref_v0
21
+ // lldb-check:[...] 0
22
+
23
+ // lldb-command:v *ref_v1
24
+ // lldb-check:[...] 1
25
+
26
+ // lldb-command:v *ref_v2
27
+ // lldb-check:[...] 2
28
+
29
+ #![ allow( unused_variables) ]
30
+ #![ feature( omit_gdb_pretty_printer_section) ]
31
+ #![ omit_gdb_pretty_printer_section]
32
+
33
+ use std:: hint:: black_box;
34
+
35
+ pub struct Foo ( i32 , i64 , i32 ) ;
36
+
37
+ #[ inline( never) ]
38
+ #[ no_mangle]
39
+ fn test_ref ( ref_foo : & Foo ) -> i32 {
40
+ let ref_v0 = & ref_foo. 0 ;
41
+ let ref_v1 = & ref_foo. 1 ;
42
+ let ref_v2 = & ref_foo. 2 ;
43
+ ref_foo. 0 // #break
44
+ }
45
+
46
+ fn main ( ) {
47
+ let foo = black_box ( Foo ( 0 , 1 , 2 ) ) ;
48
+ black_box ( test_ref ( & foo) ) ;
49
+ }
You can’t perform that action at this time.
0 commit comments