From a6a82c66d4fc3be10861ad6885ff0ab239c203ad Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Wed, 30 Jun 2021 17:23:44 -0400 Subject: [PATCH] Add/improve visualizations for liballoc types --- src/etc/natvis/liballoc.natvis | 10 ++++++++++ src/test/debuginfo/pretty-std.rs | 28 ++++++++++++++++++++++++++-- src/test/debuginfo/rc_arc.rs | 13 +++++++++++-- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis index 9cc60fc7b47..707643152c9 100644 --- a/src/etc/natvis/liballoc.natvis +++ b/src/etc/natvis/liballoc.natvis @@ -57,16 +57,26 @@ + + {ptr.pointer->value} + + ptr.pointer->value + ptr.pointer->strong + + + {ptr.pointer->value} ptr.pointer->value + {ptr.pointer->data} ptr.pointer->data + ptr.pointer->strong diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs index 7ed76beb8c6..a2074c43dfa 100644 --- a/src/test/debuginfo/pretty-std.rs +++ b/src/test/debuginfo/pretty-std.rs @@ -129,9 +129,23 @@ // NOTE: cdb fails to interpret debug info of Option enums on i686. // cdb-check:some_string [Type: enum$, 1, [...], Some>] -#![allow(unused_variables)] -use std::ffi::OsString; +// cdb-command: dx linkedlist +// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList] +// cdb-check: [] [Type: alloc::collections::linked_list::LinkedList] +// 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] +// cdb-check: [] [Type: alloc::collections::vec_deque::VecDeque] +// 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 } diff --git a/src/test/debuginfo/rc_arc.rs b/src/test/debuginfo/rc_arc.rs index 6e558bd3c13..24623bc972e 100644 --- a/src/test/debuginfo/rc_arc.rs +++ b/src/test/debuginfo/rc_arc.rs @@ -29,22 +29,31 @@ // cdb-command:dx r,d // cdb-check:r,d : 42 [Type: alloc::rc::Rc] +// cdb-check: [] [Type: alloc::rc::Rc] +// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] // cdb-command:dx r1,d // cdb-check:r1,d : 42 [Type: alloc::rc::Rc] +// cdb-check: [] [Type: alloc::rc::Rc] +// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] // cdb-command:dx w1,d -// cdb-check:w1,d [Type: alloc::rc::Weak] -// cdb-check: [...] ptr : [...] [Type: core::ptr::non_null::NonNull >] +// cdb-check:w1,d : 42 [Type: alloc::rc::Weak] +// cdb-check: [] [Type: alloc::rc::Weak] // cdb-command:dx a,d // cdb-check:a,d : 42 [Type: alloc::sync::Arc] +// cdb-check: [] [Type: alloc::sync::Arc] +// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] // cdb-command:dx a1,d // cdb-check:a1,d : 42 [Type: alloc::sync::Arc] +// cdb-check: [] [Type: alloc::sync::Arc] +// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] // cdb-command:dx w2,d // cdb-check:w2,d : 42 [Type: alloc::sync::Weak] +// cdb-check: [] [Type: alloc::sync::Weak] use std::rc::Rc; use std::sync::Arc;