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)
6 // min-lldb-version: 310
8 // === GDB TESTS ===================================================================================
12 // gdb-command: print slice
13 // gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
15 // gdb-command: print vec
16 // gdb-check:$2 = Vec<u64>(len: 4, cap: [...]) = {4, 5, 6, 7}
18 // gdb-command: print str_slice
19 // gdb-check:$3 = "IAMA string slice!"
21 // gdb-command: print string
22 // gdb-check:$4 = "IAMA string!"
24 // gdb-command: print some
25 // gdb-check:$5 = Some = {8}
27 // gdb-command: print none
28 // gdbg-check:$6 = None
29 // gdbr-check:$6 = core::option::Option::None
31 // gdb-command: print os_string
32 // gdb-check:$7 = "IAMA OS string 😃"
34 // gdb-command: print some_string
35 // gdb-check:$8 = Some = {"IAMA optional string!"}
37 // gdb-command: set print length 5
38 // gdb-command: print some_string
39 // gdb-check:$8 = Some = {"IAMA "...}
42 // === LLDB TESTS ==================================================================================
46 // lldb-command: print slice
47 // lldb-check:[...]$0 = &[0, 1, 2, 3]
49 // lldb-command: print vec
50 // lldb-check:[...]$1 = vec![4, 5, 6, 7]
52 // lldb-command: print str_slice
53 // lldb-check:[...]$2 = "IAMA string slice!"
55 // lldb-command: print string
56 // lldb-check:[...]$3 = "IAMA string!"
58 // lldb-command: print some
59 // lldb-check:[...]$4 = Some(8)
61 // lldb-command: print none
62 // lldb-check:[...]$5 = None
65 // === CDB TESTS ==================================================================================
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
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]
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
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]
104 // cdb-command: dx os_string
105 // cdb-check:os_string [Type: [...]::OsString]
106 // NOTE: OsString doesn't have a .natvis entry yet.
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>]
115 #![allow(unused_variables)]
116 use std::ffi::OsString;
122 let slice: &[i32] = &[0, 1, 2, 3];
125 let vec = vec![4u64, 5, 6, 7];
128 let str_slice = "IAMA string slice!";
131 let string = "IAMA string!".to_string();
134 let os_string = OsString::from("IAMA OS string \u{1F603}");
137 let some = Some(8i16);
138 let none: Option<i64> = None;
140 let some_string = Some("IAMA optional string!".to_owned());