I know about the zif_* functions and i'm already using lxr.php.net.
Didn't know about gcc -E trick though, that might be usefull.

Thanks.


________________________________
 From: jpauli <jpa...@php.net>
To: Rasmus Lerdorf <ras...@php.net> 
Cc: Adi Mutu <adi_mut...@yahoo.com>; PHP Developers Mailing List 
<internals@lists.php.net> 
Sent: Tuesday, February 14, 2012 7:36 PM
Subject: Re: [PHP-DEV] how to debug a php script ( the C code beneath it)
 

On Tue, Feb 14, 2012 at 6:28 PM, Rasmus Lerdorf <ras...@php.net> wrote:

On 02/14/2012 09:22 AM, Adi Mutu wrote:
>> Thanks Julien....
>>
>> I don't know french, but i'll read it using google translate:)
>
>If you just want to see some of the function calls, most calls that are
>visible in userspace are prefixed with "zif_" internally.
>
>eg.
>
>% gdb sapi/cli/php
>GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
>...
>(gdb) b zif_strlen
>Breakpoint 1 at 0x7b2760: file
>/home/rasmus/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c,
>line 455.
>(gdb) run -r 'echo strlen("123");'
>Breakpoint 1, zif_strlen (ht=1, return_value=0x1200eb0,
>return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
>   at
>/home/rasmus/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c:455
>455     {
>(gdb) l
>450
>451
>452     /* {{{ proto int strlen(string str)
>453        Get string length */
>454     ZEND_FUNCTION(strlen)
>455     {
>456             char *s1;
>457             int s1_len;
>
>-Rasmus
>
>
>--
>PHP Internals - PHP Runtime Development Mailing List
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Yeah, that's the PHP_FUNCTION() macro. 'zif' meaning "Zend Internal Function".
One more step would be to read the preprocessed code (GCC -E), as PHP 
source heavily uses macros

If you want, you can also read the source code online using the excellent 
http://lxr.php.net :)

Julien.P

Reply via email to