gdb 除錯 new 一個物件主要兩個 handler

coder_study發表於2019-11-06

gdb除錯工具追蹤:
new

Breakpoint 1, execute_ex (ex=0x7ffff4013030) at /php-7.1.26/Zend/zend_vm_execute.h:411
411             const zend_op *orig_opline = opline;
(gdb) c
Continuing.

Breakpoint 2, ZEND_NEW_SPEC_CONST_HANDLER () at /php-7.1.26/Zend/zend_vm_execute.h:3192
3192            SAVE_OPLINE();
(gdb) n
3194                    ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)));
(gdb) n
3195                    if (UNEXPECTED(ce == NULL)) {
(gdb) n
3196                            ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
(gdb) n
3197                            if (UNEXPECTED(ce == NULL)) {
(gdb) n
3201                            CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
(gdb) n
3213            result = EX_VAR(opline->result.var);
(gdb) n
3214            if (UNEXPECTED(object_init_ex(result, ce) != SUCCESS)) {
(gdb) n
3218            constructor = Z_OBJ_HT_P(result)->get_constructor(Z_OBJ_P(result));
(gdb) n
3219            if (constructor == NULL) {
(gdb) n
3220                    if (UNEXPECTED(EG(exception))) {
(gdb) n
3227                    if (EXPECTED(opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL)) {
(gdb) n
3228                            ZEND_VM_NEXT_OPCODE_EX(1, 2);
(gdb) n
3252    }
(gdb) n
execute_ex (ex=0x7ffff4013030) at /php-7.1.26/Zend/zend_vm_execute.h:430

zend_assign_to_variable

execute_ex (ex=0x7ffff4013030) at /php-7.1.26/Zend/zend_vm_execute.h:430
430                     if (UNEXPECTED(!OPLINE)) {
(gdb) n
429                     ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
(gdb) n

Breakpoint 4, ZEND_ASSIGN_SPEC_CV_VAR_RETVAL_UNUSED_HANDLER () at /php-7.1.26/Zend/zend_vm_execute.h:41178
41178   {
(gdb) n
41184           SAVE_OPLINE();
(gdb) n
41185           value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
(gdb) p opline
Missing ELF symbol "opline".
(gdb) p value
$17 = (zval *) 0x0
(gdb) n
41186           variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var);
(gdb) p value
$18 = (zval *) 0x7ffff40130a0
(gdb) p *value
$19 = {value = {lval = 140737287435600, dval = 6.9533458810814867e-310, counted = 0x7ffff4063550,
    str = 0x7ffff4063550, arr = 0x7ffff4063550, obj = 0x7ffff4063550, res = 0x7ffff4063550, ref = 0x7ffff4063550,
    ast = 0x7ffff4063550, zv = 0x7ffff4063550, ptr = 0x7ffff4063550, ce = 0x7ffff4063550, func = 0x7ffff4063550, ww = {
      w1 = 4094047568, w2 = 32767}}, u1 = {v = {type = 8 '\b', type_flags = 12 '\f', const_flags = 0 '\000',
      reserved = 0 '\000'}, type_info = 3080}, u2 = {next = 0, cache_slot = 0, lineno = 0, num_args = 0, fe_pos = 0,
    fe_iter_idx = 0, access_flags = 0, property_guard = 0, extra = 0}}
(gdb) n
41194                   value = zend_assign_to_variable(variable_ptr, value, IS_VAR);
(gdb) s
zend_assign_to_variable (variable_ptr=0x7ffff4013080, value=0x7ffff40130a0, value_type=4 '\004') at /php-7.1.26/Zend/zend_execute.h:61
61              zend_refcounted *ref = NULL;
(gdb) p *value
$20 = {value = {lval = 140737287435600, dval = 6.9533458810814867e-310, counted = 0x7ffff4063550, str = 0x7ffff4063550, arr = 0x7ffff4063550,
    obj = 0x7ffff4063550, res = 0x7ffff4063550, ref = 0x7ffff4063550, ast = 0x7ffff4063550, zv = 0x7ffff4063550, ptr = 0x7ffff4063550,
    ce = 0x7ffff4063550, func = 0x7ffff4063550, ww = {w1 = 4094047568, w2 = 32767}}, u1 = {v = {type = 8 '\b', type_flags = 12 '\f',
      const_flags = 0 '\000', reserved = 0 '\000'}, type_info = 3080}, u2 = {next = 0, cache_slot = 0, lineno = 0, num_args = 0, fe_pos = 0,
    fe_iter_idx = 0, access_flags = 0, property_guard = 0, extra = 0}}
(gdb) p *variable
No symbol "variable" in current context.
(gdb) p variable_ptr
$21 = (zval *) 0x7ffff4013080
(gdb) p *variable_ptr
$22 = {value = {lval = 0, dval = 0, counted = 0x0, str = 0x0, arr = 0x0, obj = 0x0, res = 0x0, ref = 0x0, ast = 0x0, zv = 0x0, ptr = 0x0,
    ce = 0x0, func = 0x0, ww = {w1 = 0, w2 = 0}}, u1 = {v = {type = 0 '\000', type_flags = 0 '\000', const_flags = 0 '\000',
      reserved = 0 '\000'}, type_info = 0}, u2 = {next = 0, cache_slot = 0, lineno = 0, num_args = 0, fe_pos = 0, fe_iter_idx = 0,
    access_flags = 0, property_guard = 0, extra = 0}}
(gdb) n
63              if (ZEND_CONST_COND(value_type & (IS_VAR|IS_CV), 1) && Z_ISREF_P(value)) {
(gdb) n
69                      if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
(gdb) p  VALUE_TYPE
No symbol "VALUE_TYPE" in current context.
(gdb) p value_type
$23 = 4 '\004'
(gdb) p IS_VAR
No symbol "IS_VAR" in current context.
(gdb) n
116             ZVAL_COPY_VALUE(variable_ptr, value);
(gdb) s
117             if (value_type & (IS_CONST|IS_CV)) {
(gdb) p value_type
$24 = 4 '\004'
(gdb) n
121             } else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) {
(gdb) n
128             return variable_ptr;
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章