Add/improve visualizations for liballoc types

This commit is contained in:
Wesley Wiser 2021-06-30 17:23:44 -04:00
parent 691ee054d5
commit a6a82c66d4
3 changed files with 47 additions and 4 deletions

View File

@ -57,16 +57,26 @@
</Synthetic>
</Expand>
</Type>
<Type Name="alloc::rc::Rc&lt;*&gt;">
<DisplayString>{ptr.pointer->value}</DisplayString>
<Expand>
<ExpandedItem>ptr.pointer->value</ExpandedItem>
<Item Name="[Reference count]">ptr.pointer->strong</Item>
</Expand>
</Type>
<Type Name="alloc::rc::Weak&lt;*&gt;">
<DisplayString>{ptr.pointer->value}</DisplayString>
<Expand>
<ExpandedItem>ptr.pointer->value</ExpandedItem>
</Expand>
</Type>
<Type Name="alloc::sync::Arc&lt;*&gt;">
<DisplayString>{ptr.pointer->data}</DisplayString>
<Expand>
<ExpandedItem>ptr.pointer->data</ExpandedItem>
<Item Name="[Reference count]">ptr.pointer->strong</Item>
</Expand>
</Type>
<Type Name="alloc::sync::Weak&lt;*&gt;">

View File

@ -129,9 +129,23 @@
// NOTE: cdb fails to interpret debug info of Option enums on i686.
// cdb-check:some_string [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
#![allow(unused_variables)]
use std::ffi::OsString;
// cdb-command: dx linkedlist
// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList<i32>]
// cdb-check: [<Raw View>] [Type: alloc::collections::linked_list::LinkedList<i32>]
// cdb-check: [0x0] : 128 [Type: int]
// cdb-check: [0x1] : 42 [Type: int]
// cdb-command: dx vecdeque
// cdb-check:vecdeque : { len=0x2 } [Type: alloc::collections::vec_deque::VecDeque<i32>]
// cdb-check: [<Raw View>] [Type: alloc::collections::vec_deque::VecDeque<i32>]
// cdb-check: [len] : 0x2
// cdb-check: [capacity] : 0x8 [Type: unsigned __int64]
// cdb-check: [0x0] : 90 [Type: int]
// cdb-check: [0x1] : 20 [Type: int]
#![allow(unused_variables)]
use std::collections::{LinkedList, VecDeque};
use std::ffi::OsString;
fn main() {
@ -156,6 +170,16 @@ fn main() {
let some_string = Some("IAMA optional string!".to_owned());
// LinkedList
let mut linkedlist = LinkedList::new();
linkedlist.push_back(42);
linkedlist.push_front(128);
// VecDeque
let mut vecdeque = VecDeque::new();
vecdeque.push_back(20);
vecdeque.push_front(90);
zzz(); // #break
}

View File

@ -29,22 +29,31 @@
// cdb-command:dx r,d
// cdb-check:r,d : 42 [Type: alloc::rc::Rc<i32>]
// cdb-check: [<Raw View>] [Type: alloc::rc::Rc<i32>]
// cdb-check: [Reference count] : 2 [Type: core::cell::Cell<usize>]
// cdb-command:dx r1,d
// cdb-check:r1,d : 42 [Type: alloc::rc::Rc<i32>]
// cdb-check: [<Raw View>] [Type: alloc::rc::Rc<i32>]
// cdb-check: [Reference count] : 2 [Type: core::cell::Cell<usize>]
// cdb-command:dx w1,d
// cdb-check:w1,d [Type: alloc::rc::Weak<i32>]
// cdb-check: [...] ptr : [...] [Type: core::ptr::non_null::NonNull<alloc::rc::RcBox<i32> >]
// cdb-check:w1,d : 42 [Type: alloc::rc::Weak<i32>]
// cdb-check: [<Raw View>] [Type: alloc::rc::Weak<i32>]
// cdb-command:dx a,d
// cdb-check:a,d : 42 [Type: alloc::sync::Arc<i32>]
// cdb-check: [<Raw View>] [Type: alloc::sync::Arc<i32>]
// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
// cdb-command:dx a1,d
// cdb-check:a1,d : 42 [Type: alloc::sync::Arc<i32>]
// cdb-check: [<Raw View>] [Type: alloc::sync::Arc<i32>]
// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
// cdb-command:dx w2,d
// cdb-check:w2,d : 42 [Type: alloc::sync::Weak<i32>]
// cdb-check: [<Raw View>] [Type: alloc::sync::Weak<i32>]
use std::rc::Rc;
use std::sync::Arc;