vscode-php-debug icon indicating copy to clipboard operation
vscode-php-debug copied to clipboard

feature request: data breakpoints

Open Ernestopheles opened this issue 2 years ago • 6 comments

I am missing a feature to set data breakpoints, i.e. have debugging stop when a condition comes true, especially a variable changes its value (in generell or to a specific value). As far as I can see this is now only possible at a specific code line but not globally.

Ernestopheles avatar Jun 10 '23 14:06 Ernestopheles

Hello. I do not think this is possible with Xdebug. But you could probably implement a setter magic function and set up a conditional breakpoint there.

zobo avatar Jun 12 '23 07:06 zobo

Thanks, but the setter does not help in this case. What reasons are there that hinders xdebug to have data breakpoints? Is it PHP itself, the IDE or the plugin?

Ernestopheles avatar Jun 12 '23 15:06 Ernestopheles

First this is not supported in Xdebug. You can open a feature request here https://bugs.xdebug.org/ , but I'm sure this will not be a small task and Derick has little time for extra Xdebug features sadly (sponsors can help...)

Second it seems that the DAP has support for this https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetDataBreakpoints and https://microsoft.github.io/debug-adapter-protocol/specification#Requests_DataBreakpointInfo .

However I do not think I have seen UI support for this in VS Code. That would also need to be implemented (by Microsoft) https://github.com/microsoft/vscode/issues

I think the only way to get this is to structure your code in such way that you can set a file/line breakpoint or add xdebug_break() code...

zobo avatar Jun 23 '23 08:06 zobo

Thanks for bringing light into this.

Going to open issues at the places you mentioned and trying to work around in the maybe long lasting meanwhile.

Ernestopheles avatar Jun 23 '23 12:06 Ernestopheles

https://github.com/microsoft/vscode/issues/185985#event-9617725345

Ernestopheles avatar Jul 01 '23 12:07 Ernestopheles

Hi! Apparently I was wrong here, sorry for letting you run circles. I'm traveling and will try to look at again this as soon as I can.

zobo avatar Jul 02 '23 10:07 zobo