Hello everybody,
[I hope this is the right list for this question, if not, it'd be great
if you could point me to the right direction].
I'm currently developing a PHP Extension which is built as dynamic
library, and not directly into PHP core. I'm trying to figure out how to
set break-points inside the extension with GDB, so debugging is easier.
So far, I started gdb with "gdb /my/path/to/php" (which has debug
symbols enabled); and then tried to set a breakpoint into my extension via:
break /path/to/php/extension/objectmonitor/objectmonitor.c:80
GDB then asks:
No source file named /path/to/php/extension/objectmonitor/objectmonitor.c.
Make breakpoint pending on future shared library load? (y or [n]) y
When I run php with a script via "run index.php", the system does not
stop at the set break-point.
Do you have any hints how to make this work? This really would help me
tremendously.
Regards,
Sebastian
Hello everybody,
[I hope this is the right list for this question, if not, it'd be great
if you could point me to the right direction].I'm currently developing a PHP Extension which is built as dynamic
library, and not directly into PHP core. I'm trying to figure out how to
set break-points inside the extension with GDB, so debugging is easier.So far, I started gdb with "gdb /my/path/to/php" (which has debug
symbols enabled); and then tried to set a breakpoint into my extension via:break /path/to/php/extension/objectmonitor/objectmonitor.c:80
GDB then asks:
No source file named /path/to/php/extension/objectmonitor/objectmonitor.c.
Make breakpoint pending on future shared library load? (y or [n]) yWhen I run php with a script via "run index.php", the system does not
stop at the set break-point.Do you have any hints how to make this work? This really would help me
tremendously.
Do you use debug-build of PHP? There won't be symbols in "regular" build
Hello everybody,
[I hope this is the right list for this question, if not, it'd be great
if you could point me to the right direction].I'm currently developing a PHP Extension which is built as dynamic
library, and not directly into PHP core. I'm trying to figure out how to
set break-points inside the extension with GDB, so debugging is easier.So far, I started gdb with "gdb /my/path/to/php" (which has debug
symbols enabled); and then tried to set a breakpoint into my extension via:break /path/to/php/extension/objectmonitor/objectmonitor.c:80
Try just "break objectmonitor.c:80".
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Hi!
So far, I started gdb with "gdb /my/path/to/php" (which has debug
symbols enabled); and then tried to set a breakpoint into my extension via:break /path/to/php/extension/objectmonitor/objectmonitor.c:80
GDB then asks:
No source file named /path/to/php/extension/objectmonitor/objectmonitor.c.
Make breakpoint pending on future shared library load? (y or [n]) y
That's probably because the module is not loaded yet and for some reason
gdb doesn't set the breakpoint correctly when it is (gdb is,
unfortunately, very far from perfect when it comes to dealing with
dynamic loading). What I would advise is to do this:
- Set the breakpoint in compile_file() or execute(). If you need to
catch earlier phases, you can try php_request_startup(). - By that time .so should be in, so try setting the breakpont
- Continue execution.
Alternatively, you could just set the breakpoint in php_dl(), step
through it up to a point where your .so loads and add the breakpoint
then. It's a bit tedious, but should work.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com