2012/2/14 Adi Mutu <adi_mut...@yahoo.com>

> Perhaps i didn't explain correctly, my bad, sorry.
> Basically what I want to see is the corresponding C code which is
> executed, i could put a break in gdb, but how do I know at which C function
> to put it, if i don't know the internals of php very good?
>

And the answer is : you cant.
Simply put, you have to study the code first, before knowing through which
line it will go.
That's not very easy, as you can count on ~800.000 lines in trunk.

To see the path, use valgrind + callgrind. You'll get a very cool graph
like this :
http://julien-pauli.developpez.com/tutoriels/php/internals/presentation/images/PHPInternals-callgraph.png

You could use gdb with the .gdbinit from trunk. Using it with CDT is much
more cool as it is GUI.

I wrote some article about PHP internals, mainly describing how it works.
It's in french (
http://julien-pauli.developpez.com/tutoriels/php/internals/presentation)
with some schema.

Mainly, the hardest part is ZendVM. If you dont have to debug ZendVM, it's
kinda "easy" and logic.

Cheers

Julien.Pauli



>
> ________________________________
>  From: Ángel González <keis...@gmail.com>
> To: Adi Mutu <adi_mut...@yahoo.com>
> Cc: PHP Developers Mailing List <internals@lists.php.net>
> Sent: Tuesday, February 14, 2012 1:11 AM
> Subject: Re: [PHP-DEV] how to debug a php script ( the C code beneath it)
>
> On 13/02/12 21:48, Adi Mutu wrote:
> > Hello,
> >
> > Perhaps this is a stupid question, but i haven't coded in C in years and
> i'm not very familiar with development/debugging tools. If I have a php
> script say 20 lines,
> > How can I see a path of the corresponding C code which is executed? What
> If i would like to break at a certain php line in the script, is it
> possible?
> >
> > Thanks,
> Why do you want to do it?
> It looks to me like that you are trying to solve a problem the hard way
> by doing that.
>

Reply via email to