From 691ee054d5bb8e0a95fd0486a7167bd8889ebba7 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Wed, 30 Jun 2021 12:08:58 -0400 Subject: [PATCH] Add natvis for Duration, ManuallyDrop and Pin types --- src/etc/natvis/libcore.natvis | 22 ++++++++++++++++++++++ src/test/debuginfo/duration-type.rs | 22 ++++++++++++++++++++++ src/test/debuginfo/marker-types.rs | 18 ++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 src/test/debuginfo/duration-type.rs diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 624495fb5ac..abac2cefa38 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -34,6 +34,13 @@ + + {value} + + value + + + {__0} @@ -91,6 +98,13 @@ (..={end}) + + Pin({(void*)pointer}: {pointer}) + + pointer + + + NonNull({(void*) pointer}: {pointer}) @@ -138,4 +152,12 @@ {v.value} + + + {secs,d}s {nanos,d}ns + + secs + nanos + + diff --git a/src/test/debuginfo/duration-type.rs b/src/test/debuginfo/duration-type.rs new file mode 100644 index 00000000000..3a7f9f78b5f --- /dev/null +++ b/src/test/debuginfo/duration-type.rs @@ -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: [] [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() { } diff --git a/src/test/debuginfo/marker-types.rs b/src/test/debuginfo/marker-types.rs index 43e45d8f282..de4e8311a4f 100644 --- a/src/test/debuginfo/marker-types.rs +++ b/src/test/debuginfo/marker-types.rs @@ -10,11 +10,29 @@ // cdb-check: [] [Type: core::ptr::non_null::NonNull] // cdb-checK: 0xc [Type: unsigned int] +// cdb-command: dx manuallydrop +// cdb-check:manuallydrop : 12345 [Type: core::mem::manually_drop::ManuallyDrop] +// cdb-check: [] [Type: core::mem::manually_drop::ManuallyDrop] + +// cdb-command: dx pin +// cdb-check:pin : Pin(0x[...]: "this") [Type: core::pin::Pin >] +// cdb-check: [] [Type: core::pin::Pin >] +// 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 }