mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- More debug backtrace work. It still doesn't work very well...
This commit is contained in:
parent
7c80fc1d9e
commit
b66c89c47a
4 changed files with 29 additions and 12 deletions
|
@ -812,6 +812,12 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
|
|||
zend_file_handle *file_handle;
|
||||
zend_op_array *orig_op_array = EG(active_op_array);
|
||||
zval *local_retval=NULL;
|
||||
zend_execute_data execute_data;
|
||||
|
||||
EX(prev_execute_data) = NULL;
|
||||
EG(current_execute_data) = &execute_data;
|
||||
EX(object) = NULL;
|
||||
EX(opline) = NULL;
|
||||
|
||||
va_start(files, file_count);
|
||||
for (i=0; i<file_count; i++) {
|
||||
|
@ -822,6 +828,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
|
|||
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC);
|
||||
zend_destroy_file_handle(file_handle TSRMLS_CC);
|
||||
if (EG(active_op_array)) {
|
||||
EX(function_state).function = (zend_function *) EG(active_op_array);
|
||||
EG(return_value_ptr_ptr) = retval ? retval : &local_retval;
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
if (EG(exception)) {
|
||||
|
|
|
@ -1188,23 +1188,33 @@ ZEND_FUNCTION(debug_backtrace)
|
|||
{
|
||||
zend_execute_data *ptr;
|
||||
int lineno;
|
||||
|
||||
char *function_name;
|
||||
char *filename;
|
||||
|
||||
ptr = EG(current_execute_data);
|
||||
lineno = ptr->opline->lineno;
|
||||
|
||||
ptr = ptr->prev_execute_data;
|
||||
|
||||
|
||||
while (ptr) {
|
||||
if (ptr->object) {
|
||||
printf("%s::", Z_OBJCE(*ptr->object)->name);
|
||||
}
|
||||
printf("%s() [%s:%d]\n", ptr->function_state.function->common.function_name, ptr->function_state.function->op_array.filename, lineno);
|
||||
lineno = ptr->opline->lineno;
|
||||
ptr = ptr->prev_execute_data;
|
||||
}
|
||||
function_name = ptr->function_state.function->common.function_name;
|
||||
if (!function_name) {
|
||||
function_name = "main";
|
||||
}
|
||||
|
||||
printf("main() [...:%d]\n", lineno);
|
||||
ptr = ptr->prev_execute_data;
|
||||
if (!ptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
filename = ptr->function_state.function->op_array.filename;
|
||||
|
||||
printf("%s() [%s:%d]\n", function_name, filename, lineno);
|
||||
if (ptr->opline) {
|
||||
lineno = ptr->opline->lineno;
|
||||
}
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,6 +195,8 @@ typedef struct _zend_execute_data {
|
|||
struct _zend_execute_data *prev_execute_data;
|
||||
} zend_execute_data;
|
||||
|
||||
#define EX(element) execute_data.element
|
||||
|
||||
|
||||
#define IS_CONST (1<<0)
|
||||
#define IS_TMP_VAR (1<<1)
|
||||
|
|
|
@ -1130,8 +1130,6 @@ static int zend_check_symbol(zval **pz TSRMLS_DC)
|
|||
EG(current_execute_data) = EX(prev_execute_data); \
|
||||
return;
|
||||
|
||||
#define EX(element) execute_data.element
|
||||
|
||||
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
|
||||
{
|
||||
zend_execute_data execute_data;
|
||||
|
@ -2805,7 +2803,7 @@ send_by_ref:
|
|||
zend_error(E_ERROR, "Cannot delete non-existing object");
|
||||
}
|
||||
if (Z_TYPE_PP(object) != IS_OBJECT) {
|
||||
zend_error(E_ERROR, "Cannot call delete on non-object type");
|
||||
zend_error(E_ERROR, "Cannot call delete on non-object type");
|
||||
}
|
||||
Z_OBJ_HT_PP(object)->delete_obj(*object TSRMLS_CC);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue