2012/2/14 Adi Mutu
> 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
> 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 :
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 (
with some schema.
Mainly, the hardest part is ZendVM. If you dont have to debug ZendVM, it's
kinda "easy" and logic.
> From: Ángel González
> To: Adi Mutu
> Cc: PHP Developers Mailing List
> 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
> 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?
> If i would like to break at a certain php line in the script, is it
> > 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.