Skip to content

Commit 751f0fb

Browse files
debuginfo: Added test case for region pointers pointing to stack values with basic type.
1 parent 6af7861 commit 751f0fb

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
// Caveats - gdb prints any 8-bit value (meaning rust i8 and u8 values)
14+
// as its numerical value along with its associated ASCII char, there
15+
// doesn't seem to be any way around this. Also, gdb doesn't know
16+
// about UTF-32 character encoding and will print a rust char as only
17+
// its numerical value.
18+
19+
// compile-flags:-Z extra-debug-info
20+
// debugger:break zzz
21+
// debugger:run
22+
// debugger:finish
23+
// debugger:print *bool_ref
24+
// check:$1 = true
25+
26+
// debugger:print *int_ref
27+
// check:$2 = -1
28+
29+
// debugger:print *char_ref
30+
// check:$3 = 97
31+
32+
// debugger:print *i8_ref
33+
// check:$4 = 68 'D'
34+
35+
// debugger:print *i16_ref
36+
// check:$5 = -16
37+
38+
// debugger:print *i32_ref
39+
// check:$6 = -32
40+
41+
// debugger:print *i64_ref
42+
// check:$7 = -64
43+
44+
// debugger:print *uint_ref
45+
// check:$8 = 1
46+
47+
// debugger:print *u8_ref
48+
// check:$9 = 100 'd'
49+
50+
// debugger:print *u16_ref
51+
// check:$10 = 16
52+
53+
// debugger:print *u32_ref
54+
// check:$11 = 32
55+
56+
// debugger:print *u64_ref
57+
// check:$12 = 64
58+
59+
// debugger:print *float_ref
60+
// check:$13 = 1.5
61+
62+
// debugger:print *f32_ref
63+
// check:$14 = 2.5
64+
65+
// debugger:print *f64_ref
66+
// check:$15 = 3.5
67+
68+
fn main() {
69+
let bool_val: bool = true;
70+
let bool_ref : &bool = &bool_val;
71+
72+
let int_val: int = -1;
73+
let int_ref : &int = &int_val;
74+
75+
let char_val: char = 'a';
76+
let char_ref : &char = &char_val;
77+
78+
let i8_val: i8 = 68;
79+
let i8_ref : &i8 = &i8_val;
80+
81+
let i16_val: i16 = -16;
82+
let i16_ref : &i16 = &i16_val;
83+
84+
let i32_val: i32 = -32;
85+
let i32_ref : &i32 = &i32_val;
86+
87+
let uint_val: i64 = -64;
88+
let i64_ref : &i64 = &uint_val;
89+
90+
let uint_val: uint = 1;
91+
let uint_ref : &uint = &uint_val;
92+
93+
let u8_val: u8 = 100;
94+
let u8_ref : &u8 = &u8_val;
95+
96+
let u16_val: u16 = 16;
97+
let u16_ref : &u16 = &u16_val;
98+
99+
let u32_val: u32 = 32;
100+
let u32_ref : &u32 = &u32_val;
101+
102+
let u64_val: u64 = 64;
103+
let u64_ref : &u64 = &u64_val;
104+
105+
let float_val: float = 1.5;
106+
let float_ref : &float = &float_val;
107+
108+
let f32_val: f32 = 2.5;
109+
let f32_ref : &f32 = &f32_val;
110+
111+
let f64_val: f64 = 3.5;
112+
let f64_ref : &f64 = &f64_val;
113+
zzz();
114+
}
115+
116+
fn zzz() {()}

0 commit comments

Comments
 (0)