Skip to content

Commit ed7d788

Browse files
committed
phpdbg next command must step over function calls
1 parent f7c43b8 commit ed7d788

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.23
44

5+
- phpdbg:
6+
. Fixed next command not stepping over function calls
57

68
03 Sep 2020, PHP 7.3.22
79

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,16 +1802,13 @@ 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 == execute_data && PHPDBG_G(flags) & PHPDBG_IS_STEPPING) {
18151812
goto stepping;
18161813
}
18171814
goto next;
@@ -1857,6 +1854,9 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
18571854
}
18581855
}
18591856

1857+
/* not while in conditionals */
1858+
phpdbg_print_opline_ex(execute_data, 0);
1859+
18601860
if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING && (PHPDBG_G(flags) & PHPDBG_STEP_OPCODE || execute_data->opline->lineno != PHPDBG_G(last_line))) {
18611861
stepping:
18621862
PHPDBG_G(flags) &= ~PHPDBG_IS_STEPPING;

sapi/phpdbg/tests/next_001.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ prompt> 0
1919
>00005: }
2020
00006:
2121
00007: foo();
22-
prompt> [L8 %s ECHO 1 %s]
23-
>00008: echo 1;
22+
prompt> >00008: echo 1;
2423
00009:
2524
prompt> 1
2625
[L9 %s RETURN<-1> 1 %s]

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)