mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Improve fiber backtraces
The start/resume/throw execute_data is now attached as the prev_execute_data to the bottom frame of the fiber stack when the fiber is running.
This commit is contained in:
parent
f3465e6740
commit
810fb59f66
13 changed files with 262 additions and 4 deletions
|
@ -6790,6 +6790,7 @@ ZEND_METHOD(ReflectionFiber, getTrace)
|
|||
{
|
||||
zend_fiber *fiber = (zend_fiber *) Z_OBJ(Z_REFLECTION_P(ZEND_THIS)->obj);
|
||||
zend_long options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
|
||||
zend_execute_data *prev_execute_data;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
|
@ -6798,6 +6799,9 @@ ZEND_METHOD(ReflectionFiber, getTrace)
|
|||
|
||||
REFLECTION_CHECK_VALID_FIBER(fiber);
|
||||
|
||||
prev_execute_data = fiber->stack_bottom->prev_execute_data;
|
||||
fiber->stack_bottom->prev_execute_data = NULL;
|
||||
|
||||
if (EG(current_fiber) != fiber) {
|
||||
// No need to replace current execute data if within the current fiber.
|
||||
EG(current_execute_data) = fiber->execute_data;
|
||||
|
@ -6806,6 +6810,7 @@ ZEND_METHOD(ReflectionFiber, getTrace)
|
|||
zend_fetch_debug_backtrace(return_value, 0, options, 0);
|
||||
|
||||
EG(current_execute_data) = execute_data; // Restore original execute data.
|
||||
fiber->stack_bottom->prev_execute_data = prev_execute_data; // Restore prev execute data on fiber stack.
|
||||
}
|
||||
|
||||
ZEND_METHOD(ReflectionFiber, getExecutingLine)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue