actboy168 / lua-debug

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

Debugging mpv media player on Linux #207

Closed stax76 closed 1 year ago

stax76 commented 1 year ago

On Windows, I successfully used lua-debug, now I want to try using lua-debug on Linux. For this, I compiled mpv with debug symbols. When I start debugging, I get the message 'runtimeExecutable' need specify inject or address, my launch.json config is:

{
    "name": "mpv lua linux",
    "type": "lua",
    "request": "launch",
    "console": "internalConsole",
    "runtimeExecutable": "mpvd",
    "runtimeArgs": ["--script=${file}", "/media/user/Data/Samples/demo.mkv"],
    "stopOnEntry": false,
    "luaVersion": "5.1"
},

Is there something wrong with my configuration, or maybe with my mpv build?

actboy168 commented 1 year ago

Process injection is only implemented on windows. You need to inject the debugger yourself, and let vscode connect to the debugger. e.g. https://github.com/actboy168/lua-debug/tree/master/examples/attach

{
    "name": "mpv lua linux",
    "type": "lua",
    "request": "launch",
    "console": "internalConsole",
    "runtimeExecutable": "mpvd",
    "runtimeArgs": ["--script=${file}", "/media/user/Data/Samples/demo.mkv"],
    "address": "127.0.0.1:12306",
    "stopOnEntry": false,
    "luaVersion": "5.1"
},
stax76 commented 1 year ago

I see, thanks.