xdebug / vscode-php-debug

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

Inquiry about executing the run command manually by using a Linux command. #883

Closed sddfsf closed 1 year ago

sddfsf commented 1 year ago

I confirm that it's possible to execute the proxystop command by using the command "echo -e "proxystop -k \0" | nc ".

But I'd like to execute the command "run -i transaction_id" manually by using a Linux command. (reference: https://xdebug.org/docs/dbgp#continuation-commands), I've analyzed it, but it doesn't seem to work with the nc command.

Could you kindly explain how to execute the command "run -i transaction_id" manually?

zobo commented 1 year ago

Hi. All these "commands" are parts of a network protocol and get sent between a network client and server. The communication runs between a DBGP client (in this case vscode + php-debug) and a DBGP engine (PHP+Xdebug).

Proxy is a separate process where the IDE connects to it and sends proxystart or proxystop.

The proxy protocol is stateless in the sense that the client sends the command and disconnects right away. That is why we can send this one command with one shell command.

On the other hand, communication with the engine requires keeping a lot of state internally.

You could use dbgpClient instead of vscode.

Let me know why you want to run DBGP commands from command line.

sddfsf commented 1 year ago

The reason that I want to know the way for executing the command "run -i transaction_id" manually is that sometimes I restart dbgpProxy when the breakpoint becomes uncontrollable, such as when the VScode was turned off without releasing a breakpoint, etc., but it's inconvenient. so I want to manually execute the command "run -i transaction_id" with the command line.

zobo commented 1 year ago

I think I understand the issue a bit more. You run your debugging connections through dbgpProxy and if vscode disconnects abruptly a debugged PHP script can get stuck. I see this as a problem of the proxy, not so much of the IDE.

@derickr how should the proxy behave in a situation where an IDE disconnects uncontrollably (crash)?

I will try to validate it.

derickr commented 1 year ago

The proxy can't know whether the IDE has gone, until it tries to send it data. If the state is that it is waiting for an IDE command, then it will not find out. I will see if I can set-up TCP pings --- perhaps file a ticket so I won't forget?

sddfsf commented 1 year ago

@derickr It would be appreciated if you can provide whatever I need to solve the problem. Can I ask what ticket you need?

zobo commented 1 year ago

I have researched the issue and proposed a fix to Derick. Will leave this open for a short while.

zobo commented 1 year ago

The linked issue on dbgp proxy was implemented, so I will close this one.