GSoC XDebug code coverage update - 7th June
[email protected] (Allister Beharry) Mon, 8 Jun 2009 03:30:24 -0400
| Newsgroups | php.pecl.dev,php.gsoc |
|---|---|
| Message-ID | <[email protected]> |
This week I got Sara Golemon's book so I could figure out just what the heck was actually happening inside PHP and together with Andy Wharmby's slides and the PHP code I've made the following progress: So basically: * I understand the meanings of the macros like EG and TSRML_*and how they relate to threading/non-threading environments and memory management * I understand the use of the TSRM functions and macros and casts for allocating memory for module specific data - so XG is just the TSRM-aware macro for referring to the XDebug module globals structure * I understand zvals and the rudiments of declaring, allocating storage for and defining zvals and their type and introducing them into the global symbol table. I get the separation of PHP user space from program space and how an extension can introduces constants, values and functions into user space * I understand the basic structure of a module - so I look at XDebug and I see the registration of functions for process and request startup and shutdown, the exporting of the functions to user space and the module entry-point. * I understand the basic cycle of PHP execution, from process to thread to request to compile to execute, so for example for launching a CLI script it's php_execute_script-> zend_execute_scripts ->zend_compile_file->zend_parse->pass_two and then zend_execute the zend_op_array I also had a look at the vld module to test some of this knowledge and it's relatively simply - inside PHP_RINIT_FUNCTION(vld) it just replaces zend_compile_string and zend_compile_file and with its own functions (and zend_execute with a dummy) that run zend_compile_* on the input and then walk through the opcode array and dump the opcodes to stdout. There's also some branch analysis code in vld but I'm not sure if it's used. So what I'm studying this week is: * Go a bit deeper into the compilation process - specifically opcode handlers * Understand how the existing code-coverage in Xdebug works. * Understand the op code generated for different branches - if/then/else, loops, exceptions et.al with vld and parsekit in hand * Look at existing branch analysis code in xdebug, vld and possibly optimizer Now that I'm acclimatized to PHP internals I can go a lot faster. I still have another budgeted week for information discovery so I still have to see how branch analysis is done and how to integrate it into code coverage. Still a lot of work to go but I'm making progress. Allister