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)
5 // min-gdb-version: 7.7
6 // min-lldb-version: 310
7 // min-cdb-version: 10.0.18317.1001
9 // This started failing recently. See https://github.com/rust-lang/rust/issues/88796
10 // FIXME: fix and unignore this
13 // === GDB TESTS ===================================================================================
17 // gdb-command: print slice
18 // gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
20 // gdb-command: print vec
21 // gdb-check:$2 = Vec<u64, alloc::alloc::Global>(len: 4, cap: [...]) = {4, 5, 6, 7}
23 // gdb-command: print str_slice
24 // gdb-check:$3 = "IAMA string slice!"
26 // gdb-command: print string
27 // gdb-check:$4 = "IAMA string!"
29 // gdb-command: print some
30 // gdb-check:$5 = Some = {8}
32 // gdb-command: print none
33 // gdbg-check:$6 = None
34 // gdbr-check:$6 = core::option::Option::None
36 // gdb-command: print os_string
37 // gdb-check:$7 = "IAMA OS string 😃"
39 // gdb-command: print some_string
40 // gdb-check:$8 = Some = {"IAMA optional string!"}
42 // gdb-command: set print length 5
43 // gdb-command: print some_string
44 // gdb-check:$8 = Some = {"IAMA "...}
47 // === LLDB TESTS ==================================================================================
51 // lldb-command: print slice
52 // lldb-check:[...]$0 = &[0, 1, 2, 3]
54 // lldb-command: print vec
55 // lldb-check:[...]$1 = vec![4, 5, 6, 7]
57 // lldb-command: print str_slice
58 // lldb-check:[...]$2 = "IAMA string slice!"
60 // lldb-command: print string
61 // lldb-check:[...]$3 = "IAMA string!"
63 // lldb-command: print some
64 // lldb-check:[...]$4 = Some(8)
66 // lldb-command: print none
67 // lldb-check:[...]$5 = None
69 // lldb-command: print os_string
70 // lldb-check:[...]$6 = "IAMA OS string 😃"[...]
73 // === CDB TESTS ==================================================================================
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]
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]
94 // cdb-command: dx str_slice
95 // cdb-check:str_slice : "IAMA string slice!" [Type: str]
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: [...]]
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]
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 😃"
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]
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
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>]
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]
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]
151 #![allow(unused_variables)]
152 use std::collections::{LinkedList, VecDeque};
153 use std::ffi::OsString;
158 let slice: &[i32] = &[0, 1, 2, 3];
161 let vec = vec![4u64, 5, 6, 7];
164 let str_slice = "IAMA string slice!";
167 let string = "IAMA string!".to_string();
170 let os_string = OsString::from("IAMA OS string \u{1F603}");
173 let some = Some(8i16);
174 let none: Option<i64> = None;
176 let some_string = Some("IAMA optional string!".to_owned());
179 let mut linkedlist = LinkedList::new();
180 linkedlist.push_back(42);
181 linkedlist.push_front(128);
184 let mut vecdeque = VecDeque::new();
185 vecdeque.push_back(20);
186 vecdeque.push_front(90);