Browse Source

debuggers: add MSVC natvis files.

pull/620/head
Pablo Escobar 3 years ago
parent
commit
e1583700e5
  1. 15
      doc/debuggers.dox
  2. 4
      src/debuggers/CMakeLists.txt
  3. 104
      src/debuggers/natvis/magnum.natvis

15
doc/debuggers.dox

@ -4,6 +4,7 @@
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
Copyright © 2022 Guillaume Jacquemin <williamjcm@users.noreply.github.com>
Copyright © 2023 Pablo Escobar <mail@rvrs.in>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -65,5 +66,19 @@ and [CLion docs](https://www.jetbrains.com/help/clion/configuring-debugger-optio
for more information.
See also @ref corrade-debuggers-gdb-pretty-printers "Corrade GDB pretty printers".
@section magnum-debuggers-natvis MSVC Natvis files
The [src/debuggers/natvis](https://github.com/mosra/magnum/tree/master/src/debuggers/natvis)
directory contains MSVC natvis files for important @ref Math classes. Contents
of this directory are also copied into @cb{.sh} ${CMAKE_PREFIX_PATH}/share/magnum/debuggers/natvis @ce
during installation.
Easiest way to use is to copy them to the user-specific Natvis directory for
given version of Visual Studio, such as @cb{.bat} %USERPROFILE%/Documents/Visual Studio 2022/Visualizers @ce.
For more information consult the corresponding [Natvis docs](https://learn.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2022).
See also @ref corrade-debuggers-natvis "Corrade MSVC Natvis files".
*/
}

4
src/debuggers/CMakeLists.txt

@ -28,3 +28,7 @@
if(NOT CORRADE_TARGET_MSVC AND NOT CORRADE_TARGET_EMSCRIPTEN)
install(DIRECTORY gdb DESTINATION ${MAGNUM_DATA_INSTALL_DIR}/debuggers)
endif()
if(CORRADE_TARGET_MSVC)
install(DIRECTORY natvis DESTINATION ${MAGNUM_DATA_INSTALL_DIR}/debuggers)
endif()

104
src/debuggers/natvis/magnum.natvis

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
Copyright © 2021 Jonathan Hale <squareys@googlemail.com>
Copyright © 2023 Pablo Escobar <mail@rvrs.in>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Math::Range -->
<Type Name="Magnum::Math::Range&lt;*&gt;">
<DisplayString IncludeView="simple">[{_min,g}, {_max,g}]</DisplayString>
<DisplayString ExcludeView="simple">{{ min={_min,g} max={_max,g} }}</DisplayString>
</Type>
<!-- Math::Vector2 -->
<Type Name="Magnum::Math::Vector&lt;2,*&gt;">
<DisplayString IncludeView="simple">{{ {_data[0],g}, {_data[1],g} }}</DisplayString>
<DisplayString ExcludeView="simple">{{ x={_data[0],g} y={_data[1],g} }}</DisplayString>
</Type>
<!-- Math::Vector3 -->
<Type Name="Magnum::Math::Vector&lt;3,*&gt;">
<DisplayString IncludeView="simple">{{ {_data[0],g}, {_data[1],g}, {_data[2],g} }}</DisplayString>
<DisplayString ExcludeView="simple">{{ x={_data[0],g} y={_data[1],g} z={_data[2],g} }}</DisplayString>
</Type>
<!-- Math::Vector4 -->
<Type Name="Magnum::Math::Vector&lt;4,*&gt;">
<DisplayString IncludeView="simple">{{ {_data[0],g}, {_data[1],g}, {_data[2],g}, {_data[3],g} }}</DisplayString>
<DisplayString ExcludeView="simple">{{ x={_data[0],g} y={_data[1],g} z={_data[2],g} w={_data[3],g} }}</DisplayString>
</Type>
<!-- Math::BitVector2 -->
<Type Name="Magnum::Math::BitVector&lt;2&gt;">
<Intrinsic Name="at" Category="Method" Expression="(bool)((_data[0] &gt;&gt; i) &amp; 1)">
<Parameter Name="i" Type="int" />
</Intrinsic>
<DisplayString>{{ {at(0)}, {at(1)} }}</DisplayString>
</Type>
<!-- Math::BitVector3 -->
<Type Name="Magnum::Math::BitVector&lt;3&gt;">
<Intrinsic Name="at" Category="Method" Expression="(bool)((_data[0] &gt;&gt; i) &amp; 1)">
<Parameter Name="i" Type="int" />
</Intrinsic>
<DisplayString>{{ {at(0)}, {at(1)}, {at(2)} }}</DisplayString>
</Type>
<!-- Math::BitVector4 -->
<Type Name="Magnum::Math::BitVector&lt;4&gt;">
<Intrinsic Name="at" Category="Method" Expression="(bool)((_data[0] &gt;&gt; i) &amp; 1)">
<Parameter Name="i" Type="int" />
</Intrinsic>
<DisplayString>{{ {at(0)}, {at(1)}, {at(2)}, {at(3)} }}</DisplayString>
</Type>
<!-- Math::Color3 -->
<Type Name="Magnum::Math::Color3&lt;*&gt;">
<DisplayString IncludeView="simple">{{ {_data[0],g}, {_data[1],g}, {_data[2],g} }}</DisplayString>
<DisplayString ExcludeView="simple">{{ r={_data[0],g} g={_data[1],g} b={_data[2],g} }}</DisplayString>
</Type>
<!-- Math::Color4 -->
<Type Name="Magnum::Math::Color4&lt;*&gt;">
<DisplayString IncludeView="simple">{{ {_data[0],g}, {_data[1],g}, {_data[2],g}, {_data[3],g} }}</DisplayString>
<DisplayString ExcludeView="simple">{{ r={_data[0],g} g={_data[1],g} b={_data[2],g} a={_data[3],g} }}</DisplayString>
</Type>
<!-- Math::ColorHsv -->
<Type Name="Magnum::Math::ColorHsv&lt;*&gt;">
<DisplayString IncludeView="simple">{{ {hue._value,g}, {saturation,g}, {value,g} }}</DisplayString>
<DisplayString ExcludeView="simple">{{ h={hue._value,g} s={saturation,g} v={value,g} }}</DisplayString>
</Type>
<!-- Math::Quaternion -->
<Type Name="Magnum::Math::Quaternion&lt;*&gt;">
<DisplayString IncludeView="simple">{{ {_vector._data[0],g}, {_vector._data[1],g}, {_vector._data[2],g}, {_scalar,g} }}</DisplayString>
<DisplayString ExcludeView="simple">{{ x={_vector._data[0],g} y={_vector._data[1],g} z={_vector._data[2],g} w={_scalar,g} }}</DisplayString>
</Type>
<!-- Math::RectangularMatrix -->
<Type Name="Magnum::Math::RectangularMatrix&lt;*&gt;">
<DisplayString>{($T3 *)_data,[$T1*$T2]nag}</DisplayString>
<Expand>
<ArrayItems>
<Direction>Forward</Direction>
<Rank>2</Rank>
<Size>$i == 0 ? $T1 : $T2</Size>
<ValuePointer>($T3 *)_data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>
Loading…
Cancel
Save