Преглед на файлове

Embed natvis in windows debug build for easier viewing of strings and Arrays

Fabian Sperber преди 3 години
родител
ревизия
0992239d86
променени са 2 файла, в които са добавени 29 реда и са изтрити 1 реда
  1. 1 1
      build.bat
  2. 28 0
      src/odin_compiler.natvis

+ 1 - 1
build.bat

@@ -58,7 +58,7 @@ set libs= ^
 set linker_flags= -incremental:no -opt:ref -subsystem:console
 
 if %release_mode% EQU 0 ( rem Debug
-	set linker_flags=%linker_flags% -debug
+	set linker_flags=%linker_flags% -debug /NATVIS:src\odin_compiler.natvis
 ) else ( rem Release
 	set linker_flags=%linker_flags% -debug
 )

+ 28 - 0
src/odin_compiler.natvis

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+	<Type Name="String">
+		<DisplayString>{text,[len]s8}</DisplayString>
+		<StringView>text,[len]s8</StringView>
+	</Type>
+	<Type Name="Array&lt;*&gt;">
+		<DisplayString>{{ size={count} capacity={capacity} }}</DisplayString>
+		<Expand>
+			<ArrayItems>
+				<Size>count</Size>
+				<ValuePointer>data</ValuePointer>
+			</ArrayItems>
+		</Expand>
+	</Type>
+	<Type Name="Slice&lt;*&gt;">
+		<DisplayString>{{ size={count} }}</DisplayString>
+		<Expand>
+			<ArrayItems>
+				<Size>count</Size>
+				<ValuePointer>data</ValuePointer>
+			</ArrayItems>
+		</Expand>
+	</Type>
+	<Type Name="lbProcedure">
+		<DisplayString>Procedure {name}</DisplayString>
+	</Type>
+</AutoVisualizer>