Vscode-php-debug: DBGp proxy

Created on 29 Nov 2016  路  14Comments  路  Source: xdebug/vscode-php-debug

Most helpful comment

As seen on the latest merge there were an successfull attempt to implement dbGp proxy support, thus I want to know has it been integrated to the next release?

All 14 comments

Never tried it. Have you tried connecting to the proxy? Are you getting any errors?

Sorry I am a newbie about this topic.
In PHPStorm I can set dbgp proxy in its settings. How Can I try to connect to the proxy in vscode?

There are no proxy-related settings in VS Code. I don't know how the proxy works - if it doesn't work with the extension atm feel free to do a PR

It might be, but please understand that I just don't have the time to implement such a feature

Se should send a proxinit command to the server. Can you help me to understand how to modify it?

Details there:
https://xdebug.org/docs-dbgp.php#just-in-time-debugging-and-debugger-proxies

All requests are implemented in xdebugConnection.ts. For example, here is the run request: https://github.com/felixfbecker/vscode-php-debug/blob/master/src/xdebugConnection.ts#L737

Not sure when that command is supposed to be send, but here is where the init packet is handled: https://github.com/felixfbecker/vscode-php-debug/blob/master/src/phpDebug.ts#L246

Probably the command should be sent on first connection. I don't know typescript so it is difficult for me to make a PR. Anyway I will try, thanks you for your support.

I'm going to work on this feature. Do you know a way to "send message" to xdebug server with curl or similar low level client? Thanks you

EDIT:
I used this example with success:
const net = require('net'); const client = net.createConnection({port:'9001' , host:'myhost'}, () => { //'connect' listener console.log('connected to server!'); client.write('proxyinit -p 9001 -k vscode -m 1'); }); client.on('data', (data) => { console.log(data.toString()); client.end(); }); client.on('end', () => { console.log('disconnected from server'); });

And after I can debug on vscode! Now it's only time to integrate the command into the plugin.

Yes, there is a debugclient which you can build on xdebug.org, and you could also use telnet. But honestly I never used this, implementing this directly is much easier - you already have the all the message handling and socket stuff being taken care of

It works perfectly with nodejs net socket.

This whole extension communicates with XDebug through a nodejs net socket, so yeah, I figured that 馃槃

Well, I'm trying to complete my work to integrate the proxy request in your plugin but It seems too hard for me.
The problem is this request should be performed in "sync mode" before the first init request. Then I think it could be inserted into phpDebug.ts constructor, but I have no idea how to make it syncronous.

This is the snippet in ts code

    const client = net.createConnection({port: 9001, host: '10.0.1.200'}, function() {
        client.write('proxyinit -p 9001 -k vscode -m 1', function() {
            console.log('test');
        });
    });

    client.on('data', (data:string) => {
        console.log(data.toString());
        client.end();
    });

    client.on('end', () => {
        console.log('disconnected from server');
    });

As seen on the latest merge there were an successfull attempt to implement dbGp proxy support, thus I want to know has it been integrated to the next release?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

QwertyZW picture QwertyZW  路  9Comments

smuuf picture smuuf  路  10Comments

luxifer picture luxifer  路  3Comments

PipCodeBoy picture PipCodeBoy  路  5Comments

jplew picture jplew  路  12Comments