Re: Re: intercepting function calls
| From: | Andi Gutmans | Date: | Fri, 11 Feb 2005 20:52:09 +0000 |
| Subject: | Re: Re: intercepting function calls | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-14836@lists.php.net to get a copy of this message | ||
OK you got a point. It doesn't really hurt to keep it so I'll leave it all in. I can think of cases where using those opcodes might be easier to use at runtime than overloading zend_execute.
Andi
At 09:09 AM 2/11/2005 +0100, Derick Rethans wrote:
On Thu, 10 Feb 2005, Andi Gutmans wrote: At 11:01 AM 2/9/2005 -0500, George Schlossnagle wrote:On Feb 9, 2005, at 10:57 AM, Sara Golemon wrote:Yeah. Actually I thought we already nuked the old way. Is anyone using it? I'm using: ZEND_DLEXPORT zend_extension zend_extension_entry = {You can also do this by directly wrapping zend_execute. This is the preferred method if you're writing a profiler or such.Is it possible to intercept a function call (user space or built-in) in the Zend Engine and execute user space code before/after the function call?Yes, you can do this by way of a Zend extension (not a PHP extension mind you). The parts of Zend/zend_extensions.h you'll want to pay attention to are:XDEBUG_NAME, XDEBUG_VERSION, XDEBUG_AUTHOR, XDEBUG_URL, "Copyright (c) 2002, 2003, 2004", xdebug_zend_startup, xdebug_zend_shutdown, NULL, /* activate_func_t */ NULL, /* deactivate_func_t */ NULL, /* message_handler_func_t */ NULL, /* op_array_handler_func_t */ xdebug_statement_call, /* statement_handler_func_t */ NULL, /* fcall_begin_handler_func_t */ NULL, /* fcall_end_handler_func_t */ NULL, /* op_array_ctor_func_t */ NULL, /* op_array_dtor_func_t */ STANDARD_ZEND_EXTENSION_PROPERTIES}; I really need the statement call callback for single stepping through code. regards, Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org