public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey Repin <anrdaemon@yandex.ru>
To: Jim Hyslop <jhyslop@dreampossible.ca>, cygwin@cygwin.com
Subject: Re: Debugging PHP with GDB and php-debuginfo
Date: Wed, 21 Jul 2021 11:06:11 +0300	[thread overview]
Message-ID: <657252357.20210721110611@yandex.ru> (raw)
In-Reply-To: <6761b93277958c240961339bc5a1f2e2@dreampossible.ca>

Greetings, Jim Hyslop!

> 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`.

You're confusing debugging PHP code (i.e. website) with debudding PHP itself.
php-debuginfo is for the latter.

> 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])

Entirely predictable. PHP is written in C, not PHP.

> 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?

You need to install xdebug. And for that, you need to install native PHP, as
there's no PECL modules built for Cygwin.
Then use any suitable IDE (VS Code, PHPStorm, etc.) to step through the code.
Read phpunit instructions about allowing it running under debugger.


-- 
With best regards,
Andrey Repin
Wednesday, July 21, 2021 11:03:04

Sorry for my terrible english...


      parent reply	other threads:[~2021-07-21  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 22:54 Jim Hyslop
2021-07-21  1:24 ` Russell VT
2021-07-21  5:26 ` bzs
2021-07-21  8:06 ` Andrey Repin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=657252357.20210721110611@yandex.ru \
    --to=anrdaemon@yandex.ru \
    --cc=cygwin@cygwin.com \
    --cc=jhyslop@dreampossible.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).