]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/pretty-std.rs
Rollup merge of #88954 - nbdd0121:panic3, r=oli-obk
[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 // This started failing recently. See https://github.com/rust-lang/rust/issues/88796
10 // FIXME: fix and unignore this
11 // ignore-windows
12
13 // === GDB TESTS ===================================================================================
14
15 // gdb-command: run
16
17 // gdb-command: print slice
18 // gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
19
20 // gdb-command: print vec
21 // gdb-check:$2 = Vec<u64, alloc::alloc::Global>(len: 4, cap: [...]) = {4, 5, 6, 7}
22
23 // gdb-command: print str_slice
24 // gdb-check:$3 = "IAMA string slice!"
25
26 // gdb-command: print string
27 // gdb-check:$4 = "IAMA string!"
28
29 // gdb-command: print some
30 // gdb-check:$5 = Some = {8}
31
32 // gdb-command: print none
33 // gdbg-check:$6 = None
34 // gdbr-check:$6 = core::option::Option::None
35
36 // gdb-command: print os_string
37 // gdb-check:$7 = "IAMA OS string ðŸ˜ƒ"
38
39 // gdb-command: print some_string
40 // gdb-check:$8 = Some = {"IAMA optional string!"}
41
42 // gdb-command: set print length 5
43 // gdb-command: print some_string
44 // gdb-check:$8 = Some = {"IAMA "...}
45
46
47 // === LLDB TESTS ==================================================================================
48
49 // lldb-command: run
50
51 // lldb-command: print slice
52 // lldb-check:[...]$0 = &[0, 1, 2, 3]
53
54 // lldb-command: print vec
55 // lldb-check:[...]$1 = vec![4, 5, 6, 7]
56
57 // lldb-command: print str_slice
58 // lldb-check:[...]$2 = "IAMA string slice!"
59
60 // lldb-command: print string
61 // lldb-check:[...]$3 = "IAMA string!"
62
63 // lldb-command: print some
64 // lldb-check:[...]$4 = Some(8)
65
66 // lldb-command: print none
67 // lldb-check:[...]$5 = None
68
69 // lldb-command: print os_string
70 // lldb-check:[...]$6 = "IAMA OS string ðŸ˜ƒ"[...]
71
72
73 // === CDB TESTS ==================================================================================
74
75 // cdb-command: g
76
77 // cdb-command: dx slice,d
78 // cdb-check:slice,d          : { len=4 } [Type: slice$<i32>]
79 // cdb-check:    [len]            : 4 [Type: [...]]
80 // cdb-check:    [0]              : 0 [Type: int]
81 // cdb-check:    [1]              : 1 [Type: int]
82 // cdb-check:    [2]              : 2 [Type: int]
83 // cdb-check:    [3]              : 3 [Type: int]
84
85 // cdb-command: dx vec,d
86 // cdb-check:vec,d [...] : { len=4 } [Type: [...]::Vec<u64,alloc::alloc::Global>]
87 // cdb-check:    [len]            : 4 [Type: [...]]
88 // cdb-check:    [capacity]       : [...] [Type: [...]]
89 // cdb-check:    [0]              : 4 [Type: unsigned __int64]
90 // cdb-check:    [1]              : 5 [Type: unsigned __int64]
91 // cdb-check:    [2]              : 6 [Type: unsigned __int64]
92 // cdb-check:    [3]              : 7 [Type: unsigned __int64]
93
94 // cdb-command: dx str_slice
95 // cdb-check:str_slice        : "IAMA string slice!" [Type: str]
96
97 // cdb-command: dx string
98 // cdb-check:string           : "IAMA string!" [Type: [...]::String]
99 // cdb-check:    [<Raw View>]     [Type: [...]::String]
100 // cdb-check:    [len]            : 0xc [Type: [...]]
101 // cdb-check:    [capacity]       : 0xc [Type: [...]]
102
103 // cdb-command: dx -r2 string
104 // cdb-check:    [0]              : 73 'I' [Type: char]
105 // cdb-check:    [1]              : 65 'A' [Type: char]
106 // cdb-check:    [2]              : 77 'M' [Type: char]
107 // cdb-check:    [3]              : 65 'A' [Type: char]
108 // cdb-check:    [4]              : 32 ' ' [Type: char]
109 // cdb-check:    [5]              : 115 's' [Type: char]
110 // cdb-check:    [6]              : 116 't' [Type: char]
111 // cdb-check:    [7]              : 114 'r' [Type: char]
112 // cdb-check:    [8]              : 105 'i' [Type: char]
113 // cdb-check:    [9]              : 110 'n' [Type: char]
114 // cdb-check:    [10]             : 103 'g' [Type: char]
115 // cdb-check:    [11]             : 33 '!' [Type: char]
116
117 // cdb-command: dx os_string
118 // cdb-check:os_string        : "IAMA OS string ðŸ˜ƒ" [Type: std::ffi::os_str::OsString]
119 // cdb-check:    [<Raw View>]     [Type: std::ffi::os_str::OsString]
120 // cdb-check:    [chars]          : "IAMA OS string ðŸ˜ƒ"
121
122 // cdb-command: dx some
123 // cdb-check:some             : Some [Type: enum$<core::option::Option<i16> >]
124 // cdb-check:    [<Raw View>]     [Type: enum$<core::option::Option<i16> >]
125 // cdb-check:    [variant]        : Some
126 // cdb-check:    [+0x002] __0              : 8 [Type: short]
127
128 // cdb-command: dx none
129 // cdb-check:none             : None [Type: enum$<core::option::Option<i64> >]
130 // cdb-check:    [<Raw View>]     [Type: enum$<core::option::Option<i64> >]
131 // cdb-check:    [variant]        : None
132
133 // cdb-command: dx some_string
134 // NOTE: cdb fails to interpret debug info of Option enums on i686.
135 // cdb-check:some_string      [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
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() { () }