Skip to content

Commit e4a46fe

Browse files
committed
phpdbg next command must step over function calls
This was broken in cf35dae. The fix is to try to better target the fix applied in that patch to only instances where we have left the current context and entered the previous context.
1 parent f7c43b8 commit e4a46fe

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,16 +1802,16 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
18021802
goto next;
18031803
}
18041804

1805-
/* not while in conditionals */
1806-
phpdbg_print_opline_ex(execute_data, 0);
1807-
18081805
/* perform seek operation */
18091806
if ((PHPDBG_G(flags) & PHPDBG_SEEK_MASK) && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
18101807
/* current address */
18111808
zend_ulong address = (zend_ulong) execute_data->opline;
18121809

18131810
if (PHPDBG_G(seek_ex) != execute_data) {
1814-
if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) {
1811+
if (PHPDBG_G(seek_ex)->prev_execute_data &&
1812+
phpdbg_user_execute_data(PHPDBG_G(seek_ex)->prev_execute_data) == execute_data &&
1813+
PHPDBG_G(flags) & PHPDBG_IS_STEPPING) {
1814+
phpdbg_print_opline_ex(execute_data, 0);
18151815
goto stepping;
18161816
}
18171817
goto next;
@@ -1857,6 +1857,9 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
18571857
}
18581858
}
18591859

1860+
/* not while in conditionals */
1861+
phpdbg_print_opline_ex(execute_data, 0);
1862+
18601863
if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING && (PHPDBG_G(flags) & PHPDBG_STEP_OPCODE || execute_data->opline->lineno != PHPDBG_G(last_line))) {
18611864
stepping:
18621865
PHPDBG_G(flags) &= ~PHPDBG_IS_STEPPING;

sapi/phpdbg/tests/next_002.phpt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
Test next command step over functionality
3+
--SKIPIF--
4+
<?php
5+
if (PHP_OS_FAMILY === 'Windows' && ini_get('opcache.jit') && ini_get('opcache.jit_buffer_size')) {
6+
die('xfail breakpoint/watchpoint issues with JIT on Windows');
7+
}
8+
?>
9+
--PHPDBG--
10+
b 7
11+
r
12+
n
13+
q
14+
--EXPECTF--
15+
[Successful compilation of %s]
16+
prompt> [Breakpoint #0 added at %s:7]
17+
prompt> [Breakpoint #0 at %s:7, hits: 1]
18+
>00007: foo();
19+
00008: echo 1;
20+
00009:
21+
prompt> 0
22+
[L8 %s ECHO 1 %s]
23+
>00008: echo 1;
24+
00009:
25+
prompt>
26+
--FILE--
27+
<?php
28+
29+
function foo() {
30+
echo 0;
31+
}
32+
33+
foo();
34+
echo 1;

0 commit comments

Comments
 (0)