Skip to content

Commit 9102ad0

Browse files
debuginfo: Added more tests for region pointers (tuples, structs).
1 parent 6a30941 commit 9102ad0

File tree

2 files changed

+125
-0
lines changed

2 files changed

+125
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright 2013 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+
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
12+
13+
// GDB doesn't know about UTF-32 character encoding and will print a rust char as only its numerical
14+
// value.
15+
16+
// compile-flags:-Z extra-debug-info
17+
// debugger:break zzz
18+
// debugger:run
19+
// debugger:finish
20+
21+
// debugger:print *stack_val_ref
22+
// check:$1 = {x = 10, y = 23.5}
23+
24+
// debugger:print *stack_val_interior_ref_1
25+
// check:$2 = 10
26+
27+
// debugger:print *stack_val_interior_ref_2
28+
// check:$3 = 23.5
29+
30+
// debugger:print *ref_to_unnamed
31+
// check:$4 = {x = 11, y = 24.5}
32+
33+
// debugger:print *managed_val_ref
34+
// check:$5 = {x = 12, y = 25.5}
35+
36+
// debugger:print *managed_val_interior_ref_1
37+
// check:$6 = 12
38+
39+
// debugger:print *managed_val_interior_ref_2
40+
// check:$7 = 25.5
41+
42+
// debugger:print *unique_val_ref
43+
// check:$8 = {x = 13, y = 26.5}
44+
45+
// debugger:print *unique_val_interior_ref_1
46+
// check:$9 = 13
47+
48+
// debugger:print *unique_val_interior_ref_2
49+
// check:$10 = 26.5
50+
51+
52+
53+
struct SomeStruct {
54+
x: int,
55+
y: f64
56+
}
57+
58+
fn main() {
59+
let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
60+
let stack_val_ref : &SomeStruct = &stack_val;
61+
let stack_val_interior_ref_1 : &int = &stack_val.x;
62+
let stack_val_interior_ref_2 : &f64 = &stack_val.y;
63+
let ref_to_unnamed : &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
64+
65+
let managed_val = @SomeStruct { x: 12, y: 25.5 };
66+
let managed_val_ref : &SomeStruct = managed_val;
67+
let managed_val_interior_ref_1 : &int = &managed_val.x;
68+
let managed_val_interior_ref_2 : &f64 = &managed_val.y;
69+
70+
let unique_val = ~SomeStruct { x: 13, y: 26.5 };
71+
let unique_val_ref : &SomeStruct = unique_val;
72+
let unique_val_interior_ref_1 : &int = &unique_val.x;
73+
let unique_val_interior_ref_2 : &f64 = &unique_val.y;
74+
75+
zzz();
76+
}
77+
78+
fn zzz() {()}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2013 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+
// xfail-win32 Broken because of LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=16249
12+
13+
// GDB doesn't know about UTF-32 character encoding and will print a rust char as only its numerical
14+
// value.
15+
16+
// compile-flags:-Z extra-debug-info
17+
// debugger:break zzz
18+
// debugger:run
19+
// debugger:finish
20+
21+
// debugger:print *stack_val_ref
22+
// check:$1 = {-14, -19}
23+
24+
// debugger:print *ref_to_unnamed
25+
// check:$2 = {-15, -20}
26+
27+
// debugger:print *managed_val_ref
28+
// check:$3 = {-16, -21}
29+
30+
// debugger:print *unique_val_ref
31+
// check:$4 = {-17, -22}
32+
33+
fn main() {
34+
let stack_val: (i16, f32) = (-14, -19f32);
35+
let stack_val_ref : &(i16, f32) = &stack_val;
36+
let ref_to_unnamed : &(i16, f32) = &(-15, -20f32);
37+
38+
let managed_val : @(i16, f32) = @(-16, -21f32);
39+
let managed_val_ref : &(i16, f32) = managed_val;
40+
41+
let unique_val: ~(i16, f32) = ~(-17, -22f32);
42+
let unique_val_ref : &(i16, f32) = unique_val;
43+
44+
zzz();
45+
}
46+
47+
fn zzz() {()}

0 commit comments

Comments
 (0)