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
6 // min-gdb-version: 7.7
7 // min-lldb-version: 310
9 // === GDB TESTS ===================================================================================
13 // gdb-command: print slice
14 // gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
16 // gdb-command: print vec
17 // gdb-check:$2 = Vec<u64, alloc::alloc::Global>(len: 4, cap: [...]) = {4, 5, 6, 7}
19 // gdb-command: print str_slice
20 // gdb-check:$3 = "IAMA string slice!"
22 // gdb-command: print string
23 // gdb-check:$4 = "IAMA string!"
25 // gdb-command: print some
26 // gdb-check:$5 = Some = {8}
28 // gdb-command: print none
29 // gdbg-check:$6 = None
30 // gdbr-check:$6 = core::option::Option::None
32 // gdb-command: print os_string
33 // gdb-check:$7 = "IAMA OS string 😃"
35 // gdb-command: print some_string
36 // gdb-check:$8 = Some = {"IAMA optional string!"}
38 // gdb-command: set print length 5
39 // gdb-command: print some_string
40 // gdb-check:$8 = Some = {"IAMA "...}
43 // === LLDB TESTS ==================================================================================
47 // lldb-command: print slice
48 // lldb-check:[...]$0 = &[0, 1, 2, 3]
50 // lldb-command: print vec
51 // lldb-check:[...]$1 = vec![4, 5, 6, 7]
53 // lldb-command: print str_slice
54 // lldb-check:[...]$2 = "IAMA string slice!"
56 // lldb-command: print string
57 // lldb-check:[...]$3 = "IAMA string!"
59 // lldb-command: print some
60 // lldb-check:[...]$4 = Some(8)
62 // lldb-command: print none
63 // lldb-check:[...]$5 = None
65 // lldb-command: print os_string
66 // lldb-check:[...]$6 = "IAMA OS string 😃"[...]
69 // === CDB TESTS ==================================================================================
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
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]
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
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: [...]]
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]
110 // cdb-command: dx os_string
111 // cdb-check:os_string [Type: [...]::OsString]
112 // NOTE: OsString doesn't have a .natvis entry yet.
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>]
121 #![allow(unused_variables)]
122 use std::ffi::OsString;
128 let slice: &[i32] = &[0, 1, 2, 3];
131 let vec = vec![4u64, 5, 6, 7];
134 let str_slice = "IAMA string slice!";
137 let string = "IAMA string!".to_string();
140 let os_string = OsString::from("IAMA OS string \u{1F603}");
143 let some = Some(8i16);
144 let none: Option<i64> = None;
146 let some_string = Some("IAMA optional string!".to_owned());