mirror of
https://github.com/php/php-src.git
synced 2026-04-28 10:43:30 +02:00
Need to tell zend_fetch_debug_backtrace() whether to skip top function or not.
# And i wondered why the trace wasn't rally accurate.
This commit is contained in:
@@ -1538,7 +1538,7 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value TSRMLS_DC)
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRMLS_DC)
|
||||
{
|
||||
zend_execute_data *ptr;
|
||||
int lineno;
|
||||
@@ -1568,10 +1568,12 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value TSRMLS_DC)
|
||||
|
||||
ptr = EG(current_execute_data);
|
||||
|
||||
/* skip debug_backtrace() */
|
||||
ptr = ptr->prev_execute_data;
|
||||
cur_arg_pos -= 2;
|
||||
frames_on_stack--;
|
||||
/* skip debug_backtrace() */
|
||||
ptr = ptr->prev_execute_data;
|
||||
if (skip_last) {
|
||||
cur_arg_pos -= 2;
|
||||
frames_on_stack--;
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
@@ -1683,7 +1685,7 @@ ZEND_FUNCTION(debug_backtrace)
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
zend_fetch_debug_backtrace(return_value TSRMLS_CC);
|
||||
zend_fetch_debug_backtrace(return_value, 1 TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define ZEND_BUILTIN_FUNCTIONS_H
|
||||
|
||||
int zend_startup_builtin_functions(TSRMLS_D);
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value TSRMLS_DC);
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRMLS_DC);
|
||||
|
||||
#endif /* ZEND_BUILTIN_FUNCTIONS_H */
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ static zend_object_value zend_default_exception_new(zend_class_entry *class_type
|
||||
ALLOC_ZVAL(trace);
|
||||
trace->is_ref = 0;
|
||||
trace->refcount = 0;
|
||||
zend_fetch_debug_backtrace(trace TSRMLS_CC);
|
||||
zend_fetch_debug_backtrace(trace, 0 TSRMLS_CC);
|
||||
|
||||
zend_update_property_string(class_type, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
|
||||
zend_update_property_long(class_type, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
|
||||
|
||||
@@ -41,7 +41,7 @@ static zend_object_value zend_default_exception_new(zend_class_entry *class_type
|
||||
ALLOC_ZVAL(trace);
|
||||
trace->is_ref = 0;
|
||||
trace->refcount = 0;
|
||||
zend_fetch_debug_backtrace(trace TSRMLS_CC);
|
||||
zend_fetch_debug_backtrace(trace, 0 TSRMLS_CC);
|
||||
|
||||
zend_update_property_string(class_type, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
|
||||
zend_update_property_long(class_type, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
|
||||
|
||||
Reference in New Issue
Block a user