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