diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-12 12:04:11 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-12 12:04:11 +0200 |
commit | 785f034e4188e60c0a6d2708646438f9872a1309 (patch) | |
tree | ce202d84b957df6723d70e704325f2be073b327a /sapi/phpdbg/phpdbg_prompt.c | |
parent | b8b00263c5d58d2b15d6e59f80cc6b45c3dd3688 (diff) | |
parent | ba40f505e5804a5f62a1e220b0dce9d417a27f4d (diff) | |
download | php-git-785f034e4188e60c0a6d2708646438f9872a1309.tar.gz |
Merge branch 'PHP-7.4'
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 4b20732286..d8a31184d3 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -1687,33 +1687,33 @@ int phpdbg_interactive(zend_bool allow_async_unsafe, char *input) /* {{{ */ return ret; } /* }}} */ +static inline void list_code() { + if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) { + const char *file_char = zend_get_executed_filename(); + zend_string *file = zend_string_init(file_char, strlen(file_char), 0); + phpdbg_list_file(file, 3, zend_get_executed_lineno()-1, zend_get_executed_lineno()); + efree(file); + } +} + /* code may behave weirdly if EG(exception) is set; thus backup it */ #define DO_INTERACTIVE(allow_async_unsafe) do { \ - const zend_op *backup_opline; \ - const zend_op *before_ex; \ if (exception) { \ + const zend_op *before_ex = EG(opline_before_exception); \ + const zend_op *backup_opline = NULL; \ if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) { \ backup_opline = EG(current_execute_data)->opline; \ } \ - before_ex = EG(opline_before_exception); \ GC_ADDREF(exception); \ zend_clear_exception(); \ - } \ - if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) { \ - const char *file_char = zend_get_executed_filename(); \ - zend_string *file = zend_string_init(file_char, strlen(file_char), 0); \ - phpdbg_list_file(file, 3, zend_get_executed_lineno()-1, zend_get_executed_lineno()); \ - efree(file); \ - } \ - \ - switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \ - zval zv; \ - case PHPDBG_LEAVE: \ - case PHPDBG_FINISH: \ - case PHPDBG_UNTIL: \ - case PHPDBG_NEXT: \ - if (exception) { \ - if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type) \ + list_code(); \ + switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \ + zval zv; \ + case PHPDBG_LEAVE: \ + case PHPDBG_FINISH: \ + case PHPDBG_UNTIL: \ + case PHPDBG_NEXT: \ + if (backup_opline \ && (backup_opline->opcode == ZEND_HANDLE_EXCEPTION || backup_opline->opcode == ZEND_CATCH)) { \ EG(current_execute_data)->opline = backup_opline; \ EG(exception) = exception; \ @@ -1722,11 +1722,12 @@ int phpdbg_interactive(zend_bool allow_async_unsafe, char *input) /* {{{ */ zend_throw_exception_internal(&zv); \ } \ EG(opline_before_exception) = before_ex; \ - } \ - /* fallthrough */ \ - default: \ - goto next; \ + } \ + } else { \ + list_code(); \ + phpdbg_interactive(allow_async_unsafe, NULL); \ } \ + goto next; \ } while (0) void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */ |