Modify type names on MSVC to make strings and slices .natvis compatible.
This commit is contained in:
parent
5d5e67a966
commit
8e10c4d55d
2 changed files with 35 additions and 4 deletions
24
src/etc/natvis/intrinsic.natvis
Normal file
24
src/etc/natvis/intrinsic.natvis
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="str">
|
||||
<DisplayString>{data_ptr,[length]}</DisplayString>
|
||||
<StringView>data_ptr,[length]</StringView>
|
||||
<Expand>
|
||||
<Item Name="[size]" ExcludeView="simple">length</Item>
|
||||
<ArrayItems>
|
||||
<Size>length</Size>
|
||||
<ValuePointer>data_ptr</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
<Type Name="slice<*>">
|
||||
<DisplayString>{{ length={length} }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[size]" ExcludeView="simple">length</Item>
|
||||
<ArrayItems>
|
||||
<Size>length</Size>
|
||||
<ValuePointer>data_ptr</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
||||
|
|
@ -61,21 +61,27 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
output.push(')');
|
||||
},
|
||||
ty::TyRawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => {
|
||||
output.push('*');
|
||||
let is_like_msvc = cx.sess().target.target.options.is_like_msvc;
|
||||
|
||||
if !is_like_msvc {output.push('*');}
|
||||
match mutbl {
|
||||
hir::MutImmutable => output.push_str("const "),
|
||||
hir::MutMutable => output.push_str("mut "),
|
||||
}
|
||||
|
||||
push_debuginfo_type_name(cx, inner_type, true, output);
|
||||
if is_like_msvc {output.push('*');}
|
||||
},
|
||||
ty::TyRef(_, ty::TypeAndMut { ty: inner_type, mutbl }) => {
|
||||
output.push('&');
|
||||
let is_like_msvc = cx.sess().target.target.options.is_like_msvc;
|
||||
|
||||
if !is_like_msvc {output.push('&');}
|
||||
if mutbl == hir::MutMutable {
|
||||
output.push_str("mut ");
|
||||
}
|
||||
|
||||
push_debuginfo_type_name(cx, inner_type, true, output);
|
||||
if is_like_msvc {output.push('*');}
|
||||
},
|
||||
ty::TyArray(inner_type, len) => {
|
||||
output.push('[');
|
||||
|
|
@ -84,9 +90,10 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
output.push(']');
|
||||
},
|
||||
ty::TySlice(inner_type) => {
|
||||
output.push('[');
|
||||
let is_like_msvc = cx.sess().target.target.options.is_like_msvc;
|
||||
output.push_str(if is_like_msvc {"slice<"} else {"["});
|
||||
push_debuginfo_type_name(cx, inner_type, true, output);
|
||||
output.push(']');
|
||||
output.push(if is_like_msvc {'>'} else {']'});
|
||||
},
|
||||
ty::TyDynamic(ref trait_data, ..) => {
|
||||
if let Some(principal) = trait_data.principal() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue