Debugging PHP with GDB and php-debuginfo

Russell VT russellvt@gmail.com
Wed Jul 21 01:24:49 GMT 2021


There's the "Magic Method" in PHP for __debuginfo()
<https://www.php.net/manual/en/language.oop5.magic.php#object.debuginfo>.

Also see PHP RFC: __debugInfo() <https://wiki.php.net/rfc/debug-info>.

You may have better luck asking the PHP devs how to best use this with GDB,
or the GDB folks how to use the extension.

Hope that helps!

Russell VT


On Tue, Jul 20, 2021 at 3:55 PM Jim Hyslop <jhyslop@dreampossible.ca> wrote:

> Hi, all
>
> I've installed the php-debuginfo extension for gdb, but I can't figure
> out how to set a breakpoint with it. Is there a manual for
> php-debuginfo? All I can find is the package information.
>
> I'm trying to debug why a unit test is passing (it should fail). I'm
> using the CakePHP framework (www.cakephp.org). From the command line, I
> normally just execute `vendor/bin/phpunit`.
>
> With gdb, I execute `gdb $(which php)`, then at the command line in GDB
> I type ` b ./tests/TestCase/Controller/UsersControllerTest.php:80`
>
> GDB responds with:
> No source file named
> ./tests/TestCase/Controller/UsersControllerTest.php.
> Make breakpoint pending on future shared library load? (y or [n])
>
> The file name is valid. I've tried using the full path instead of the
> relative path.
>
> When I run the tests with `r vendor/bin/phpunit` the unit tests all
> execute, but GDB doesn't stop at the breakpoint.
>
> Do I need to modify php.ini to use gdb? Any pointers?
>
> --
> Jim Hyslop
>
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
>


-- 
Russell M. Van Tassell <russellvt@gmail.com>


More information about the Cygwin mailing list