Debian Codegraph @

Source/Core/Common/BitField.natvis

raw
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&lt;*,*,*,*&gt;">
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&lt;*,*,*,*,*&gt;">
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&lt;*,*,signed char,*&gt;">
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&lt;*,*,short,*&gt;" />
40 <AlternativeType Name="BitField&lt;*,*,int,*&gt;" />
41 <AlternativeType Name="BitField&lt;*,*,long long,*&gt;" />
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 &amp; (1 &lt;&lt; ($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&lt;*,*,*,signed char,*&gt;">
57 <AlternativeType Name="BitFieldArray&lt;*,*,*,short,*&gt;" />
58 <AlternativeType Name="BitFieldArray&lt;*,*,*,int,*&gt;" />
59 <AlternativeType Name="BitFieldArray&lt;*,*,*,long,*&gt;" />
60
61 <Expand>
62 <IndexListItems>
63 <Size>$T3</Size>
64 <ValueNode Condition="(storage &amp; (1 &lt;&lt; ($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>