Skip to content

Commit fb3e17b

Browse files
debuginfo: Added test cases for region pointers into heap boxes for basic types.
1 parent 751f0fb commit fb3e17b

File tree

2 files changed

+230
-0
lines changed

2 files changed

+230
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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
14+
// about UTF-32 character encoding and will print a rust char as only
15+
// its numerical value.
16+
17+
// compile-flags:-Z extra-debug-info
18+
// debugger:break zzz
19+
// debugger:run
20+
// debugger:finish
21+
// debugger:print *bool_ref
22+
// check:$1 = true
23+
24+
// debugger:print *int_ref
25+
// check:$2 = -1
26+
27+
// debugger:print *char_ref
28+
// check:$3 = 97
29+
30+
// debugger:print/d *i8_ref
31+
// check:$4 = 68
32+
33+
// debugger:print *i16_ref
34+
// check:$5 = -16
35+
36+
// debugger:print *i32_ref
37+
// check:$6 = -32
38+
39+
// debugger:print *i64_ref
40+
// check:$7 = -64
41+
42+
// debugger:print *uint_ref
43+
// check:$8 = 1
44+
45+
// debugger:print/d *u8_ref
46+
// check:$9 = 100
47+
48+
// debugger:print *u16_ref
49+
// check:$10 = 16
50+
51+
// debugger:print *u32_ref
52+
// check:$11 = 32
53+
54+
// debugger:print *u64_ref
55+
// check:$12 = 64
56+
57+
// debugger:print *float_ref
58+
// check:$13 = 1.5
59+
60+
// debugger:print *f32_ref
61+
// check:$14 = 2.5
62+
63+
// debugger:print *f64_ref
64+
// check:$15 = 3.5
65+
66+
67+
fn main() {
68+
let bool_box: @bool = @true;
69+
let bool_ref : &bool = bool_box;
70+
71+
let int_box: @int = @-1;
72+
let int_ref : &int = int_box;
73+
74+
let char_box: @char = @'a';
75+
let char_ref : &char = char_box;
76+
77+
let i8_box: @i8 = @68;
78+
let i8_ref : &i8 = i8_box;
79+
80+
let i16_box: @i16 = @-16;
81+
let i16_ref : &i16 = i16_box;
82+
83+
let i32_box: @i32 = @-32;
84+
let i32_ref : &i32 = i32_box;
85+
86+
let i64_box: @i64 = @-64;
87+
let i64_ref : &i64 = i64_box;
88+
89+
let uint_box: @uint = @1;
90+
let uint_ref : &uint = uint_box;
91+
92+
let u8_box: @u8 = @100;
93+
let u8_ref : &u8 = u8_box;
94+
95+
let u16_box: @u16 = @16;
96+
let u16_ref : &u16 = u16_box;
97+
98+
let u32_box: @u32 = @32;
99+
let u32_ref : &u32 = u32_box;
100+
101+
let u64_box: @u64 = @64;
102+
let u64_ref : &u64 = u64_box;
103+
104+
let float_box: @float = @1.5;
105+
let float_ref : &float = float_box;
106+
107+
let f32_box: @f32 = @2.5;
108+
let f32_ref : &f32 = f32_box;
109+
110+
let f64_box: @f64 = @3.5;
111+
let f64_ref : &f64 = f64_box;
112+
zzz();
113+
}
114+
115+
fn zzz() {()}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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
14+
// about UTF-32 character encoding and will print a rust char as only
15+
// its numerical value.
16+
17+
// compile-flags:-Z extra-debug-info
18+
// debugger:break zzz
19+
// debugger:run
20+
// debugger:finish
21+
// debugger:print *bool_ref
22+
// check:$1 = true
23+
24+
// debugger:print *int_ref
25+
// check:$2 = -1
26+
27+
// debugger:print *char_ref
28+
// check:$3 = 97
29+
30+
// debugger:print/d *i8_ref
31+
// check:$4 = 68
32+
33+
// debugger:print *i16_ref
34+
// check:$5 = -16
35+
36+
// debugger:print *i32_ref
37+
// check:$6 = -32
38+
39+
// debugger:print *i64_ref
40+
// check:$7 = -64
41+
42+
// debugger:print *uint_ref
43+
// check:$8 = 1
44+
45+
// debugger:print/d *u8_ref
46+
// check:$9 = 100
47+
48+
// debugger:print *u16_ref
49+
// check:$10 = 16
50+
51+
// debugger:print *u32_ref
52+
// check:$11 = 32
53+
54+
// debugger:print *u64_ref
55+
// check:$12 = 64
56+
57+
// debugger:print *float_ref
58+
// check:$13 = 1.5
59+
60+
// debugger:print *f32_ref
61+
// check:$14 = 2.5
62+
63+
// debugger:print *f64_ref
64+
// check:$15 = 3.5
65+
66+
67+
fn main() {
68+
let bool_box: ~bool = ~true;
69+
let bool_ref : &bool = bool_box;
70+
71+
let int_box: ~int = ~-1;
72+
let int_ref : &int = int_box;
73+
74+
let char_box: ~char = ~'a';
75+
let char_ref : &char = char_box;
76+
77+
let i8_box: ~i8 = ~68;
78+
let i8_ref : &i8 = i8_box;
79+
80+
let i16_box: ~i16 = ~-16;
81+
let i16_ref : &i16 = i16_box;
82+
83+
let i32_box: ~i32 = ~-32;
84+
let i32_ref : &i32 = i32_box;
85+
86+
let i64_box: ~i64 = ~-64;
87+
let i64_ref : &i64 = i64_box;
88+
89+
let uint_box: ~uint = ~1;
90+
let uint_ref : &uint = uint_box;
91+
92+
let u8_box: ~u8 = ~100;
93+
let u8_ref : &u8 = u8_box;
94+
95+
let u16_box: ~u16 = ~16;
96+
let u16_ref : &u16 = u16_box;
97+
98+
let u32_box: ~u32 = ~32;
99+
let u32_ref : &u32 = u32_box;
100+
101+
let u64_box: ~u64 = ~64;
102+
let u64_ref : &u64 = u64_box;
103+
104+
let float_box: ~float = ~1.5;
105+
let float_ref : &float = float_box;
106+
107+
let f32_box: ~f32 = ~2.5;
108+
let f32_ref : &f32 = f32_box;
109+
110+
let f64_box: ~f64 = ~3.5;
111+
let f64_ref : &f64 = f64_box;
112+
zzz();
113+
}
114+
115+
fn zzz() {()}

0 commit comments

Comments
 (0)