actboy168 / lua-debug

Lua Debug Adapter for Visual Studio Code
MIT License
439 stars 95 forks source link

Lua Debug: Launch Process doesn't work since v2.0.0 #274

Closed yosoymin closed 1 year ago

yosoymin commented 1 year ago

In the latest version 2.0.0, the lua debugging doesn't work when you specify runtimeExecutable and runtimeArgs to the launch.json configuration. Attach Process configuration doesn't work either. However, the Launch Script configuration it's working properly.

Bashakov commented 1 year ago

I have the same problem, launching with and without debugging does not work. I don't use "runtimeExecutable" and "runtimeArgs". lua-debug.exe process actively uses the CPU. Process monitor, show that lua-debug.exe constantly opens and closes file C:\Users\user.vscode\extensions\actboy168.lua-debug-2.0.0-win32-x64\tmp\pid_xxxx

actboy168 commented 1 year ago

I have the same problem, launching with and without debugging does not work. I don't use "runtimeExecutable" and "runtimeArgs". lua-debug.exe process actively uses the CPU. Process monitor, show that lua-debug.exe constantly opens and closes file C:\Users\user.vscode\extensions\actboy168.lua-debug-2.0.0-win32-x64\tmp\pid_xxxx

@Bashakov It doesn't look like the same problem. Can you provide a reproducible example?

yosoymin commented 1 year ago

It seems the version 2.0.1 solves the runtimeExecutable problem. Thanks!

Bashakov commented 1 year ago

@Bashakov It doesn't look like the same problem. Can you provide a reproducible example?

Steps to reproduce:

Sometimes debug works as expected, i can step on code with F10, and program print "Hi" in terminal, full terminal output looks like:

PS C:\3>  & 'c:/Users/user/.vscode/extensions/actboy168.lua-debug-2.0.1-win32-x64/runtime/win32-x64/lua54/lua.exe' '-e' 'dofile[[c:/Users/user/.vscode/extensions/actboy168.lua-debug-2.0.1-win32-x64/script/launch.lua]];DBG[[6476-ansi]]' 'C:\3/1.lua'
Hi

but often vs code doesn't start debugging, scroll endless progress bar in "Debug and Run panel". And print in terminal only prepare command without program output:

PS C:\3>  c:; cd 'c:\3'; & 'c:/Users/user/.vscode/extensions/actboy168.lua-debug-2.0.1-win32-x64/runtime/win32-x64/lua54/lua.exe' '-e' 'dofile[[c:/Users/user/.vscode/extensions/actboy168.lua-debug-2.0.1-win32-x64/script/launch.lua]];DBG[[10480-ansi]]' 'C:\3/1.lua'

I use Processmon to capture success and fail run and discovered something interesting:

if successful I see:

in case of failure:

master.log contains messages like: [2023-10-11 09:29:10:039][[string " package.path = "c:/Users/user/.vsc..."]: 12][ERROR]ERROR:...y168.lua-debug-2.0.1-win32-x64/script/common\network.lua:77: bind: (Windows:10048)Обычно разрешается только одно использование адреса сокета (протокол/сетевой адрес/порт). stack traceback: [C]: in function 'assert' ...y168.lua-debug-2.0.1-win32-x64/script/common\network.lua:77: in function 'common.network'

    [C]: in function 'xpcall'
    [string "        package.path = "c:/Users/user/.vsc..."]:5: in main chunk
    [C]: in ?
actboy168 commented 1 year ago

@Bashakov What is the Windows version number you are using?

Bashakov commented 1 year ago

Windows 10. Also i have instaled urbackup and Everything, which install own fs filters, may be it cause problem.

actboy168 commented 1 year ago

More detailed version number. I mean 21H2 or 19044 like this.

Bashakov commented 1 year ago

Windows 10 Enterprise, 21H1, 19043.1083

actboy168 commented 1 year ago

By default, lua-debug.exe uses unix domain socket to establish a connection with lua.exe. I don't know if there is some reason why your environment cannot use unix domain socket. You can try to use tcp instead. Add in launch.json:

"address": "127.0.0.1:<port>"
Bashakov commented 1 year ago

Looks like "address" fix the problem. All runs work as expected without problems, thx! Can I set this settings global, instead for each configurations in launch.json?