Skip to content

Commit 9740dcc

Browse files
committed
Add natvis for Atomic types
1 parent 07f1e61 commit 9740dcc

File tree

2 files changed

+101
-3
lines changed

2 files changed

+101
-3
lines changed

src/etc/natvis/libcore.natvis

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,38 @@
6161
<Item Name="[value]">*pointer</Item>
6262
</Expand>
6363
</Type>
64-
</AutoVisualizer>
64+
65+
<Type Name="core::sync::atomic::AtomicBool">
66+
<DisplayString>{(bool)v.value}</DisplayString>
67+
</Type>
68+
<Type Name="core::sync::atomic::AtomicI8">
69+
<DisplayString>{v.value}</DisplayString>
70+
</Type>
71+
<Type Name="core::sync::atomic::AtomicI16">
72+
<DisplayString>{v.value}</DisplayString>
73+
</Type>
74+
<Type Name="core::sync::atomic::AtomicI32">
75+
<DisplayString>{v.value}</DisplayString>
76+
</Type>
77+
<Type Name="core::sync::atomic::AtomicI64">
78+
<DisplayString>{v.value}</DisplayString>
79+
</Type>
80+
<Type Name="core::sync::atomic::AtomicIsize">
81+
<DisplayString>{v.value}</DisplayString>
82+
</Type>
83+
<Type Name="core::sync::atomic::AtomicU8">
84+
<DisplayString>{v.value}</DisplayString>
85+
</Type>
86+
<Type Name="core::sync::atomic::AtomicU16">
87+
<DisplayString>{v.value}</DisplayString>
88+
</Type>
89+
<Type Name="core::sync::atomic::AtomicU32">
90+
<DisplayString>{v.value}</DisplayString>
91+
</Type>
92+
<Type Name="core::sync::atomic::AtomicU64">
93+
<DisplayString>{v.value}</DisplayString>
94+
</Type>
95+
<Type Name="core::sync::atomic::AtomicUsize">
96+
<DisplayString>{v.value}</DisplayString>
97+
</Type>
98+
</AutoVisualizer>

src/test/debuginfo/numeric-types.rs

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// only-cdb
22
// compile-flags:-g
33

4-
// Tests the visualizations for `NonZero{I,U}{8,16,32,64,128,size}` and `Wrapping<T>` in
5-
// `libcore.natvis`.
4+
// Tests the visualizations for `NonZero{I,U}{8,16,32,64,128,size}`, `Wrapping<T>` and
5+
// `Atomic{Bool,I8,I16,I32,I64,Isize,U8,U16,U32,U64,Usize}` located in `libcore.natvis`.
66

77
// === CDB TESTS ==================================================================================
88
// cdb-command: g
@@ -105,7 +105,56 @@
105105
// cdb-check:w_usize : 0x78 [Type: core::num::wrapping::Wrapping<usize>]
106106
// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<usize>]
107107

108+
// cdb-command: dx a_bool_t
109+
// cdb-check:a_bool_t : true [Type: core::sync::atomic::AtomicBool]
110+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicBool]
111+
112+
// cdb-command: dx a_bool_f
113+
// cdb-check:a_bool_f : false [Type: core::sync::atomic::AtomicBool]
114+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicBool]
115+
116+
// cdb-command: dx a_i8
117+
// cdb-check:a_i8 : 2 [Type: core::sync::atomic::AtomicI8]
118+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI8]
119+
120+
// cdb-command: dx a_i16
121+
// cdb-check:a_i16 : 4 [Type: core::sync::atomic::AtomicI16]
122+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI16]
123+
124+
// cdb-command: dx a_i32
125+
// cdb-check:a_i32 : 8 [Type: core::sync::atomic::AtomicI32]
126+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI32]
127+
128+
// cdb-command: dx a_i64
129+
// cdb-check:a_i64 : 16 [Type: core::sync::atomic::AtomicI64]
130+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI64]
131+
132+
// cdb-command: dx a_isize
133+
// cdb-check:a_isize : 32 [Type: core::sync::atomic::AtomicIsize]
134+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicIsize]
135+
136+
// cdb-command: dx a_u8
137+
// cdb-check:a_u8 : 0x40 [Type: core::sync::atomic::AtomicU8]
138+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU8]
139+
140+
// cdb-command: dx a_u16
141+
// cdb-check:a_u16 : 0x80 [Type: core::sync::atomic::AtomicU16]
142+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU16]
143+
144+
// cdb-command: dx a_u32
145+
// cdb-check:a_u32 : 0x100 [Type: core::sync::atomic::AtomicU32]
146+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU32]
147+
148+
// cdb-command: dx a_u64
149+
// cdb-check:a_u64 : 0x200 [Type: core::sync::atomic::AtomicU64]
150+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU64]
151+
152+
// cdb-command: dx a_usize
153+
// cdb-check:a_usize : 0x400 [Type: core::sync::atomic::AtomicUsize]
154+
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicUsize]
155+
108156
use std::num::*;
157+
use std::sync::atomic::*;
109158

110159
fn main() {
111160
let nz_i8 = NonZeroI8::new(11).unwrap();
@@ -136,6 +185,21 @@ fn main() {
136185
let w_u128 = Wrapping(110u128);
137186
let w_usize = Wrapping(120usize);
138187

188+
let a_bool_t = AtomicBool::new(true);
189+
let a_bool_f = AtomicBool::new(false);
190+
191+
let a_i8 = AtomicI8::new(2);
192+
let a_i16 = AtomicI16::new(4);
193+
let a_i32 = AtomicI32::new(8);
194+
let a_i64 = AtomicI64::new(16);
195+
let a_isize = AtomicIsize::new(32);
196+
197+
let a_u8 = AtomicU8::new(64);
198+
let a_u16 = AtomicU16::new(128);
199+
let a_u32 = AtomicU32::new(256);
200+
let a_u64 = AtomicU64::new(512);
201+
let a_usize = AtomicUsize::new(1024);
202+
139203
zzz(); // #break
140204
}
141205

0 commit comments

Comments
 (0)