]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/borrowed-struct.rs
Merge tag 'upstream-tar/1.0.0_0alpha'
[rustc.git] / src / test / debuginfo / borrowed-struct.rs
1 // Copyright 2013-2014 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 // ignore-android: FIXME(#10381)
12 // compile-flags:-g
13 // min-lldb-version: 310
14
15 // === GDB TESTS ===================================================================================
16
17 // gdb-command:run
18
19 // gdb-command:print *stack_val_ref
20 // gdb-check:$1 = {x = 10, y = 23.5}
21
22 // gdb-command:print *stack_val_interior_ref_1
23 // gdb-check:$2 = 10
24
25 // gdb-command:print *stack_val_interior_ref_2
26 // gdb-check:$3 = 23.5
27
28 // gdb-command:print *ref_to_unnamed
29 // gdb-check:$4 = {x = 11, y = 24.5}
30
31 // gdb-command:print *unique_val_ref
32 // gdb-check:$5 = {x = 13, y = 26.5}
33
34 // gdb-command:print *unique_val_interior_ref_1
35 // gdb-check:$6 = 13
36
37 // gdb-command:print *unique_val_interior_ref_2
38 // gdb-check:$7 = 26.5
39
40
41 // === LLDB TESTS ==================================================================================
42
43 // lldb-command:run
44
45 // lldb-command:print *stack_val_ref
46 // lldb-check:[...]$0 = SomeStruct { x: 10, y: 23.5 }
47
48 // lldb-command:print *stack_val_interior_ref_1
49 // lldb-check:[...]$1 = 10
50
51 // lldb-command:print *stack_val_interior_ref_2
52 // lldb-check:[...]$2 = 23.5
53
54 // lldb-command:print *ref_to_unnamed
55 // lldb-check:[...]$3 = SomeStruct { x: 11, y: 24.5 }
56
57 // lldb-command:print *unique_val_ref
58 // lldb-check:[...]$4 = SomeStruct { x: 13, y: 26.5 }
59
60 // lldb-command:print *unique_val_interior_ref_1
61 // lldb-check:[...]$5 = 13
62
63 // lldb-command:print *unique_val_interior_ref_2
64 // lldb-check:[...]$6 = 26.5
65
66 #![allow(unused_variables)]
67 #![feature(box_syntax)]
68 #![omit_gdb_pretty_printer_section]
69
70 struct SomeStruct {
71 x: int,
72 y: f64
73 }
74
75 fn main() {
76 let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
77 let stack_val_ref: &SomeStruct = &stack_val;
78 let stack_val_interior_ref_1: &int = &stack_val.x;
79 let stack_val_interior_ref_2: &f64 = &stack_val.y;
80 let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
81
82 let unique_val = box SomeStruct { x: 13, y: 26.5 };
83 let unique_val_ref: &SomeStruct = &*unique_val;
84 let unique_val_interior_ref_1: &int = &unique_val.x;
85 let unique_val_interior_ref_2: &f64 = &unique_val.y;
86
87 zzz(); // #break
88 }
89
90 fn zzz() {()}