[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Visual Studio .natvis file for Lua 5.3
- From: Benoit Germain <bnt.germain@...>
- Date: Thu, 25 Nov 2021 09:38:39 +0100
Looking for a Visual Studio .natvis file for Lua 5.3 to help debugging the stack.
--
Benoit.
<?xml version="1.0" encoding="utf-8"?>
<!--
Add a link to this file in %USER%\Documents\Visual Studio 2015\Visualizers\ with mklink command line tool.
Or add this file to the vcproj you are debugging.
You can then watch a Lua State with {,,lua53.dll}*(lua_State*)pointer
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="lua_State">
<DisplayString>stack top = {top-(ci->func+1),d}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="count" InitialValue="top-(ci->func+1)"/>
<Variable Name="index" InitialValue="0"/>
<Loop>
<Break Condition="index == count"/>
<Item Name="[{-1-index,d}]">ci->func[count-index]</Item>
<Exec>++ index</Exec>
</Loop>
</CustomListItems>
<Item Name="[registry]">l_G->l_registry</Item>
</Expand>
</Type>
<Type Name="lua_TValue">
<DisplayString Condition="this == &luaO_nilobject_"> NIL </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 0)"> nil </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 1)"> <BOOL> {value_.b,d} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 2)"> <LDAT> {value_.p} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 3) && ((tt_ & 0x30) == 0x00)"> <FNUM> {value_.n} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 3) && ((tt_ & 0x30) == 0x10)"> <INUM> {value_.i} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 4) && ((tt_ & 0x30) == 0x00)"> <SSTR> {*(TString*)value_.gc} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 4) && ((tt_ & 0x30) == 0x10)"> <LSTR> {*(TString*)value_.gc} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 5)"> <TABL> {*(Table*)value_.gc} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 6) && ((tt_ & 0x30) == 0x00)"> <LCLO> {*(LClosure*)value_.gc} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 6) && ((tt_ & 0x30) == 0x10)"> <FPTR> {value_.f} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 6) && ((tt_ & 0x30) == 0x20)"> <CCLO> {*(CClosure*)value_.gc} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 7)"> <UDAT> {*((Udata*)value_.gc)} </DisplayString>
<DisplayString Condition="((tt_ & 0xf) == 8)"> <THRD> {*(lua_State*)value_.gc} </DisplayString>
<DisplayString> unknown ({tt_}) </DisplayString>
<Expand>
<Item Condition="((tt_ & 0xf) == 5)" Name="[contents]">*(Table*)value_.gc</Item>
<Item Condition="((tt_ & 0xf) == 6) && ((tt_ & 0x30) == 0x00)" Name="[Lua closure]">*(LClosure*)value_.gc</Item>
<Item Condition="((tt_ & 0xf) == 6) && ((tt_ & 0x30) == 0x20)" Name="[C Closure]">*(CClosure*)value_.gc</Item>
<Item Condition="((tt_ & 0xf) == 7)" Name="[full userdata]">*(Udata*)value_.gc</Item>
<Item Condition="((tt_ & 0xf) == 8)" Name="[thread]">*(lua_State*)value_.gc</Item>
</Expand>
</Type>
<Type Name="Udata">
<DisplayString>{(void*)(this+1)}</DisplayString>
<Expand>
<Item Name="[metatable]" Condition="metatable!=nullptr"> *metatable </Item>
<Item Name="[uservalue: nil]" Condition="((ttuv_ & 0xf) == 0)"> "nil",sb </Item>
<Item Name="[uservalue: boolean]" Condition="((ttuv_ & 0xf) == 1)"> user_.b,d </Item>
<Item Name="[uservalue: light userdata]" Condition="((ttuv_ & 0xf) == 2)"> user_.p </Item>
<Item Name="[uservalue: integer]" Condition="((ttuv_ & 0xf) == 3) && ((ttuv_ & 0x30) == 0x00)"> user_.n </Item>
<Item Name="[uservalue: number]" Condition="((ttuv_ & 0xf) == 3) && ((ttuv_ & 0x30) == 0x10)"> user_.i </Item>
<Item Name="[uservalue: short string]" Condition="((ttuv_ & 0xf) == 4) && ((ttuv_ & 0x30) == 0x00)"> *(TString*)user_.gc </Item>
<Item Name="[uservalue: long string]" Condition="((ttuv_ & 0xf) == 4) && ((ttuv_ & 0x30) == 0x10)"> *(TString*)user_.gc </Item>
<Item Name="[uservalue: table]" Condition="((ttuv_ & 0xf) == 5)"> *(Table*)user_.gc </Item>
<Item Name="[uservalue: full userdata]" Condition="((ttuv_ & 0xf) == 7)"> *(Udata*)user_.gc </Item>
<Item Name="[uservalue: thread]" Condition="((ttuv_ & 0xf) == 8)"> *(lua_State*)user_.gc </Item>
<Item Name="[uservalue: unknown]" Condition="((ttuv_ & 0xf) > 8)"> user_ </Item>
</Expand>
</Type>
<Type Name="TString">
<DisplayString>{(char*)(this+1),s}</DisplayString>
</Type>
<Type Name="Table">
<DisplayString>sizearray={sizearray,d} sizenode={1<<lsizenode,d}</DisplayString>
<Expand>
<Item Name="metatable" Condition="metatable!=nullptr">metatable</Item>
<Item Name="[array size]">sizearray,d</Item>
<CustomListItems MaxItemsPerView="100">
<Variable Name="node" InitialValue="(TValue*)0"/>
<Variable Name="inode" InitialValue="0"/>
<Loop>
<Break Condition="inode>=sizearray"/>
<Item>array[inode]</Item>
<Exec>++ inode</Exec>
</Loop>
</CustomListItems>
<Item Name="[node size]">1<<lsizenode,d</Item>
<CustomListItems MaxItemsPerView="100">
<Variable Name="mynode" InitialValue="node"/>
<Variable Name="lastnode" InitialValue="node+(1<<lsizenode)"/>
<Loop>
<Break Condition="mynode>=lastnode"/>
<Item>*mynode</Item>
<Exec>++ mynode</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<Type Name="Node">
<DisplayString>[{i_key}] = {i_val}</DisplayString>
<!--
<Expand>
<Item Name="[key]">i_key.tvk</Item>
<Item Name="[val]">i_val</Item>
</Expand>
-->
</Type>
<Type Name="TKey">
<DisplayString>{tvk}</DisplayString>
</Type>
<Type Name="LClosure">
<DisplayString>Lua function defined at {p->source}:{p->linedefined,d}->{p->lastlinedefined,d}</DisplayString>
</Type>
<!--
<Type Name="CClosure">
<DisplayString>{f}</DisplayString>
</Type>
<Type Name="Closure">
<DisplayString>{c}</DisplayString>
</Type>
-->
</AutoVisualizer>