Damjan Cvetko

Damjan Cvetko

Developer, System Architect, Hacker.

3 minutes read

This is a small writeup on the September 2021 release of VSCode PHP Debug adapter extension. A cover issue describing all work can be found on GitHub issues. I intended to do a “release” every month, but I just do incremental releases and write up a monthly (or so) report… It was summer :)

No-folder debugging

A large task was the No-folder debugging. This is when VS Code has the purple status bar, no folder is open at that time, and so no launch.json file is available. I was actually brought to my attention by Microsoft's VS Code PM. We had a conf call and discussed what can be done to make PHP debugging in VS Code simpler. Especially the initial setup.

The changes that came out of this are the no-folder debugging and VS Code settings for the location of the PHP binary. And the quick run/debug icon in the editor. The extension had to transition from a pure DAP implementation into a hybrid one. Now there is also native extension code being activated when debugging starts.

There are plans to further improve PHP and Xdebug setup for new users.

xdebug_notify()

This is a new feature of Xdebug that I helped to define. It is very similar to console.log(). If a DBGp connection is active it will send whatever is the parameter to the IDE in the form of a property. The ide was to provide similar facilities to Windows Debug channels. My initial idea was to use the stream concept of Xdebug, but we later decided to go with notify.

Logpoints

A long standing Pull Request was cleaned up and merged. Logpoints are like breakpoints but they do not stop execution, just print text to the console.

Hit-Count conditional breakpoints

Another old Pull Request was cleaned up and merged. Hit-count conditional breakpoints allow the user to set when the breakpoint will actually stop, depending on the number of hits a breakpoint receives. This functionality is provided by Xdebug. Only conditions >=, == and % are available.

Facets

With PHP 8 came readonly properties and enums. Xdebug provides this information in the facets attribute of the property structure. This is now processed, but does not have a real impact on the UI… yet. Both readonly and enum cannot be edited. Processing this flags allows us to prevent that on the UI.

Max connections

Another late feature that came in - altho already in october - is the maxConnections launch parameter. It restricts how many connections at a time can be active. When max connections are reached any new connection will be dropped and PHP will continue execution without debugging.

Conclusion

I'm always happy about feedback and would always like to know how to make debugging experience better. I'm currently focusing on DBGp Proxy and Xdebug Cloud support.

Recent posts

See more

Categories

About