What to do when the debugger has a bug? That’s the question I had to answer when my GitHub notifications went haywire because a new version of Xdebug was crashing FrankenPHP and therefore all the projects that use it.
Together, we’ll retrace the epic story of this debugging debugger and discover a method that can debug just about any bug:
- isolate the problem
- code a “minimal reproducer”
- install a development environment that allows you to debug PHP and its extensions
- use the right tools to understand what’s going on
- make a detailed bug report
- establish a theory
- write a patch
- contribute the patch to the upstream project
This method can be used to debug any problem, in any language! We’ll take advantage of this adventure to discover the inner workings of the PHP runtime engine, and its extensions, as well as some debugging tools, in particular GDB.