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