WheretIB / LuaDkmDebugger

Visual Studio C++ debugger extensions for Lua
MIT License
84 stars 32 forks source link

LuaJIT support? #8

Closed Xottab-DUTY closed 3 years ago

Xottab-DUTY commented 3 years ago

Could you look into adding support for LuaJIT, or maybe give an advice where should I start to try adding support for it?

WheretIB commented 3 years ago

I've looked into luajit engine and at the moment I don't see a clear path to support it, even in jit_off mode (probably the only mode that can be realistically supported with this style of the debugger) It seems to use naked assembly language functions that messes up Visual Studio call stack.

I want to take a look again, maybe the application will have to include some support code to help with debugger interactions. But I would not expect a solution to come soon.

Xottab-DUTY commented 3 years ago

Any progress?)

WheretIB commented 3 years ago

I have published an experimental Beta release with LuaJIT support (2.0.5 and 2.1.0 with some limitations): https://github.com/WheretIB/LuaDkmDebugger/releases/tag/v0.9.7

Feel free to install the LuaDkmDebugger.vsix and try it out. You can report issues with that version here (if it works at all). Keep in mind that LuaJIT dll has to be built with debug information (/debug) switch. It will not affect the performance since that flag doesn't disable optimizations.

I haven't done extensive testing of all supported versions and features for this release so bugs are possible.

Xottab-DUTY commented 3 years ago

It generally works! image Little issues:

  1. It doesn't show full C++ -> LuaJIT -> C++ callstack, only LuaJIT -> C++
  2. Lua Script List window is empty.
  3. It doesn't show little window when you hover over the variable. (but variables are shown in the Locals window)
WheretIB commented 3 years ago

I have received a copy of S.T.A.L.K.E.R.: Call of Pripyat and I can now debug additional issues with the debugger:

Lua Script List works with an upcoming fix to the hang on lua_newstate. I will work to fix some issues before new release.

WheretIB commented 3 years ago

LuaJIT support has been released in https://github.com/WheretIB/LuaDkmDebugger/releases/tag/v0.9.8 and on Marketplace. Some limitations remain, but most features should be usable.

Xottab-DUTY commented 3 years ago

Yaay, thank you!

WheretIB commented 3 years ago

A small note on C++ -> Lua callstack, it's actually a C++ debugger issue in x86 (works fine in x64). I've looked at APIs that could've helped unwind the frames, but that component for C++ is made by Microsoft.