php extension debugger

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm a very, very novice C programmer and I have written an extension
for php that does its purpose well, or at least it used to until they
asked for that one extra feature. It's a very little thing, very easy,
but damn it all, it has a mysterious bug. I tracked it down to one
specific line where the weirdness occurs, but I can't figure out *why*
it is occuring.

This extension uses the php_streams and as such, is wed enough to php
that my first inclination (compile it on its own and debug it that way)
is a no-go. Is there any way to use a debugger on this so I can step
through it?

I only know enough C for it to be painful. Any help would be


Re: php extension debugger

Ben wrote:
Quoted text here. Click to load it

What platform are you on? If you're using Visual Studio on Windows,
what you do is attach the debugger to the Apache process then set the
break points. Upon hitting the page the debugger will stop the process
at the break point for you to trace through.

Re: php extension debugger

I'm on freeBSD without X11, editing the file on OS X through a samba

I'll google around for attaching a debugger to an Apache process.
Thanks for the direction.

Re: php extension debugger

The thing to remember is that you need to attach to a child process
spawned by the Apache as opposed to the original process. Be sure to
adjust your Apache config so it wouldn't spawn some fifty children.
Otherwise it'd be pretty hard to tell which one is handling a given

It's been ages since I last used gdb. Just look in the manpage. Should
tell you what commands to use.

Re: php extension debugger

Thanks a lot. With some help I managed to solve my problem (very
stupid, naturally) before it got to the interactive debugger phrase,
but I'm sure next time I manage to get myself stuck or even next time I
find myself idly investigating I'll give gdb a shot.

Thanks for the tips.

Site Timeline