Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 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 | |
Michael Woerister | 7a31a3e | 2013-06-28 07:35:21 | [diff] [blame] | 11 | // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 12 | // its numerical value. |
| 13 | |
| 14 | // compile-flags:-Z extra-debug-info |
Michael Woerister | 93d6328 | 2013-09-06 14:00:08 | [diff] [blame] | 15 | // debugger:rbreak zzz |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 16 | // debugger:run |
| 17 | // debugger:finish |
| 18 | // debugger:print *bool_ref |
| 19 | // check:$1 = true |
| 20 | |
| 21 | // debugger:print *int_ref |
| 22 | // check:$2 = -1 |
| 23 | |
| 24 | // debugger:print *char_ref |
| 25 | // check:$3 = 97 |
| 26 | |
| 27 | // debugger:print/d *i8_ref |
| 28 | // check:$4 = 68 |
| 29 | |
| 30 | // debugger:print *i16_ref |
| 31 | // check:$5 = -16 |
| 32 | |
| 33 | // debugger:print *i32_ref |
| 34 | // check:$6 = -32 |
| 35 | |
| 36 | // debugger:print *i64_ref |
| 37 | // check:$7 = -64 |
| 38 | |
| 39 | // debugger:print *uint_ref |
| 40 | // check:$8 = 1 |
| 41 | |
| 42 | // debugger:print/d *u8_ref |
| 43 | // check:$9 = 100 |
| 44 | |
| 45 | // debugger:print *u16_ref |
| 46 | // check:$10 = 16 |
| 47 | |
| 48 | // debugger:print *u32_ref |
| 49 | // check:$11 = 32 |
| 50 | |
| 51 | // debugger:print *u64_ref |
| 52 | // check:$12 = 64 |
| 53 | |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 54 | // debugger:print *f32_ref |
Daniel Micay | c9d4ad0 | 2013-09-26 06:26:09 | [diff] [blame] | 55 | // check:$13 = 2.5 |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 56 | |
| 57 | // debugger:print *f64_ref |
Daniel Micay | c9d4ad0 | 2013-09-26 06:26:09 | [diff] [blame] | 58 | // check:$14 = 3.5 |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 59 | |
Erick Tryzelaar | ad5c676 | 2013-08-17 15:37:42 | [diff] [blame] | 60 | #[allow(unused_variable)]; |
| 61 | |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 62 | |
| 63 | fn main() { |
| 64 | let bool_box: ~bool = ~true; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 65 | let bool_ref: &bool = bool_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 66 | |
| 67 | let int_box: ~int = ~-1; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 68 | let int_ref: &int = int_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 69 | |
| 70 | let char_box: ~char = ~'a'; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 71 | let char_ref: &char = char_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 72 | |
| 73 | let i8_box: ~i8 = ~68; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 74 | let i8_ref: &i8 = i8_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 75 | |
| 76 | let i16_box: ~i16 = ~-16; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 77 | let i16_ref: &i16 = i16_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 78 | |
| 79 | let i32_box: ~i32 = ~-32; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 80 | let i32_ref: &i32 = i32_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 81 | |
| 82 | let i64_box: ~i64 = ~-64; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 83 | let i64_ref: &i64 = i64_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 84 | |
| 85 | let uint_box: ~uint = ~1; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 86 | let uint_ref: &uint = uint_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 87 | |
| 88 | let u8_box: ~u8 = ~100; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 89 | let u8_ref: &u8 = u8_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 90 | |
| 91 | let u16_box: ~u16 = ~16; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 92 | let u16_ref: &u16 = u16_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 93 | |
| 94 | let u32_box: ~u32 = ~32; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 95 | let u32_ref: &u32 = u32_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 96 | |
| 97 | let u64_box: ~u64 = ~64; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 98 | let u64_ref: &u64 = u64_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 99 | |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 100 | let f32_box: ~f32 = ~2.5; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 101 | let f32_ref: &f32 = f32_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 102 | |
| 103 | let f64_box: ~f64 = ~3.5; |
Michael Woerister | b2aeb4b | 2013-07-16 10:17:55 | [diff] [blame] | 104 | let f64_ref: &f64 = f64_box; |
Michael Woerister | fb3e17b | 2013-06-24 15:47:21 | [diff] [blame] | 105 | zzz(); |
| 106 | } |
| 107 | |
Erick Tryzelaar | ad5c676 | 2013-08-17 15:37:42 | [diff] [blame] | 108 | fn zzz() {()} |