| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!-- |
| 3 |
Copyright 2015 Scott Mansell |
| 4 |
All rights reserved. |
| 5 |
|
| 6 |
SPDX-License-Identifier: BSD-3-Clause |
| 7 |
--> |
| 8 |
|
| 9 |
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> |
| 10 |
<!-- |
| 11 |
This is a re-implementation of the abstract bitfield class' algrothm (in BitField.h) |
| 12 |
for Visual Studio to use for pretty-printing during debugging. |
| 13 |
--> |
| 14 |
<Type Name="BitField<*,*,*,*>"> |
| 15 |
<DisplayString><![CDATA[{($T3)((storage >> $T1) & ((1 << $T2) - 1))}]]></DisplayString> |
| 16 |
<Expand> |
| 17 |
<Item Name="Offset">$T1</Item> |
| 18 |
<Item Name="Size">$T2</Item> |
| 19 |
</Expand> |
| 20 |
</Type> |
| 21 |
|
| 22 |
<!-- Similar re-implementation for BitFieldArray --> |
| 23 |
<Type Name="BitFieldArray<*,*,*,*,*>"> |
| 24 |
<Expand> |
| 25 |
<IndexListItems> |
| 26 |
<Size>$T3</Size> |
| 27 |
<ValueNode><![CDATA[($T4)((storage >> ($T1 + $T2*$i)) & ((1 << $T2) - 1))]]></ValueNode> |
| 28 |
</IndexListItems> |
| 29 |
<!-- Put these after the index list, so that the index list is the main thing in the unexpanded preview --> |
| 30 |
<Item Name="Offset">$T1</Item> |
| 31 |
<Item Name="Size">$T2</Item> |
| 32 |
<Item Name="Count">$T3</Item> |
| 33 |
</Expand> |
| 34 |
</Type> |
| 35 |
|
| 36 |
<!--Specialised versions for signed types--> |
| 37 |
<Type Name="BitField<*,*,signed char,*>"> |
| 38 |
<!-- It seems like we can't use s8/s16/s32/s64, nor can we use std::int8_t or the like; we have to use these names --> |
| 39 |
<AlternativeType Name="BitField<*,*,short,*>" /> |
| 40 |
<AlternativeType Name="BitField<*,*,int,*>" /> |
| 41 |
<AlternativeType Name="BitField<*,*,long long,*>" /> |
| 42 |
|
| 43 |
<!-- This is what I have do to get a sign extension in this crappy natvis "language" |
| 44 |
Basically, we check the top bit, if it's one, we add the remaining |
| 45 |
bits to the smallest (most negative) number. --> |
| 46 |
<DisplayString Condition="(storage & (1 << ($T1 + $T2 - 1))) != 0"> |
| 47 |
<![CDATA[{($T3)((-1 * (1 << ($T2-1))) + ((storage >> $T1) & ((1 << ($T2-1)) - 1)))}]]> |
| 48 |
</DisplayString> |
| 49 |
<DisplayString><![CDATA[{($T3)((storage >> $T1) & ((1 << ($T2-1)) - 1))}]]></DisplayString> |
| 50 |
<Expand> |
| 51 |
<Item Name="Offset">$T1</Item> |
| 52 |
<Item Name="Size">$T2</Item> |
| 53 |
</Expand> |
| 54 |
</Type> |
| 55 |
|
| 56 |
<Type Name="BitFieldArray<*,*,*,signed char,*>"> |
| 57 |
<AlternativeType Name="BitFieldArray<*,*,*,short,*>" /> |
| 58 |
<AlternativeType Name="BitFieldArray<*,*,*,int,*>" /> |
| 59 |
<AlternativeType Name="BitFieldArray<*,*,*,long,*>" /> |
| 60 |
|
| 61 |
<Expand> |
| 62 |
<IndexListItems> |
| 63 |
<Size>$T3</Size> |
| 64 |
<ValueNode Condition="(storage & (1 << ($T1 + $T2 * $i + $T2 - 1))) != 0"> |
| 65 |
<![CDATA[($T4)((-1 * (1 << ($T2-1))) + ((storage >> ($T1 + $T2*$i)) & ((1 << ($T2-1)) - 1)))]]> |
| 66 |
</ValueNode> |
| 67 |
<ValueNode><![CDATA[($T4)((storage >> ($T1 + $T2*$i)) & ((1 << ($T2-1)) - 1))]]></ValueNode> |
| 68 |
</IndexListItems> |
| 69 |
<Item Name="Offset">$T1</Item> |
| 70 |
<Item Name="Size">$T2</Item> |
| 71 |
<Item Name="Count">$T3</Item> |
| 72 |
</Expand> |
| 73 |
</Type> |
| 74 |
</AutoVisualizer> |