diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-04-26 00:32:51 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-04-26 00:32:51 +0400 |
commit | f9927a6c97208c60d922f9a4e98feb8079c57d1f (patch) | |
tree | 35815b69d1bf7d47fb41e857ff8d2b024ddac153 /sapi/phpdbg/phpdbg_frame.c | |
parent | 4e7cbf3f5842abe6688c11ce3cc11d2eabf0695f (diff) | |
parent | b82d077f988606580e5c06a9da18fe4f60ddb7cb (diff) | |
download | php-git-f9927a6c97208c60d922f9a4e98feb8079c57d1f.tar.gz |
Merge mainstream 'master' branch into refactoring
During merge I had to revert:
Nikita's patch for php_splice() (it probably needs to be applyed again)
Bob Weinand's patches related to constant expression handling (we need to review them carefully)
I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway)
Conflicts:
Zend/zend.h
Zend/zend_API.c
Zend/zend_ast.c
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_constants.c
Zend/zend_exceptions.c
Zend/zend_execute.c
Zend/zend_execute.h
Zend/zend_execute_API.c
Zend/zend_hash.c
Zend/zend_highlight.c
Zend/zend_language_parser.y
Zend/zend_language_scanner.c
Zend/zend_language_scanner_defs.h
Zend/zend_variables.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/date/php_date.c
ext/dom/documenttype.c
ext/hash/hash.c
ext/iconv/iconv.c
ext/mbstring/tests/zend_multibyte-10.phpt
ext/mbstring/tests/zend_multibyte-11.phpt
ext/mbstring/tests/zend_multibyte-12.phpt
ext/mysql/php_mysql.c
ext/mysqli/mysqli.c
ext/mysqlnd/mysqlnd_reverse_api.c
ext/mysqlnd/php_mysqlnd.c
ext/opcache/ZendAccelerator.c
ext/opcache/zend_accelerator_util_funcs.c
ext/opcache/zend_persist.c
ext/opcache/zend_persist_calc.c
ext/pcre/php_pcre.c
ext/pdo/pdo_dbh.c
ext/pdo/pdo_stmt.c
ext/pdo_pgsql/pgsql_driver.c
ext/pgsql/pgsql.c
ext/reflection/php_reflection.c
ext/session/session.c
ext/spl/spl_array.c
ext/spl/spl_observer.c
ext/standard/array.c
ext/standard/basic_functions.c
ext/standard/html.c
ext/standard/mail.c
ext/standard/php_array.h
ext/standard/proc_open.c
ext/standard/streamsfuncs.c
ext/standard/user_filters.c
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re
main/php_variables.c
sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg_bp.c
sapi/phpdbg/phpdbg_frame.c
sapi/phpdbg/phpdbg_help.c
sapi/phpdbg/phpdbg_list.c
sapi/phpdbg/phpdbg_print.c
sapi/phpdbg/phpdbg_prompt.c
Diffstat (limited to 'sapi/phpdbg/phpdbg_frame.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_frame.c | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c index 2c2d9e6177..a235fe8cb0 100644 --- a/sapi/phpdbg/phpdbg_frame.c +++ b/sapi/phpdbg/phpdbg_frame.c @@ -39,10 +39,11 @@ void phpdbg_restore_frame(TSRMLS_D) /* {{{ */ EG(opline_ptr) = &PHPDBG_EX(opline); EG(active_op_array) = PHPDBG_EX(op_array); + EG(return_value_ptr_ptr) = PHPDBG_EX(original_return_value); EG(active_symbol_table) = PHPDBG_EX(symbol_table); - Z_OBJ(EG(This)) = PHPDBG_EX(object); - EG(scope) = PHPDBG_EX(scope); - EG(called_scope) = PHPDBG_EX(called_scope); + EG(This) = PHPDBG_EX(current_this); + EG(scope) = PHPDBG_EX(current_scope); + EG(called_scope) = PHPDBG_EX(current_called_scope); } /* }}} */ void phpdbg_switch_frame(int frame TSRMLS_DC) /* {{{ */ @@ -81,10 +82,12 @@ void phpdbg_switch_frame(int frame TSRMLS_DC) /* {{{ */ EG(opline_ptr) = &PHPDBG_EX(opline); EG(active_op_array) = PHPDBG_EX(op_array); + PHPDBG_FRAME(execute_data)->original_return_value = EG(return_value_ptr_ptr); + EG(return_value_ptr_ptr) = PHPDBG_EX(original_return_value); EG(active_symbol_table) = PHPDBG_EX(symbol_table); - Z_OBJ(EG(This)) = PHPDBG_EX(object); - EG(scope) = PHPDBG_EX(scope); - EG(called_scope) = PHPDBG_EX(called_scope); + EG(This) = PHPDBG_EX(current_this); + EG(scope) = PHPDBG_EX(current_scope); + EG(called_scope) = PHPDBG_EX(current_called_scope); } phpdbg_notice("Switched to frame #%d", frame); @@ -97,38 +100,45 @@ void phpdbg_switch_frame(int frame TSRMLS_DC) /* {{{ */ ); } /* }}} */ -static void phpdbg_dump_prototype(zval *tmp TSRMLS_DC) /* {{{ */ +static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */ { - zval *funcname, *class, *type, *args, *argstmp; - zend_string *class_name; + zval **funcname, **class, **type, **args, **argstmp; + char is_class; - funcname = zend_hash_str_find(Z_ARRVAL_P(tmp), "function", sizeof("function") - 1); + zend_hash_find(Z_ARRVAL_PP(tmp), "function", sizeof("function"), + (void **)&funcname); - if ((class = zend_hash_str_find(Z_ARRVAL_P(tmp), "object", sizeof("object") - 1)) == NULL) { - class = zend_hash_str_find(Z_ARRVAL_P(tmp), "class", sizeof("class") - 1); + if ((is_class = zend_hash_find(Z_ARRVAL_PP(tmp), + "object", sizeof("object"), (void **)&class)) == FAILURE) { + is_class = zend_hash_find(Z_ARRVAL_PP(tmp), "class", sizeof("class"), + (void **)&class); } else { - class_name = zend_get_object_classname(Z_OBJ_P(class) TSRMLS_CC); + zend_get_object_classname(*class, (const char **)&Z_STRVAL_PP(class), + (zend_uint *)&Z_STRLEN_PP(class) TSRMLS_CC); } - if (class) { - type = zend_hash_str_find(Z_ARRVAL_P(tmp), "type", sizeof("type") - 1); + if (is_class == SUCCESS) { + zend_hash_find(Z_ARRVAL_PP(tmp), "type", sizeof("type"), (void **)&type); } phpdbg_write("%s%s%s(", - class == NULL?"":Z_STRVAL_P(class), - class == NULL?"":Z_STRVAL_P(type), - Z_STRVAL_P(funcname)); + is_class == FAILURE?"":Z_STRVAL_PP(class), + is_class == FAILURE?"":Z_STRVAL_PP(type), + Z_STRVAL_PP(funcname) + ); - if ((args = zend_hash_str_find(Z_ARRVAL_P(tmp), "args", sizeof("args") - 1)) != NULL) { + if (zend_hash_find(Z_ARRVAL_PP(tmp), "args", sizeof("args"), + (void **)&args) == SUCCESS) { HashPosition iterator; const zend_function *func = phpdbg_get_function( - Z_STRVAL_P(funcname), class == NULL ? NULL : Z_STRVAL_P(class) TSRMLS_CC); + Z_STRVAL_PP(funcname), is_class == FAILURE ? NULL : Z_STRVAL_PP(class) TSRMLS_CC); const zend_arg_info *arginfo = func ? func->common.arg_info : NULL; int j = 0, m = func ? func->common.num_args : 0; zend_bool is_variadic = 0; - zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &iterator); - while ((argstmp = zend_hash_get_current_data_ex(Z_ARRVAL_P(args), &iterator)) != NULL) { + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(args), &iterator); + while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(args), + (void **) &argstmp, &iterator) == SUCCESS) { if (j) { phpdbg_write(", "); } @@ -141,8 +151,8 @@ static void phpdbg_dump_prototype(zval *tmp TSRMLS_DC) /* {{{ */ } ++j; - zend_print_flat_zval_r(argstmp TSRMLS_CC); - zend_hash_move_forward_ex(Z_ARRVAL_P(args), &iterator); + zend_print_flat_zval_r(*argstmp TSRMLS_CC); + zend_hash_move_forward_ex(Z_ARRVAL_PP(args), &iterator); } if (is_variadic) { phpdbg_write("]"); @@ -150,15 +160,15 @@ static void phpdbg_dump_prototype(zval *tmp TSRMLS_DC) /* {{{ */ } phpdbg_write(")"); } -/* }}} */ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */ { zval zbacktrace; - zval *tmp; - zval *file, *line; + zval **tmp; + zval **file, **line; HashPosition position; - int i = 1, limit = num; + int i = 0, limit = num; + int user_defined; if (limit < 0) { phpdbg_error("Invalid backtrace size %d", limit); @@ -168,21 +178,22 @@ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */ &zbacktrace, 0, 0, limit TSRMLS_CC); zend_hash_internal_pointer_reset_ex(Z_ARRVAL(zbacktrace), &position); - tmp = zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace), &position); + zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace), (void**)&tmp, &position); while (1) { - file = zend_hash_str_find(Z_ARRVAL_P(tmp), "file", sizeof("file") - 1); - line = zend_hash_str_find(Z_ARRVAL_P(tmp), "line", sizeof("line") - 1); + user_defined = zend_hash_find(Z_ARRVAL_PP(tmp), "file", sizeof("file"), (void **)&file); + zend_hash_find(Z_ARRVAL_PP(tmp), "line", sizeof("line"), (void **)&line); zend_hash_move_forward_ex(Z_ARRVAL(zbacktrace), &position); - if ((tmp = zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace), &position)) == NULL) { - phpdbg_write("frame #0: {main} at %s:%ld", Z_STRVAL_P(file), Z_LVAL_P(line)); + if (zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace), + (void**)&tmp, &position) == FAILURE) { + phpdbg_write("frame #%d: {main} at %s:%ld", i, Z_STRVAL_PP(file), Z_LVAL_PP(line)); break; } - if (file) { + if (user_defined == SUCCESS) { phpdbg_write("frame #%d: ", i++); phpdbg_dump_prototype(tmp TSRMLS_CC); - phpdbg_writeln(" at %s:%ld", Z_STRVAL_P(file), Z_LVAL_P(line)); + phpdbg_writeln(" at %s:%ld", Z_STRVAL_PP(file), Z_LVAL_PP(line)); } else { phpdbg_write(" => "); phpdbg_dump_prototype(tmp TSRMLS_CC); @@ -191,5 +202,5 @@ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */ } phpdbg_writeln(EMPTY); - zval_ptr_dtor(&zbacktrace); + zval_dtor(&zbacktrace); } /* }}} */ |