]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/pretty-std.rs
Auto merge of #82552 - GuillaumeGomez:rollup-8dn1ztn, r=GuillaumeGomez
[rust.git] / src / test / debuginfo / pretty-std.rs
1 // ignore-freebsd: gdb package too new
2 // only-cdb // "Temporarily" ignored on GDB/LLDB due to debuginfo tests being disabled, see PR 47155
3 // ignore-android: FIXME(#10381)
4 // compile-flags:-g
5 // min-gdb-version: 7.7
6 // min-lldb-version: 310
7
8 // === GDB TESTS ===================================================================================
9
10 // gdb-command: run
11
12 // gdb-command: print slice
13 // gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
14
15 // gdb-command: print vec
16 // gdb-check:$2 = Vec<u64, alloc::alloc::Global>(len: 4, cap: [...]) = {4, 5, 6, 7}
17
18 // gdb-command: print str_slice
19 // gdb-check:$3 = "IAMA string slice!"
20
21 // gdb-command: print string
22 // gdb-check:$4 = "IAMA string!"
23
24 // gdb-command: print some
25 // gdb-check:$5 = Some = {8}
26
27 // gdb-command: print none
28 // gdbg-check:$6 = None
29 // gdbr-check:$6 = core::option::Option::None
30
31 // gdb-command: print os_string
32 // gdb-check:$7 = "IAMA OS string ðŸ˜ƒ"
33
34 // gdb-command: print some_string
35 // gdb-check:$8 = Some = {"IAMA optional string!"}
36
37 // gdb-command: set print length 5
38 // gdb-command: print some_string
39 // gdb-check:$8 = Some = {"IAMA "...}
40
41
42 // === LLDB TESTS ==================================================================================
43
44 // lldb-command: run
45
46 // lldb-command: print slice
47 // lldb-check:[...]$0 = &[0, 1, 2, 3]
48
49 // lldb-command: print vec
50 // lldb-check:[...]$1 = vec![4, 5, 6, 7]
51
52 // lldb-command: print str_slice
53 // lldb-check:[...]$2 = "IAMA string slice!"
54
55 // lldb-command: print string
56 // lldb-check:[...]$3 = "IAMA string!"
57
58 // lldb-command: print some
59 // lldb-check:[...]$4 = Some(8)
60
61 // lldb-command: print none
62 // lldb-check:[...]$5 = None
63
64 // lldb-command: print os_string
65 // lldb-check:[...]$6 = "IAMA OS string ðŸ˜ƒ"[...]
66
67
68 // === CDB TESTS ==================================================================================
69
70 // cdb-command: g
71
72 // cdb-command: dx slice,d
73 // cdb-check:slice,d [...]
74 // NOTE: While slices have a .natvis entry that works in VS & VS Code, it fails in CDB 10.0.18362.1
75
76 // cdb-command: dx vec,d
77 // cdb-check:vec,d [...] : { len=4 } [Type: [...]::Vec<u64, alloc::alloc::Global>]
78 // cdb-check:    [len]            : 4 [Type: [...]]
79 // cdb-check:    [capacity]       : [...] [Type: [...]]
80 // cdb-check:    [0]              : 4 [Type: unsigned __int64]
81 // cdb-check:    [1]              : 5 [Type: unsigned __int64]
82 // cdb-check:    [2]              : 6 [Type: unsigned __int64]
83 // cdb-check:    [3]              : 7 [Type: unsigned __int64]
84
85 // cdb-command: dx str_slice
86 // cdb-check:str_slice [...]
87 // NOTE: While string slices have a .natvis entry that works in VS & VS Code, it fails in CDB
88
89 // cdb-command: dx string
90 // cdb-check:string           : "IAMA string!" [Type: [...]::String]
91 // cdb-check:    [<Raw View>]     [Type: [...]::String]
92 // cdb-check:    [len]            : 0xc [Type: [...]]
93 // cdb-check:    [capacity]       : 0xc [Type: [...]]
94
95 // cdb-command: dx -r2 string
96 // cdb-check:    [0]              : 73 'I' [Type: char]
97 // cdb-check:    [1]              : 65 'A' [Type: char]
98 // cdb-check:    [2]              : 77 'M' [Type: char]
99 // cdb-check:    [3]              : 65 'A' [Type: char]
100 // cdb-check:    [4]              : 32 ' ' [Type: char]
101 // cdb-check:    [5]              : 115 's' [Type: char]
102 // cdb-check:    [6]              : 116 't' [Type: char]
103 // cdb-check:    [7]              : 114 'r' [Type: char]
104 // cdb-check:    [8]              : 105 'i' [Type: char]
105 // cdb-check:    [9]              : 110 'n' [Type: char]
106 // cdb-check:    [10]             : 103 'g' [Type: char]
107 // cdb-check:    [11]             : 33 '!' [Type: char]
108
109 // cdb-command: dx os_string
110 // cdb-check:os_string        [Type: [...]::OsString]
111 // NOTE: OsString doesn't have a .natvis entry yet.
112
113 // cdb-command: dx some
114 // cdb-check:some             : Some(8) [Type: [...]::Option<i16>]
115 // cdb-command: dx none
116 // cdb-check:none             : None [Type: [...]::Option<i64>]
117 // cdb-command: dx some_string
118 // cdb-check:some_string      : Some("IAMA optional string!") [[...]::Option<[...]::String>]
119
120 #![allow(unused_variables)]
121 use std::ffi::OsString;
122
123
124 fn main() {
125
126     // &[]
127     let slice: &[i32] = &[0, 1, 2, 3];
128
129     // Vec
130     let vec = vec![4u64, 5, 6, 7];
131
132     // &str
133     let str_slice = "IAMA string slice!";
134
135     // String
136     let string = "IAMA string!".to_string();
137
138     // OsString
139     let os_string = OsString::from("IAMA OS string \u{1F603}");
140
141     // Option
142     let some = Some(8i16);
143     let none: Option<i64> = None;
144
145     let some_string = Some("IAMA optional string!".to_owned());
146
147     zzz(); // #break
148 }
149
150 fn zzz() { () }