]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/pretty-std.rs
Auto merge of #93284 - eholk:disable-drop-range-analysis, r=pnkfelix
[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 // min-cdb-version: 10.0.18317.1001
8
9 // === GDB TESTS ===================================================================================
10
11 // gdb-command: run
12
13 // gdb-command: print slice
14 // gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
15
16 // gdb-command: print vec
17 // gdb-check:$2 = Vec<u64, alloc::alloc::Global>(len: 4, cap: [...]) = {4, 5, 6, 7}
18
19 // gdb-command: print str_slice
20 // gdb-check:$3 = "IAMA string slice!"
21
22 // gdb-command: print string
23 // gdb-check:$4 = "IAMA string!"
24
25 // gdb-command: print some
26 // gdb-check:$5 = Some = {8}
27
28 // gdb-command: print none
29 // gdbg-check:$6 = None
30 // gdbr-check:$6 = core::option::Option::None
31
32 // gdb-command: print os_string
33 // gdb-check:$7 = "IAMA OS string ðŸ˜ƒ"
34
35 // gdb-command: print some_string
36 // gdb-check:$8 = Some = {"IAMA optional string!"}
37
38 // gdb-command: set print length 5
39 // gdb-command: print some_string
40 // gdb-check:$8 = Some = {"IAMA "...}
41
42
43 // === LLDB TESTS ==================================================================================
44
45 // lldb-command: run
46
47 // lldb-command: print slice
48 // lldb-check:[...]$0 = &[0, 1, 2, 3]
49
50 // lldb-command: print vec
51 // lldb-check:[...]$1 = vec![4, 5, 6, 7]
52
53 // lldb-command: print str_slice
54 // lldb-check:[...]$2 = "IAMA string slice!"
55
56 // lldb-command: print string
57 // lldb-check:[...]$3 = "IAMA string!"
58
59 // lldb-command: print some
60 // lldb-check:[...]$4 = Some(8)
61
62 // lldb-command: print none
63 // lldb-check:[...]$5 = None
64
65 // lldb-command: print os_string
66 // lldb-check:[...]$6 = "IAMA OS string ðŸ˜ƒ"[...]
67
68
69 // === CDB TESTS ==================================================================================
70
71 // cdb-command: g
72
73 // cdb-command: dx slice,d
74 // cdb-check:slice,d          : { len=4 } [Type: slice$<i32>]
75 // cdb-check:    [len]            : 4 [Type: [...]]
76 // cdb-check:    [0]              : 0 [Type: int]
77 // cdb-check:    [1]              : 1 [Type: int]
78 // cdb-check:    [2]              : 2 [Type: int]
79 // cdb-check:    [3]              : 3 [Type: int]
80
81 // cdb-command: dx vec,d
82 // cdb-check:vec,d [...] : { len=4 } [Type: [...]::Vec<u64,alloc::alloc::Global>]
83 // cdb-check:    [len]            : 4 [Type: [...]]
84 // cdb-check:    [capacity]       : [...] [Type: [...]]
85 // cdb-check:    [0]              : 4 [Type: unsigned __int64]
86 // cdb-check:    [1]              : 5 [Type: unsigned __int64]
87 // cdb-check:    [2]              : 6 [Type: unsigned __int64]
88 // cdb-check:    [3]              : 7 [Type: unsigned __int64]
89
90 // cdb-command: dx str_slice
91 // cdb-check:str_slice        : "IAMA string slice!" [Type: str]
92
93 // cdb-command: dx string
94 // cdb-check:string           : "IAMA string!" [Type: [...]::String]
95 // cdb-check:    [<Raw View>]     [Type: [...]::String]
96 // cdb-check:    [len]            : 0xc [Type: [...]]
97 // cdb-check:    [capacity]       : 0xc [Type: [...]]
98
99 // cdb-command: dx -r2 string
100 // cdb-check:    [0]              : 73 'I' [Type: char]
101 // cdb-check:    [1]              : 65 'A' [Type: char]
102 // cdb-check:    [2]              : 77 'M' [Type: char]
103 // cdb-check:    [3]              : 65 'A' [Type: char]
104 // cdb-check:    [4]              : 32 ' ' [Type: char]
105 // cdb-check:    [5]              : 115 's' [Type: char]
106 // cdb-check:    [6]              : 116 't' [Type: char]
107 // cdb-check:    [7]              : 114 'r' [Type: char]
108 // cdb-check:    [8]              : 105 'i' [Type: char]
109 // cdb-check:    [9]              : 110 'n' [Type: char]
110 // cdb-check:    [10]             : 103 'g' [Type: char]
111 // cdb-check:    [11]             : 33 '!' [Type: char]
112
113 // cdb-command: dx os_string
114 // NOTE: OSString is WTF-8 encoded which Windows debuggers don't understand. Verify the UTF-8
115 //       portion displays correctly.
116 // cdb-check:os_string        : "IAMA OS string [...]" [Type: std::ffi::os_str::OsString]
117 // cdb-check:    [<Raw View>]     [Type: std::ffi::os_str::OsString]
118 // cdb-check:    [chars]          : "IAMA OS string [...]"
119
120 // cdb-command: dx some
121 // cdb-check:some             : Some [Type: enum$<core::option::Option<i16> >]
122 // cdb-check:    [<Raw View>]     [Type: enum$<core::option::Option<i16> >]
123 // cdb-check:    [variant]        : Some
124 // cdb-check:    [+0x002] __0              : 8 [Type: short]
125
126 // cdb-command: dx none
127 // cdb-check:none             : None [Type: enum$<core::option::Option<i64> >]
128 // cdb-check:    [<Raw View>]     [Type: enum$<core::option::Option<i64> >]
129 // cdb-check:    [variant]        : None
130
131 // cdb-command: dx some_string
132 // cdb-check:some_string      :  Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
133 // cdb-check:    [<Raw View>]     [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
134 // cdb-check:    [variant]        :  Some
135 // cdb-check:    [+0x000] __0              : "IAMA optional string!" [Type: alloc::string::String]
136
137 // cdb-command: dx linkedlist
138 // cdb-check:linkedlist       : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList<i32>]
139 // cdb-check:    [<Raw View>]     [Type: alloc::collections::linked_list::LinkedList<i32>]
140 // cdb-check:    [0x0]            : 128 [Type: int]
141 // cdb-check:    [0x1]            : 42 [Type: int]
142
143 // cdb-command: dx vecdeque
144 // cdb-check:vecdeque         : { len=0x2 } [Type: alloc::collections::vec_deque::VecDeque<i32,alloc::alloc::Global>]
145 // cdb-check:    [<Raw View>]     [Type: alloc::collections::vec_deque::VecDeque<i32,alloc::alloc::Global>]
146 // cdb-check:    [len]            : 0x2
147 // cdb-check:    [capacity]       : 0x8 [Type: unsigned [...]]
148 // cdb-check:    [0x0]            : 90 [Type: int]
149 // cdb-check:    [0x1]            : 20 [Type: int]
150
151 #![allow(unused_variables)]
152 use std::collections::{LinkedList, VecDeque};
153 use std::ffi::OsString;
154
155 fn main() {
156
157     // &[]
158     let slice: &[i32] = &[0, 1, 2, 3];
159
160     // Vec
161     let vec = vec![4u64, 5, 6, 7];
162
163     // &str
164     let str_slice = "IAMA string slice!";
165
166     // String
167     let string = "IAMA string!".to_string();
168
169     // OsString
170     let os_string = OsString::from("IAMA OS string \u{1F603}");
171
172     // Option
173     let some = Some(8i16);
174     let none: Option<i64> = None;
175
176     let some_string = Some("IAMA optional string!".to_owned());
177
178     // LinkedList
179     let mut linkedlist = LinkedList::new();
180     linkedlist.push_back(42);
181     linkedlist.push_front(128);
182
183     // VecDeque
184     let mut vecdeque = VecDeque::new();
185     vecdeque.push_back(20);
186     vecdeque.push_front(90);
187
188     zzz(); // #break
189 }
190
191 fn zzz() { () }