Add natvis for Duration, ManuallyDrop and Pin types

This commit is contained in:
Wesley Wiser 2021-06-30 12:08:58 -04:00
parent f2aba34eea
commit 691ee054d5
3 changed files with 62 additions and 0 deletions

View File

@ -34,6 +34,13 @@
</Expand>
</Type>
<Type Name="core::mem::manually_drop::ManuallyDrop&lt;*&gt;">
<DisplayString>{value}</DisplayString>
<Expand>
<ExpandedItem>value</ExpandedItem>
</Expand>
</Type>
<Type Name="core::num::nonzero::NonZeroI8">
<DisplayString>{__0}</DisplayString>
</Type>
@ -91,6 +98,13 @@
<DisplayString>(..={end})</DisplayString>
</Type>
<Type Name="core::pin::Pin&lt;*&gt;">
<DisplayString>Pin({(void*)pointer}: {pointer})</DisplayString>
<Expand>
<ExpandedItem>pointer</ExpandedItem>
</Expand>
</Type>
<Type Name="core::ptr::non_null::NonNull&lt;*&gt;">
<DisplayString>NonNull({(void*) pointer}: {pointer})</DisplayString>
<Expand>
@ -138,4 +152,12 @@
<Type Name="core::sync::atomic::AtomicUsize">
<DisplayString>{v.value}</DisplayString>
</Type>
<Type Name="core::time::Duration">
<DisplayString>{secs,d}s {nanos,d}ns</DisplayString>
<Expand>
<Item Name="seconds">secs</Item>
<Item Name="nanoseconds">nanos</Item>
</Expand>
</Type>
</AutoVisualizer>

View File

@ -0,0 +1,22 @@
// only-cdb
// compile-flags:-g
// === CDB TESTS ==================================================================================
// cdb-command: g
// cdb-command: dx duration
// cdb-check:duration : 5s 12ns [Type: core::time::Duration]
// cdb-check: [<Raw View>] [Type: core::time::Duration]
// cdb-check: seconds : 0x5 [Type: unsigned __int64]
// cdb-check: nanoseconds : 0xc [Type: unsigned int]
use std::time::Duration;
fn main() {
let duration = Duration::new(5, 12);
zzz(); // #break
}
fn zzz() { }

View File

@ -10,11 +10,29 @@
// cdb-check: [<Raw View>] [Type: core::ptr::non_null::NonNull<u32>]
// cdb-checK: 0xc [Type: unsigned int]
// cdb-command: dx manuallydrop
// cdb-check:manuallydrop : 12345 [Type: core::mem::manually_drop::ManuallyDrop<i32>]
// cdb-check: [<Raw View>] [Type: core::mem::manually_drop::ManuallyDrop<i32>]
// cdb-command: dx pin
// cdb-check:pin : Pin(0x[...]: "this") [Type: core::pin::Pin<ref_mut$<alloc::string::String> >]
// cdb-check: [<Raw View>] [Type: core::pin::Pin<ref_mut$<alloc::string::String> >]
// cdb-check: [len] : 0x4 [Type: unsigned __int64]
// cdb-check: [capacity] : 0x4 [Type: unsigned __int64]
// cdb-check: [chars]
use std::mem::ManuallyDrop;
use std::pin::Pin;
use std::ptr::NonNull;
fn main() {
let nonnull: NonNull<_> = (&12u32).into();
let manuallydrop = ManuallyDrop::new(12345i32);
let mut s = "this".to_string();
let pin = Pin::new(&mut s);
zzz(); // #break
}