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