diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-09-17 10:16:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-17 10:16:18 +0200 |
commit | 1e201163b9afdee929f69d9ee4c2ef13a12b6c28 (patch) | |
tree | 7d49de77c677535d6b921b406e101a56c7dcb5aa | |
parent | e522baf0b78ae475685e890059afd7f402b21541 (diff) | |
parent | af1e94543562fe0f1ad5bfa49f47115546da8af2 (diff) |
Merge pull request #22134 from elasota/natvis
Add Visual Studio debug visualizer
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | platform/windows/SCsub | 1 | ||||
-rw-r--r-- | platform/windows/godot.natvis | 129 |
4 files changed, 131 insertions, 3 deletions
diff --git a/.gitattributes b/.gitattributes index 03c6f96f80..47ba2b45bb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ drivers/* linguist-vendored *.py eol=lf *.hpp eol=lf *.xml eol=lf +*.natvis eol=lf diff --git a/.gitignore b/.gitignore index 420a25ac59..52937b8679 100644 --- a/.gitignore +++ b/.gitignore @@ -101,9 +101,6 @@ bld/ # Hints for improving IntelliSense, created together with VS project cpp.hint -# Visualizers for the VS debugger -*.natvis - #NUNIT *.VisualState.xml TestResult.xml diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 586533e817..5dfb1592e0 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -29,6 +29,7 @@ prog = env.add_program('#bin/godot', common_win + res_obj, PROGSUFFIX=env["PROGS # Microsoft Visual Studio Project Generation if env['vsproj']: env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file] + env.vs_srcs = env.vs_srcs + ["platform/windows/godot.natvis"] for x in common_win: env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)] diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis new file mode 100644 index 0000000000..01963035a1 --- /dev/null +++ b/platform/windows/godot.natvis @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="utf-8"?> +<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> + <Type Name="Vector<*>"> + <Expand> + <Item Name="size">(_cowdata && _cowdata->_ptr) ? (((const unsigned int *)(_cowdata->_ptr))[-1]) : 0</Item> + <ArrayItems> + <Size>(_cowdata && _cowdata->_ptr) ? (((const unsigned int *)(_cowdata->_ptr))[-1]) : 0</Size> + <ValuePointer>(_cowdata) ? (_cowdata->_ptr) : 0</ValuePointer> + </ArrayItems> + </Expand> + </Type> + + <Type Name="PoolVector<*>"> + <Expand> + <Item Name="size">alloc ? (alloc->size / sizeof($T1)) : 0</Item> + <ArrayItems> + <Size>alloc ? (alloc->size / sizeof($T1)) : 0</Size> + <ValuePointer>alloc ? (($T1 *)alloc->mem) : 0</ValuePointer> + </ArrayItems> + </Expand> + </Type> + + <Type Name="Variant"> + <DisplayString Condition="this->type == Variant::NIL">nil</DisplayString> + <DisplayString Condition="this->type == Variant::BOOL">{_data._bool}</DisplayString> + <DisplayString Condition="this->type == Variant::INT">{_data._int}</DisplayString> + <DisplayString Condition="this->type == Variant::REAL">{_data._real}</DisplayString> + <DisplayString Condition="this->type == Variant::TRANSFORM2D">{_data._transform2d}</DisplayString> + <DisplayString Condition="this->type == Variant::AABB">{_data._aabb}</DisplayString> + <DisplayString Condition="this->type == Variant::BASIS">{_data._basis}</DisplayString> + <DisplayString Condition="this->type == Variant::TRANSFORM">{_data._transform}</DisplayString> + <DisplayString Condition="this->type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::STRING && ((String *)(&_data._mem[0]))->_cowdata._ptr == 0">""</DisplayString> + <DisplayString Condition="this->type == Variant::STRING && ((String *)(&_data._mem[0]))->_cowdata._ptr != 0">{((String *)(&_data._mem[0]))->_cowdata._ptr,su}</DisplayString> + <DisplayString Condition="this->type == Variant::VECTOR2">{*(Vector2 *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::RECT2">{*(Rect2 *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::VECTOR3">{*(Vector3 *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::PLANE">{*(Plane *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::_RID">{*(RID *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::OBJECT">{*(Object *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::DICTIONARY">{*(Dictionary *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::POOL_BYTE_ARRAY">{*(PoolByteArray *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::POOL_INT_ARRAY">{*(PoolIntArray *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::POOL_REAL_ARRAY">{*(PoolRealArray *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::POOL_STRING_ARRAY">{*(PoolStringArray *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::POOL_VECTOR2_ARRAY">{*(PoolVector2Array *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::POOL_VECTOR3_ARRAY">{*(PoolVector3Array *)_data._mem}</DisplayString> + <DisplayString Condition="this->type == Variant::POOL_COLOR_ARRAY">{*(PoolColorArray *)_data._mem}</DisplayString> + + <StringView Condition="this->type == Variant::STRING && ((String *)(&_data._mem[0]))->_cowdata._ptr != 0">((String *)(&_data._mem[0]))->_cowdata._ptr,su</StringView> + + <Expand> + <Item Name="value" Condition="this->type == Variant::BOOL">_data._bool</Item> + <Item Name="value" Condition="this->type == Variant::INT">_data._int</Item> + <Item Name="value" Condition="this->type == Variant::REAL">_data._real</Item> + <Item Name="value" Condition="this->type == Variant::TRANSFORM2D">_data._transform2d</Item> + <Item Name="value" Condition="this->type == Variant::AABB">_data._aabb</Item> + <Item Name="value" Condition="this->type == Variant::BASIS">_data._basis</Item> + <Item Name="value" Condition="this->type == Variant::TRANSFORM">_data._transform</Item> + <Item Name="value" Condition="this->type == Variant::ARRAY">*(Array *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::STRING">*(String *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::VECTOR2">*(Vector2 *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::RECT2">*(Rect2 *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::VECTOR3">*(Vector3 *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::PLANE">*(Plane *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::QUAT">*(Quat *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::COLOR">*(Color *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::_RID">*(RID *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::OBJECT">*(Object *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::DICTIONARY">*(Dictionary *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::ARRAY">*(Array *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::POOL_BYTE_ARRAY">*(PoolByteArray *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::POOL_INT_ARRAY">*(PoolIntArray *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::POOL_REAL_ARRAY">*(PoolRealArray *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::POOL_STRING_ARRAY">*(PoolStringArray *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::POOL_VECTOR2_ARRAY">*(PoolVector2Array *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::POOL_VECTOR3_ARRAY">*(PoolVector3Array *)_data._mem</Item> + <Item Name="value" Condition="this->type == Variant::POOL_COLOR_ARRAY">*(PoolColorArray *)_data._mem</Item> + </Expand> + </Type> + + <Type Name="String"> + <DisplayString Condition="this->_cowdata._ptr == 0">empty</DisplayString> + <DisplayString Condition="this->_cowdata._ptr != 0">{this->_cowdata._ptr,su}</DisplayString> + <StringView Condition="this->_cowdata._ptr != 0">this->_cowdata._ptr,su</StringView> + </Type> + + <Type Name="Vector2"> + <DisplayString>{{{x},{y}}}</DisplayString> + <Expand> + <Item Name="x">x</Item> + <Item Name="y">y</Item> + </Expand> + </Type> + + <Type Name="Vector3"> + <DisplayString>{{{x},{y},{z}}}</DisplayString> + <Expand> + <Item Name="x">x</Item> + <Item Name="y">y</Item> + <Item Name="z">z</Item> + </Expand> + </Type> + + <Type Name="Quat"> + <DisplayString>Quat {{{x},{y},{z},{w}}}</DisplayString> + <Expand> + <Item Name="x">x</Item> + <Item Name="y">y</Item> + <Item Name="z">z</Item> + <Item Name="w">w</Item> + </Expand> + </Type> + + <Type Name="Color"> + <DisplayString>Color {{{r},{g},{b},{a}}}</DisplayString> + <Expand> + <Item Name="red">r</Item> + <Item Name="green">g</Item> + <Item Name="blue">b</Item> + <Item Name="alpha">a</Item> + </Expand> + </Type> +</AutoVisualizer> |