]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/basic-types.rs
Rollup merge of #55469 - pnkfelix:issue-54477-regression-tests, r=nikomatsakis
[rust.git] / src / test / debuginfo / basic-types.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 // Caveats - gdb prints any 8-bit value (meaning rust i8 and u8 values)
12 // as its numerical value along with its associated ASCII char, there
13 // doesn't seem to be any way around this. Also, gdb doesn't know
14 // about UTF-32 character encoding and will print a rust char as only
15 // its numerical value.
16
17 // min-lldb-version: 310
18
19 // This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only
20 // for now.
21 // only-macos
22
23 // compile-flags:-g
24
25 // === GDB TESTS ===================================================================================
26
27 // gdb-command:run
28 // gdb-command:print b
29 // gdb-check:$1 = false
30 // gdb-command:print i
31 // gdb-check:$2 = -1
32 // gdb-command:print c
33 // gdbg-check:$3 = 97
34 // gdbr-check:$3 = 97 'a'
35 // gdb-command:print/d i8
36 // gdb-check:$4 = 68
37 // gdb-command:print i16
38 // gdb-check:$5 = -16
39 // gdb-command:print i32
40 // gdb-check:$6 = -32
41 // gdb-command:print i64
42 // gdb-check:$7 = -64
43 // gdb-command:print u
44 // gdb-check:$8 = 1
45 // gdb-command:print/d u8
46 // gdb-check:$9 = 100
47 // gdb-command:print u16
48 // gdb-check:$10 = 16
49 // gdb-command:print u32
50 // gdb-check:$11 = 32
51 // gdb-command:print u64
52 // gdb-check:$12 = 64
53 // gdb-command:print f32
54 // gdb-check:$13 = 2.5
55 // gdb-command:print f64
56 // gdb-check:$14 = 3.5
57
58
59 // === LLDB TESTS ==================================================================================
60
61 // lldb-command:run
62 // lldb-command:print b
63 // lldbg-check:[...]$0 = false
64 // lldbr-check:(bool) b = false
65 // lldb-command:print i
66 // lldbg-check:[...]$1 = -1
67 // lldbr-check:(isize) i = -1
68
69 // NOTE: only rust-enabled lldb supports 32bit chars
70 // lldbr-command:print c
71 // lldbr-check:(char) c = 'a'
72
73 // lldb-command:print i8
74 // lldbg-check:[...]$2 = 'D'
75 // lldbr-check:(i8) i8 = 68
76 // lldb-command:print i16
77 // lldbg-check:[...]$3 = -16
78 // lldbr-check:(i16) i16 = -16
79 // lldb-command:print i32
80 // lldbg-check:[...]$4 = -32
81 // lldbr-check:(i32) i32 = -32
82 // lldb-command:print i64
83 // lldbg-check:[...]$5 = -64
84 // lldbr-check:(i64) i64 = -64
85 // lldb-command:print u
86 // lldbg-check:[...]$6 = 1
87 // lldbr-check:(usize) u = 1
88 // lldb-command:print u8
89 // lldbg-check:[...]$7 = 'd'
90 // lldbr-check:(u8) u8 = 100
91 // lldb-command:print u16
92 // lldbg-check:[...]$8 = 16
93 // lldbr-check:(u16) u16 = 16
94 // lldb-command:print u32
95 // lldbg-check:[...]$9 = 32
96 // lldbr-check:(u32) u32 = 32
97 // lldb-command:print u64
98 // lldbg-check:[...]$10 = 64
99 // lldbr-check:(u64) u64 = 64
100 // lldb-command:print f32
101 // lldbg-check:[...]$11 = 2.5
102 // lldbr-check:(f32) f32 = 2.5
103 // lldb-command:print f64
104 // lldbg-check:[...]$12 = 3.5
105 // lldbr-check:(f64) f64 = 3.5
106
107 #![allow(unused_variables)]
108 #![feature(omit_gdb_pretty_printer_section)]
109 #![omit_gdb_pretty_printer_section]
110
111 fn main() {
112     let b: bool = false;
113     let i: isize = -1;
114     let c: char = 'a';
115     let i8: i8 = 68;
116     let i16: i16 = -16;
117     let i32: i32 = -32;
118     let i64: i64 = -64;
119     let u: usize = 1;
120     let u8: u8 = 100;
121     let u16: u16 = 16;
122     let u32: u32 = 32;
123     let u64: u64 = 64;
124     let f32: f32 = 2.5;
125     let f64: f64 = 3.5;
126     _zzz(); // #break
127 }
128
129 fn _zzz() {()}