Skip to content

Commit a6a82c6

Browse files
committed
Add/improve visualizations for liballoc types
1 parent 691ee05 commit a6a82c6

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

src/etc/natvis/liballoc.natvis

+10
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,26 @@
5757
</Synthetic>
5858
</Expand>
5959
</Type>
60+
6061
<Type Name="alloc::rc::Rc&lt;*&gt;">
6162
<DisplayString>{ptr.pointer->value}</DisplayString>
6263
<Expand>
6364
<ExpandedItem>ptr.pointer->value</ExpandedItem>
65+
<Item Name="[Reference count]">ptr.pointer->strong</Item>
6466
</Expand>
6567
</Type>
68+
<Type Name="alloc::rc::Weak&lt;*&gt;">
69+
<DisplayString>{ptr.pointer->value}</DisplayString>
70+
<Expand>
71+
<ExpandedItem>ptr.pointer->value</ExpandedItem>
72+
</Expand>
73+
</Type>
74+
6675
<Type Name="alloc::sync::Arc&lt;*&gt;">
6776
<DisplayString>{ptr.pointer->data}</DisplayString>
6877
<Expand>
6978
<ExpandedItem>ptr.pointer->data</ExpandedItem>
79+
<Item Name="[Reference count]">ptr.pointer->strong</Item>
7080
</Expand>
7181
</Type>
7282
<Type Name="alloc::sync::Weak&lt;*&gt;">

src/test/debuginfo/pretty-std.rs

+25-1
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,24 @@
129129
// NOTE: cdb fails to interpret debug info of Option enums on i686.
130130
// cdb-check:some_string [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
131131

132+
// cdb-command: dx linkedlist
133+
// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList<i32>]
134+
// cdb-check: [<Raw View>] [Type: alloc::collections::linked_list::LinkedList<i32>]
135+
// cdb-check: [0x0] : 128 [Type: int]
136+
// cdb-check: [0x1] : 42 [Type: int]
137+
138+
// cdb-command: dx vecdeque
139+
// cdb-check:vecdeque : { len=0x2 } [Type: alloc::collections::vec_deque::VecDeque<i32>]
140+
// cdb-check: [<Raw View>] [Type: alloc::collections::vec_deque::VecDeque<i32>]
141+
// cdb-check: [len] : 0x2
142+
// cdb-check: [capacity] : 0x8 [Type: unsigned __int64]
143+
// cdb-check: [0x0] : 90 [Type: int]
144+
// cdb-check: [0x1] : 20 [Type: int]
145+
132146
#![allow(unused_variables)]
147+
use std::collections::{LinkedList, VecDeque};
133148
use std::ffi::OsString;
134149

135-
136150
fn main() {
137151

138152
// &[]
@@ -156,6 +170,16 @@ fn main() {
156170

157171
let some_string = Some("IAMA optional string!".to_owned());
158172

173+
// LinkedList
174+
let mut linkedlist = LinkedList::new();
175+
linkedlist.push_back(42);
176+
linkedlist.push_front(128);
177+
178+
// VecDeque
179+
let mut vecdeque = VecDeque::new();
180+
vecdeque.push_back(20);
181+
vecdeque.push_front(90);
182+
159183
zzz(); // #break
160184
}
161185

src/test/debuginfo/rc_arc.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,31 @@
2929

3030
// cdb-command:dx r,d
3131
// cdb-check:r,d : 42 [Type: alloc::rc::Rc<i32>]
32+
// cdb-check: [<Raw View>] [Type: alloc::rc::Rc<i32>]
33+
// cdb-check: [Reference count] : 2 [Type: core::cell::Cell<usize>]
3234

3335
// cdb-command:dx r1,d
3436
// cdb-check:r1,d : 42 [Type: alloc::rc::Rc<i32>]
37+
// cdb-check: [<Raw View>] [Type: alloc::rc::Rc<i32>]
38+
// cdb-check: [Reference count] : 2 [Type: core::cell::Cell<usize>]
3539

3640
// cdb-command:dx w1,d
37-
// cdb-check:w1,d [Type: alloc::rc::Weak<i32>]
38-
// cdb-check: [...] ptr : [...] [Type: core::ptr::non_null::NonNull<alloc::rc::RcBox<i32> >]
41+
// cdb-check:w1,d : 42 [Type: alloc::rc::Weak<i32>]
42+
// cdb-check: [<Raw View>] [Type: alloc::rc::Weak<i32>]
3943

4044
// cdb-command:dx a,d
4145
// cdb-check:a,d : 42 [Type: alloc::sync::Arc<i32>]
46+
// cdb-check: [<Raw View>] [Type: alloc::sync::Arc<i32>]
47+
// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
4248

4349
// cdb-command:dx a1,d
4450
// cdb-check:a1,d : 42 [Type: alloc::sync::Arc<i32>]
51+
// cdb-check: [<Raw View>] [Type: alloc::sync::Arc<i32>]
52+
// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
4553

4654
// cdb-command:dx w2,d
4755
// cdb-check:w2,d : 42 [Type: alloc::sync::Weak<i32>]
56+
// cdb-check: [<Raw View>] [Type: alloc::sync::Weak<i32>]
4857

4958
use std::rc::Rc;
5059
use std::sync::Arc;

0 commit comments

Comments
 (0)