Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: jpauli <jpauli <at> php.net>
Subject: Re: [PHP-DEV] how to debug a php script ( the C code beneath it)
Newsgroups: gmane.comp.php.devel
Date: Tuesday 14th February 2012 09:17:24 UTC (over 5 years ago)
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
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 
> 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
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.
>
 
CD: 4ms