r/PHP • • 3d ago

News PHP Debugger - Agentic zero-overhead debugging

Hi, I wanted to introduce PHP debugger, a tool I built together with Roman Pronskiy, former Executive Director of The PHP Foundation and former head of PhpStorm at Jetbrains.

We took Xdebug and removed everything that was not related to debugging and optimised to death the case where the debugger was enabled but not connected, and were able to achieve near zero-overhead.

This means that instead of having to enable and disable or trigger the debugger all the time, you can leave it permanently on, ready to start a debugging session when you need it and out of the way when you don't.

And this has also allowed us to build an MCP server that connects to the debugger and which can be used by agents to debug PHP code in the same way that humans do, setting breakpoints, reading values and stepping through the code.

This raises the possibilities of agentic debugging to a new level and allows your agents to fix issues with precision and without any wild guesses.

PHP debugger is really easy to install, so why don't you give it a go and let us know what you think? https://github.com/php-debugger/php-debugger

58 Upvotes

13 comments sorted by

7

u/ArdorWaheguru 3d ago

Giving an agent actual runtime state via step debugging instead of letting it guess from stack traces makes a lot of sense. What stops the agent from getting stuck on a breakpoint and hanging the worker pool if a condition isnt met?

3

u/barel-barelon 3d ago

PHP only waits for the debugger client while it's actually paused. If a breakpoint never hits, the request finishes normally. On the agent side, every wait and command has a time limit, so the agent always gets control back instead of blocking. Any session which the agent does not need any more is let go and runs to completion. It's very similar to debugging with an IDE, when you are working with breakpoints the IDE is not blocked and can continue working and doing other tasks

3

u/rock217 3d ago

No profiling or tracing is a little rough.

5

u/barel-barelon 3d ago

There are other tools for this like PCOV and you can continue using Xdebug in parallel as long as you don't enable debugging

10

u/thomasmoors 3d ago

Nice work. Maybe you want to consider a more googleble name?

0

u/AleBaba 3d ago

Like "we stole someone else's code and gave AI money for that instead of him"-ext? 

1

u/titpetric 3d ago

Is there a spec for the protocol that remains, to know what is or isn't implemented? I may have a case where I could provide a debugger interface, does this make is easier or more focused to write the server instrumentation? I vaguely know that xdebug has some coverage instrumentation, what exactly was stripped away?

1

u/barel-barelon 3d ago

We removed anything that was not strictly debugging. So no tracing, no code coverage, no profiler. A tool that does only one thing but does it very well

-2

u/Crell 3d ago

Oh good. Slopping someone else's work, and someone who is very outspoken about not liking slop.

Remind me to never use this.

1

u/goodwill764 2d ago

I must admit, as i first visit the repo i thought it was from the xdebug developer itself, as he's showed up in the sponsorship area and is within the contributors list.

Additional as Roman Pronskiy is involved, it sounds like something official.

-1

u/mYkon123 3d ago

That sounds awesome - I'll test

2

u/mYkon123 3d ago

Why the downvotes? I replaced xdebug with this because I dont need a manual toggl script that enabled the xdebug extension anymore.

-3

u/roxblnfk 3d ago

Oh, we also built an MCP server and a set of skills for Buggregator Trap and Server, allowing agents to use xDebug during the debugging process. Furthermore, it includes support for profilers, var-dumps, logs, email, Sentry, telemetry, and much more.

Now I’ll add a skill for the PHP Debugger, so that your tool can be used more extensively.