@@ -1687,33 +1687,33 @@ int phpdbg_interactive(zend_bool allow_async_unsafe, char *input) /* {{{ */
16871687 return ret ;
16881688} /* }}} */
16891689
1690+ static inline void list_code () {
1691+ if (!(PHPDBG_G (flags ) & PHPDBG_IN_EVAL )) {
1692+ const char * file_char = zend_get_executed_filename ();
1693+ zend_string * file = zend_string_init (file_char , strlen (file_char ), 0 );
1694+ phpdbg_list_file (file , 3 , zend_get_executed_lineno ()- 1 , zend_get_executed_lineno ());
1695+ efree (file );
1696+ }
1697+ }
1698+
16901699/* code may behave weirdly if EG(exception) is set; thus backup it */
16911700#define DO_INTERACTIVE (allow_async_unsafe ) do { \
1692- const zend_op *backup_opline; \
1693- const zend_op *before_ex; \
16941701 if (exception) { \
1702+ const zend_op *before_ex = EG(opline_before_exception); \
1703+ const zend_op *backup_opline = NULL; \
16951704 if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) { \
16961705 backup_opline = EG(current_execute_data)->opline; \
16971706 } \
1698- before_ex = EG(opline_before_exception); \
16991707 GC_ADDREF(exception); \
17001708 zend_clear_exception(); \
1701- } \
1702- if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) { \
1703- const char *file_char = zend_get_executed_filename(); \
1704- zend_string *file = zend_string_init(file_char, strlen(file_char), 0); \
1705- phpdbg_list_file(file, 3, zend_get_executed_lineno()-1, zend_get_executed_lineno()); \
1706- efree(file); \
1707- } \
1708- \
1709- switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \
1710- zval zv; \
1711- case PHPDBG_LEAVE: \
1712- case PHPDBG_FINISH: \
1713- case PHPDBG_UNTIL: \
1714- case PHPDBG_NEXT: \
1715- if (exception) { \
1716- if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type) \
1709+ list_code(); \
1710+ switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \
1711+ zval zv; \
1712+ case PHPDBG_LEAVE: \
1713+ case PHPDBG_FINISH: \
1714+ case PHPDBG_UNTIL: \
1715+ case PHPDBG_NEXT: \
1716+ if (backup_opline \
17171717 && (backup_opline->opcode == ZEND_HANDLE_EXCEPTION || backup_opline->opcode == ZEND_CATCH)) { \
17181718 EG(current_execute_data)->opline = backup_opline; \
17191719 EG(exception) = exception; \
@@ -1722,11 +1722,12 @@ int phpdbg_interactive(zend_bool allow_async_unsafe, char *input) /* {{{ */
17221722 zend_throw_exception_internal(&zv); \
17231723 } \
17241724 EG(opline_before_exception) = before_ex; \
1725- } \
1726- /* fallthrough */ \
1727- default : \
1728- goto next ; \
1725+ } \
1726+ } else { \
1727+ list_code(); \
1728+ phpdbg_interactive(allow_async_unsafe, NULL) ; \
17291729 } \
1730+ goto next; \
17301731} while (0)
17311732
17321733void phpdbg_execute_ex (zend_execute_data * execute_data ) /* {{{ */
0 commit comments