]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/basic-types.rs
Merge commit '61667dedf55e3e5aa584f7ae2bd0471336b92ce9' into sync_cg_clif-2021-09-19
[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 ignore Linux for now.
10 // ignore-linux
11
12 // This started failing in windows too. See https://github.com/rust-lang/rust/issues/88796
13 // FIXME: fix and unignore this on windows
14 // ignore-windows
15
16 // compile-flags:-g
17
18 // === GDB TESTS ===================================================================================
19
20 // gdb-command:run
21 // gdb-command:print b
22 // gdb-check:$1 = false
23 // gdb-command:print i
24 // gdb-check:$2 = -1
25 // gdb-command:print c
26 // gdbg-check:$3 = 97
27 // gdbr-check:$3 = 97 'a'
28 // gdb-command:print/d i8
29 // gdb-check:$4 = 68
30 // gdb-command:print i16
31 // gdb-check:$5 = -16
32 // gdb-command:print i32
33 // gdb-check:$6 = -32
34 // gdb-command:print i64
35 // gdb-check:$7 = -64
36 // gdb-command:print u
37 // gdb-check:$8 = 1
38 // gdb-command:print/d u8
39 // gdb-check:$9 = 100
40 // gdb-command:print u16
41 // gdb-check:$10 = 16
42 // gdb-command:print u32
43 // gdb-check:$11 = 32
44 // gdb-command:print u64
45 // gdb-check:$12 = 64
46 // gdb-command:print f32
47 // gdb-check:$13 = 2.5
48 // gdb-command:print f64
49 // gdb-check:$14 = 3.5
50 // gdb-command:print s
51 // gdbg-check:$15 = {data_ptr = [...] "Hello, World!", length = 13}
52 // gdbr-check:$15 = "Hello, World!"
53
54
55 // === LLDB TESTS ==================================================================================
56
57 // lldb-command:run
58 // lldb-command:print b
59 // lldbg-check:[...]$0 = false
60 // lldbr-check:(bool) b = false
61 // lldb-command:print i
62 // lldbg-check:[...]$1 = -1
63 // lldbr-check:(isize) i = -1
64
65 // NOTE: only rust-enabled lldb supports 32bit chars
66 // lldbr-command:print c
67 // lldbr-check:(char) c = 'a'
68
69 // lldb-command:print i8
70 // lldbg-check:[...]$2 = 'D'
71 // lldbr-check:(i8) i8 = 68
72 // lldb-command:print i16
73 // lldbg-check:[...]$3 = -16
74 // lldbr-check:(i16) i16 = -16
75 // lldb-command:print i32
76 // lldbg-check:[...]$4 = -32
77 // lldbr-check:(i32) i32 = -32
78 // lldb-command:print i64
79 // lldbg-check:[...]$5 = -64
80 // lldbr-check:(i64) i64 = -64
81 // lldb-command:print u
82 // lldbg-check:[...]$6 = 1
83 // lldbr-check:(usize) u = 1
84 // lldb-command:print u8
85 // lldbg-check:[...]$7 = 'd'
86 // lldbr-check:(u8) u8 = 100
87 // lldb-command:print u16
88 // lldbg-check:[...]$8 = 16
89 // lldbr-check:(u16) u16 = 16
90 // lldb-command:print u32
91 // lldbg-check:[...]$9 = 32
92 // lldbr-check:(u32) u32 = 32
93 // lldb-command:print u64
94 // lldbg-check:[...]$10 = 64
95 // lldbr-check:(u64) u64 = 64
96 // lldb-command:print f32
97 // lldbg-check:[...]$11 = 2.5
98 // lldbr-check:(f32) f32 = 2.5
99 // lldb-command:print f64
100 // lldbg-check:[...]$12 = 3.5
101 // lldbr-check:(f64) f64 = 3.5
102
103
104 // === CDB TESTS ===================================================================================
105
106 // cdb-command:g
107 // cdb-command:dx b
108 // cdb-check:b                : false [Type: bool]
109 // cdb-command:dx i
110 // cdb-check:i                : -1 [Type: [...]]
111 // The variable 'c' doesn't appear for some reason...
112 // cdb-command:dx i8
113 // cdb-check:i8               : 68 [Type: char]
114 // cdb-command:dx i16
115 // cdb-check:i16              : -16 [Type: short]
116 // cdb-command:dx i32
117 // cdb-check:i32              : -32 [Type: int]
118 // cdb-command:dx i64
119 // cdb-check:i64              : -64 [Type: __int64]
120 // cdb-command:dx u
121 // cdb-check:u                : 0x1 [Type: [...]]
122 // cdb-command:dx u8
123 // cdb-check:u8               : 0x64 [Type: unsigned char]
124 // cdb-command:dx u16
125 // cdb-check:u16              : 0x10 [Type: unsigned short]
126 // cdb-command:dx u32
127 // cdb-check:u32              : 0x20 [Type: unsigned int]
128 // cdb-command:dx u64
129 // cdb-check:u64              : 0x40 [Type: unsigned __int64]
130 // cdb-command:dx f32
131 // cdb-check:f32              : 2.500000 [Type: float]
132 // cdb-command:dx f64
133 // cdb-check:f64              : 3.500000 [Type: double]
134 // cdb-command:.enable_unicode 1
135 // cdb-command:dx  s
136 // cdb-check:s                : "Hello, World!" [Type: str]
137
138 #![allow(unused_variables)]
139 #![feature(omit_gdb_pretty_printer_section)]
140 #![omit_gdb_pretty_printer_section]
141
142 fn main() {
143     let b: bool = false;
144     let i: isize = -1;
145     let c: char = 'a';
146     let i8: i8 = 68;
147     let i16: i16 = -16;
148     let i32: i32 = -32;
149     let i64: i64 = -64;
150     let u: usize = 1;
151     let u8: u8 = 100;
152     let u16: u16 = 16;
153     let u32: u32 = 32;
154     let u64: u64 = 64;
155     let f32: f32 = 2.5;
156     let f64: f64 = 3.5;
157     let s: &str = "Hello, World!";
158     _zzz(); // #break
159 }
160
161 fn _zzz() {()}