raix / vscode-perl-debug

LOOKING FOR MAINTAINERS. Perl debugger extension for visual studio code
MIT License
63 stars 35 forks source link

pause/continue for truly remote processes #82

Open hoehrmann opened 5 years ago

hoehrmann commented 5 years ago

Thinking out aloud...

It would be quite nice if the pause button would work even when the Perl script runs on a different system than vscode. Pausing means sending a SIGINT signal to the perl -d process. There is no way to break into the debugger by sending something over the TCP-backed debugger tty, but on systems that support e.g. fork, an evil hack might be possible...

Basically, the idea would be that the extension somehow creates a Perl process on the remote system that serves purely as a means to send SIGINT to other processes on that remote system. With multisession debugging, creating such a process would be just a matter of sending fork to the debugger (probably at stopOnEntry time) which would automatically connect back to the extension. The new process could then be used as a channel for SIGINT, while the old process can continue as if nothing happened.

Then, when the "old" process should be paused, we could send CORE::kill('SIGINT', 'old-process-id') to the forked process, which would cause the "old" process to break into the debugger.

That is not really something a debugging extension is supposed to do, but it would address the use case. Perhaps other people have better ideas?

raix commented 5 years ago

So a CLI to wrap perl db on remote machine?

hoehrmann commented 5 years ago

A cleaner option that would probably work just as well could be a launch.json setting like

"pauseCommand": "ssh remote kill -INT -- %pid%",
"terminateCommand": "ssh remote kill -TERM -- %pid%"