xdebug / vscode-php-debug

PHP Debug Adapter for Visual Studio Code 🐞⛔
MIT License
782 stars 178 forks source link

Debugger occasionally not sending proxy stop command when using dbgpProxy #690

Open mjohn425 opened 2 years ago

mjohn425 commented 2 years ago

When connecting through to a proxy, occasionally VSCODE won't send the disconnect command when stopping the debugger, have created a work around by creating a task that always sends the proxystop command on completion. Can repeatably make this happen by getting xdebug set on a breakpoint and then trying to load a second page (without breakpoint) and then stopping debugger before the second page loads.

Causes debugger to not be able to connect back as it thinks an IDE is already connected with that key without restarting dbgp or manually sending proxystop command.

Suggested to either find out why IDE doesn't deregister or include an option such as reregisterOnStart which runs a proxystop before the proxyinit command.

PHP version: 7.4 Xdebug version: 2.9.8 & 3.1.1 VS Code extension version: v1.22.0

Your launch.json: { "name": "Listen for Xdebug Marty", "type": "php", "request": "launch", "port": 0, "proxy": { "enable": true, "host": "10.0.0.24", "port": 9001, "key": "VSCODEMARTY", }, "postDebugTask": "Fix XDEBUG" },

zobo commented 2 years ago

Hi @mjohn425 !

Thanks for reporting. I'll try to reproduce the issue as you described.

I had an idea to provide a vscode command for proxy init and stop, just not sure if you can use that in postDebugTask...

mjohn425 commented 2 years ago

It's not very well documented but after having a play around I'm pretty sure the below should work. Currently my post debug task just pipes the command into netcat but it works haha.

"tasks": [
     {
        "label": "Deregister Proxy",
        "command": "${command:php.debug.deregisterProxy}",
      },
]
jota0222 commented 1 year ago

It don't work for me lamentably, that deregisterProxy command is not available for VSCode

image

zobo commented 1 year ago

I don't think I managed to add this yet. I have an idea how to do it.