]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/pretty-std.rs
Auto merge of #79608 - alessandrod:bpf, r=nagisa
[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 // ignore-tidy-linelength
5 // compile-flags:-g
6 // min-gdb-version: 7.7
7 // min-lldb-version: 310
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 [...]
75 // NOTE: While slices have a .natvis entry that works in VS & VS Code, it fails in CDB 10.0.18362.1
76
77 // cdb-command: dx vec,d
78 // cdb-check:vec,d [...] : { len=4 } [Type: [...]::Vec<u64, alloc::alloc::Global>]
79 // cdb-check:    [len]            : 4 [Type: [...]]
80 // cdb-check:    [capacity]       : [...] [Type: [...]]
81 // cdb-check:    [0]              : 4 [Type: unsigned __int64]
82 // cdb-check:    [1]              : 5 [Type: unsigned __int64]
83 // cdb-check:    [2]              : 6 [Type: unsigned __int64]
84 // cdb-check:    [3]              : 7 [Type: unsigned __int64]
85
86 // cdb-command: dx str_slice
87 // cdb-check:str_slice [...]
88 // NOTE: While string slices have a .natvis entry that works in VS & VS Code, it fails in CDB
89
90 // cdb-command: dx string
91 // cdb-check:string           : "IAMA string!" [Type: [...]::String]
92 // cdb-check:    [<Raw View>]     [Type: [...]::String]
93 // cdb-check:    [len]            : 0xc [Type: [...]]
94 // cdb-check:    [capacity]       : 0xc [Type: [...]]
95
96 // cdb-command: dx -r2 string
97 // cdb-check:    [0]              : 73 'I' [Type: char]
98 // cdb-check:    [1]              : 65 'A' [Type: char]
99 // cdb-check:    [2]              : 77 'M' [Type: char]
100 // cdb-check:    [3]              : 65 'A' [Type: char]
101 // cdb-check:    [4]              : 32 ' ' [Type: char]
102 // cdb-check:    [5]              : 115 's' [Type: char]
103 // cdb-check:    [6]              : 116 't' [Type: char]
104 // cdb-check:    [7]              : 114 'r' [Type: char]
105 // cdb-check:    [8]              : 105 'i' [Type: char]
106 // cdb-check:    [9]              : 110 'n' [Type: char]
107 // cdb-check:    [10]             : 103 'g' [Type: char]
108 // cdb-check:    [11]             : 33 '!' [Type: char]
109
110 // cdb-command: dx os_string
111 // cdb-check:os_string        [Type: [...]::OsString]
112 // NOTE: OsString doesn't have a .natvis entry yet.
113
114 // cdb-command: dx some
115 // cdb-check:some             : Some [Type: enum$<core::option::Option<i16>>]
116 // cdb-command: dx none
117 // cdb-check:none             : None [Type: enum$<core::option::Option<i64>>]
118 // cdb-command: dx some_string
119 // cdb-check:some_string      [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
120
121 #![allow(unused_variables)]
122 use std::ffi::OsString;
123
124
125 fn main() {
126
127     // &[]
128     let slice: &[i32] = &[0, 1, 2, 3];
129
130     // Vec
131     let vec = vec![4u64, 5, 6, 7];
132
133     // &str
134     let str_slice = "IAMA string slice!";
135
136     // String
137     let string = "IAMA string!".to_string();
138
139     // OsString
140     let os_string = OsString::from("IAMA OS string \u{1F603}");
141
142     // Option
143     let some = Some(8i16);
144     let none: Option<i64> = None;
145
146     let some_string = Some("IAMA optional string!".to_owned());
147
148     zzz(); // #break
149 }
150
151 fn zzz() { () }