Fix breaking on HANDLE_EXCEPTION (opline_before_exception)

This commit is contained in:
Bob Weinand 2015-08-03 17:15:26 +02:00
parent 472a8414cc
commit 34596a3ddd
2 changed files with 58 additions and 1 deletions

View File

@ -1404,13 +1404,15 @@ void phpdbg_clean(zend_bool full) /* {{{ */
}
} /* }}} */
/* code may behave weirdly if EG(exception) is set */
/* 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) { \
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_REFCOUNT(exception); \
zend_clear_exception(); \
} \
@ -1436,6 +1438,7 @@ void phpdbg_clean(zend_bool full) /* {{{ */
Z_OBJ(zv) = exception; \
zend_throw_exception_internal(&zv); \
} \
EG(opline_before_exception) = before_ex; \
} \
/* fallthrough */ \
default: \

View File

@ -0,0 +1,54 @@
--TEST--
Test breaks on HANDLE_EXCEPTION
--PHPDBG--
b 5
r
s
s
q
--EXPECTF--
[Successful compilation of %s]
prompt> [Breakpoint #0 added at %s:5]
prompt> [Breakpoint #0 at %s:5, hits: 1]
>00005: x();
00006: } finally {
00007: print "ok\n";
prompt> [L0 %s HANDLE_EXCEPTION %s]
>00005: x();
00006: } finally {
00007: print "ok\n";
prompt> [L7 %s ECHO "ok " %s]
>00007: print "ok\n";
00008: }
00009: } catch (Error $e) {
prompt> ok
[L7 %s FAST_RET<TO_CATCH> ~%d J7 %s]
[L9 %s CATCH "Error" $e 1 %s]
>00005: x();
00006: } finally {
00007: print "ok\n";
prompt> [L10 %s ECHO "caught " %s]
>00010: print "caught\n";
00011: }
00012:
prompt> caught
[L10 %s RETURN 1 %s]
[Script ended normally]
prompt>
--FILE--
<?php
try {
try {
x();
} finally {
print "ok\n";
}
} catch (Error $e) {
print "caught\n";
}
?>