Hi Derick,

You shouldn't use opcode handlers directly, we have a use USER_OPCODE API.

typedef int (*user_opcode_handler_t) (zend_execute_data *execute_data);

#define ZEND_USER_OPCODE_CONTINUE   0 /* execute next opcode */
#define ZEND_USER_OPCODE_RETURN     1 /* exit from executor (return from
function) */
#define ZEND_USER_OPCODE_DISPATCH   2 /* call original opcode handler */
#define ZEND_USER_OPCODE_ENTER      3 /* enter into new op_array without
recursion */
#define ZEND_USER_OPCODE_LEAVE      4 /* return to calling op_array within
the same executor */

#define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of
returned opcode */

ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode,
user_opcode_handler_t handler);
ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar
opcode);

Thanks. Dmitry.


On Fri, Jun 26, 2015 at 2:46 AM, Derick Rethans <[email protected]> wrote:

> Hi,
>
> this change moved:
>
> -#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
> -#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data
> -
> -typedef int (*user_opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
> -typedef int (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
> -
> -extern ZEND_API opcode_handler_t *zend_opcode_handlers;
> +typedef int (*user_opcode_handler_t) (zend_execute_data *execute_data);
>
> to Zend/zend_vm_execute.h:
>
> +#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
> +#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data
> +
> +typedef int (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
>
>
> WHich means that I can now no longer override opcodes in Xdebug --- and
> I certainly can't include Zend/zend_vm_execute.h.
>
> The following code now fails (xdebug_code_coverage.[hc]):
>
>         int xdebug_check_branch_entry_handler(ZEND_OPCODE_HANDLER_ARGS)
>
> Is there a different way for declaring/defining these functions now? (I
> could just expand the ZEND_OPCODE_HANDLER_ARGS macro myself, but that's
> cheating...
>
> cheers,
> Derick
>
>
> On Thu, 12 Mar 2015, Dmitry Stogov wrote:
>
> > Commit:    6289f7e52f07d411bce0a0a99fe65bfbe87e4290
> > Author:    Dmitry Stogov <[email protected]>         Thu, 12 Mar 2015
> 20:39:04 +0300
> > Parents:   41571e7fa97feb2f43fc1ed3844daada35a29587
> > Branches:  master
> >
> > Link:
> http://git.php.net/?p=php-src.git;a=commitdiff;h=6289f7e52f07d411bce0a0a99fe65bfbe87e4290
> >
> > Log:
> > Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build
> additional PHP-5.0 compatible VM, hide executor implementation details.
> >
> > Changed paths:
> >   M  Zend/zend_compile.h
> >   M  Zend/zend_execute.c
> >   M  Zend/zend_execute.h
> >   M  Zend/zend_vm_def.h
> >   M  Zend/zend_vm_execute.h
> >   M  Zend/zend_vm_gen.php
> >   M  ext/opcache/Optimizer/zend_optimizer_internal.h
> >
> >
>
> --
> http://derickrethans.nl | http://xdebug.org
> Like Xdebug? Consider a donation: http://xdebug.org/donate.php
> twitter: @derickr and @xdebug
> Posted with an email client that doesn't mangle email: alpine
>

Reply via email to