lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It looks like you're hitting a natvis parse error, or some other reason the natvis you have wasn't able to give you something.

Try turning on natvis debugging as by default VS likes to silently fail on natvis errors:
https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2022#BKMK_Diagnosing_Natvis_errors

I've not had any problems using the same lua natvis file in VS2015 and VS2019 so I doubt it's a Visual studio versioning issue.

One problem I've found is that Visual Studio can have trouble disambiguating identically named structs/classes in static library includes, which can trigger errors like what you're seeing. For eg something in a static library dependency of my project defined an internal `struct Table` which scuppered my attempts to make a visualisation for the Lua Table struct (and yes, I tried all the documented scoping I could think of). If you're hitting such a case, my workaround was to declare lookalike structs with a different name in my actual project code (eg `struct lua_Table`) and cast to those types in my natvis file.

I think this may only be an issue for static library dependencies - as Beniot says there's supposed to be a syntax for disambiguating DLL symbols. But it's useless if the symbol is in the same EXE/DLL as the the Lua runtime due to a static library inclusion. Hopefully the Natvis Diagnostics will tell you if this is the issue you're seeing. Eg if it says something like "couldn't find foo.bar" when you know that the Lua declaration of `foo` definitely contains a `bar`.

If so I have a natvis file for 5.3 I can probably share, with the workarounds I mentioned, but it's only any use if you have the ability to make source code changes to declare the appropraite lookalike structs.

Cheers,

Tom

> On 25 Nov 2021, at 4:55 pm, Benoit Germain <bnt.germain@gmail.com> wrote:
> 
> Might be you need context information in your watch. Something like
> {,,lua53.dll}(lua_State*)L
> 
> Le jeu. 25 nov. 2021 à 16:27, Simon Lambert <simon.lambert.4@gmail.com> a écrit :
> Hey Benoit,
> Thank you for the quick answer but I still can't make it work... I've been using other .natvis in my project so I know where to place it but I only see this (like the lua_State attributes "top, ci, func" are not recognized):
> 
>    <Type Name="lua_State">
>         <DisplayString>stack top = {top-(ci->func+1),d}</DisplayString>
>     </Type>
> <image.png>
> 
> I did a quick test to demonstrate that my file is being executed properly:
>    <Type Name="lua_State">
>         <DisplayString>Test1</DisplayString>
>     </Type>
> <image.png>
> 
> 
> I don't know if it makes a difference but I'm using Visual Studio 2017.
> 
> Thanks,
> Simon
> 
> On Thu, Nov 25, 2021 at 3:39 AM Benoit Germain <bnt.germain@gmail.com> wrote:
> 
> 
> Le mer. 24 nov. 2021 à 23:21, Simon Lambert <simon.lambert.4@gmail.com> a écrit :
> Looking for a Visual Studio .natvis file for Lua 5.3 to help debugging the stack.
> 
> 
> -- 
> Benoit.
> 
> 
> -- 
> Benoit.