Skip to content
Merged
10 changes: 10 additions & 0 deletions src/etc/natvis/liballoc.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -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;">
Expand Down
26 changes: 25 additions & 1 deletion src/test/debuginfo/pretty-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,24 @@
// 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>]

// 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() {

// &[]
Expand All @@ -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
}

Expand Down
13 changes: 11 additions & 2 deletions src/test/debuginfo/rc_arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down