Re: generators & php tools
| From: | Nikita Popov | Date: | Tue, 09 Oct 2012 11:44:56 +0000 |
| Subject: | Re: generators & php tools | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63301@lists.php.net to get a copy of this message | ||
On Thu, Oct 4, 2012 at 9:45 AM, Derick Rethans <derick@php.net> wrote:
> On Sun, 30 Sep 2012, Stas Malyshev wrote:
>
>> I was looking into generators topic and I couldn't find answer to this
>> question: how generators are supposed to interact with PHP tools, such
>> as debuggers, profilers, etc.? Specifically, how calls to generator
>> are handled? Usually, the tool overrides zend_execute and
>> zend_execute_internal and every function call goes through there. But
>> generator does not use these - it uses execute_ex instead. So can
>> generator be debugged/profiled? What happens if I say "step out"
>> inside generator - would that work?
>
> It won't work with Xdebug right now, as it indeed overrides just
> zend_execute and zend_execute_internal --- we should definitely look at
> fixing generators that they go through those as well. It's related to
> the zend_execute_internal hook missing from the other email that I just
> replied to (and your PR 178).
>
> cheers,
> Derick
Generators won't be able to go through zend_execute, because they need
to work on an existing execution context and not create a new one on
every resume. So instead we will probably need an additional hook for
execute_ex (in which case the existing execute hook isn't really
necessary anymore).
Would that be okay?
Nikita
XDebug execute and execute_internal:
https://github.com/derickr/xdebug/blob/master/xdebug.c#L1215
https://github.com/derickr/xdebug/blob/master/xdebug.c#L1442