WheretIB / LuaDkmDebugger

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

Hello, can you provide an example that can be debugged. #7

Closed brinkqiang closed 3 years ago

brinkqiang commented 3 years ago

Hello, can you provide an example that can be debugged. I tested several projects and it didn’t work. I will provide a case https://github.com/brinkqiang/dmlua

WheretIB commented 3 years ago

Here's an example project for Visual Studio 2019: lua_dbg_example.zip

Open 'test.lua' file in 'lua_application' project 'Source Files' filter, place some breakpoints and run.

brinkqiang commented 3 years ago

Still unable to debug, can you use ShareX to record animated gif to describe the debugging setup process? My development environment is vs2019-16.8.3/WIN10.

brinkqiang commented 3 years ago

debug2

brinkqiang commented 3 years ago

After testing, I found that if you set a breakpoint in the lua_pcallk function in advance, you can debug it. Remove it and you can’t.

brinkqiang commented 3 years ago

debug3

WheretIB commented 3 years ago

Thank you for additional information, I have found that there might be a race condition between script load and Visual Studio breakpoint state refresh. I'll investigate how this can be fixed.

WheretIB commented 3 years ago

Breakpoints at the start of a script that was executed immediately after load didn't have enough time to refresh.

Fix for this was added in https://github.com/WheretIB/LuaDkmDebugger/releases/tag/v0.9.5 release. Marketplace extension will soon be updated.