mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Fix oplog trace with already freed closures
This commit is contained in:
parent
57247f01f7
commit
1da4ee25b8
@ -615,25 +615,24 @@ static PHP_FUNCTION(phpdbg_end_oplog)
|
||||
zend_long insert_idx;
|
||||
|
||||
do {
|
||||
zend_op_array *op_array = cur->op_array;
|
||||
zval zero;
|
||||
ZVAL_LONG(&zero, 0);
|
||||
|
||||
if (op_array->filename != last_file) {
|
||||
last_file = op_array->filename;
|
||||
if (cur->filename != last_file) {
|
||||
last_file = cur->filename;
|
||||
file_ht = insert_ht = phpdbg_add_empty_array(Z_ARR_P(return_value), last_file);
|
||||
}
|
||||
|
||||
if (by_function) {
|
||||
if (op_array->function_name == NULL) {
|
||||
if (cur->function_name == NULL) {
|
||||
if (last_function != NULL) {
|
||||
insert_ht = file_ht;
|
||||
}
|
||||
last_function = NULL;
|
||||
} else if (op_array->function_name != last_function || op_array->scope != last_scope) {
|
||||
} else if (cur->function_name != last_function || cur->scope != last_scope) {
|
||||
zend_string *fn_name;
|
||||
last_function = op_array->function_name;
|
||||
last_scope = op_array->scope;
|
||||
last_function = cur->function_name;
|
||||
last_scope = cur->scope;
|
||||
if (last_scope == NULL) {
|
||||
fn_name = zend_string_copy(last_function);
|
||||
} else {
|
||||
@ -645,7 +644,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
|
||||
}
|
||||
|
||||
if (by_opcode) {
|
||||
insert_idx = cur->op - op_array->opcodes;
|
||||
insert_idx = cur->op - cur->opcodes;
|
||||
} else {
|
||||
insert_idx = cur->op->lineno;
|
||||
}
|
||||
|
@ -320,6 +320,7 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
|
||||
*dataptr->op_array->refcount = 2;
|
||||
dataptr->destroy_op_array = 0;
|
||||
}
|
||||
++*dataptr->op_array->refcount;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -202,11 +202,17 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, zend_bool ignore_fl
|
||||
|
||||
if (PHPDBG_G(oplog_list)) {
|
||||
phpdbg_oplog_entry *cur = zend_arena_alloc(&PHPDBG_G(oplog_arena), sizeof(phpdbg_oplog_entry));
|
||||
zend_op_array *op_array = &execute_data->func->op_array;
|
||||
cur->op = (zend_op *) execute_data->opline;
|
||||
cur->op_array = &execute_data->func->op_array;
|
||||
cur->opcodes = op_array->opcodes;
|
||||
cur->filename = op_array->filename;
|
||||
cur->scope = op_array->scope;
|
||||
cur->function_name = op_array->function_name;
|
||||
cur->next = NULL;
|
||||
PHPDBG_G(oplog_cur)->next = cur;
|
||||
PHPDBG_G(oplog_cur) = cur;
|
||||
if (!execute_data->func->op_array.filename)
|
||||
printf("ALETR");
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
@ -30,7 +30,10 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, zend_bool ignore_fl
|
||||
typedef struct _phpdbg_oplog_entry phpdbg_oplog_entry;
|
||||
struct _phpdbg_oplog_entry {
|
||||
phpdbg_oplog_entry *next;
|
||||
zend_op_array *op_array;
|
||||
zend_string *function_name;
|
||||
zend_class_entry *scope;
|
||||
zend_string *filename;
|
||||
zend_op *opcodes;
|
||||
zend_op *op;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user