]> git.proxmox.com Git - rustc.git/blame - src/test/debuginfo/basic-types.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / debuginfo / basic-types.rs
CommitLineData
1a4d82fc
JJ
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
1a4d82fc
JJ
7// min-lldb-version: 310
8
136023e0
XL
9// This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now.
10// ignore-linux
a1dfa0c6 11
94222f64
XL
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
1a4d82fc
JJ
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
c30ab7b3
SL
26// gdbg-check:$3 = 97
27// gdbr-check:$3 = 97 'a'
1a4d82fc
JJ
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
136023e0
XL
50// gdb-command:print s
51// gdbg-check:$15 = {data_ptr = [...] "Hello, World!", length = 13}
52// gdbr-check:$15 = "Hello, World!"
1a4d82fc
JJ
53
54
55// === LLDB TESTS ==================================================================================
56
57// lldb-command:run
58// lldb-command:print b
0bf4aa26
XL
59// lldbg-check:[...]$0 = false
60// lldbr-check:(bool) b = false
1a4d82fc 61// lldb-command:print i
0bf4aa26
XL
62// lldbg-check:[...]$1 = -1
63// lldbr-check:(isize) i = -1
1a4d82fc 64
0bf4aa26
XL
65// NOTE: only rust-enabled lldb supports 32bit chars
66// lldbr-command:print c
67// lldbr-check:(char) c = 'a'
1a4d82fc
JJ
68
69// lldb-command:print i8
0bf4aa26
XL
70// lldbg-check:[...]$2 = 'D'
71// lldbr-check:(i8) i8 = 68
1a4d82fc 72// lldb-command:print i16
0bf4aa26
XL
73// lldbg-check:[...]$3 = -16
74// lldbr-check:(i16) i16 = -16
1a4d82fc 75// lldb-command:print i32
0bf4aa26
XL
76// lldbg-check:[...]$4 = -32
77// lldbr-check:(i32) i32 = -32
1a4d82fc 78// lldb-command:print i64
0bf4aa26
XL
79// lldbg-check:[...]$5 = -64
80// lldbr-check:(i64) i64 = -64
1a4d82fc 81// lldb-command:print u
0bf4aa26
XL
82// lldbg-check:[...]$6 = 1
83// lldbr-check:(usize) u = 1
1a4d82fc 84// lldb-command:print u8
0bf4aa26
XL
85// lldbg-check:[...]$7 = 'd'
86// lldbr-check:(u8) u8 = 100
1a4d82fc 87// lldb-command:print u16
0bf4aa26
XL
88// lldbg-check:[...]$8 = 16
89// lldbr-check:(u16) u16 = 16
1a4d82fc 90// lldb-command:print u32
0bf4aa26
XL
91// lldbg-check:[...]$9 = 32
92// lldbr-check:(u32) u32 = 32
1a4d82fc 93// lldb-command:print u64
0bf4aa26
XL
94// lldbg-check:[...]$10 = 64
95// lldbr-check:(u64) u64 = 64
1a4d82fc 96// lldb-command:print f32
0bf4aa26
XL
97// lldbg-check:[...]$11 = 2.5
98// lldbr-check:(f32) f32 = 2.5
1a4d82fc 99// lldb-command:print f64
0bf4aa26
XL
100// lldbg-check:[...]$12 = 3.5
101// lldbr-check:(f64) f64 = 3.5
1a4d82fc 102
136023e0
XL
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
1a4d82fc 138#![allow(unused_variables)]
b039eaaf 139#![feature(omit_gdb_pretty_printer_section)]
1a4d82fc
JJ
140#![omit_gdb_pretty_printer_section]
141
142fn main() {
143 let b: bool = false;
c34b1796 144 let i: isize = -1;
1a4d82fc
JJ
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;
c34b1796 150 let u: usize = 1;
1a4d82fc
JJ
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;
136023e0 157 let s: &str = "Hello, World!";
1a4d82fc
JJ
158 _zzz(); // #break
159}
160
161fn _zzz() {()}