Skip to content

Commit e48e60f

Browse files
committed
Merged pull request xdebug#1037
2 parents bb41da4 + 9b91299 commit e48e60f

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/debugger/debugger.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,20 @@ void xdebug_debugger_statement_call(zend_string *filename, int lineno)
379379
/* Fetch top level fse */
380380
fse = XDEBUG_VECTOR_TAIL(XG_BASE(stack));
381381

382+
/* If we're in a user-defined main function, with a valid function, with two or more opcodes,
383+
* with the current opcode to be the next-to-last one, and the last opcode being ZEND_RETURN,
384+
* and the value of ZEND_RETURN is a constant, and the value of ZEND_RETURN is the default, then bail out */
385+
if (
386+
fse->user_defined && (fse->function.type & XFUNC_INCLUDES) &&
387+
/*EG(current_execute_data)->opline && */EG(current_execute_data)->func && /*EG(current_execute_data)->func->op_array && */
388+
EG(current_execute_data)->func->op_array.last >= 2 &&
389+
((EG(current_execute_data)->opline - EG(current_execute_data)->func->op_array.opcodes) == EG(current_execute_data)->func->op_array.last - 2) &&
390+
EG(current_execute_data)->func->op_array.opcodes[EG(current_execute_data)->func->op_array.last - 1].opcode == ZEND_RETURN &&
391+
EG(current_execute_data)->func->op_array.opcodes[EG(current_execute_data)->func->op_array.last - 1].op1_type == IS_CONST
392+
) {
393+
return;
394+
}
395+
382396
XG_DBG(suppress_return_value_step) = 0;
383397

384398
if (XG_DBG(context).do_break) {

tests/debugger/maps/skip-vendor-directory/skip-vendor-directory.phpt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ echo file_get_contents( $xdebugLogFileName );
5353

5454
-> step_into -i 4
5555
<?xml version="1.0" encoding="iso-8859-1"?>
56-
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://counter.inc" lineno="15"></xdebug:message></response>
56+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://counter.inc" lineno="6"></xdebug:message></response>
5757

5858
-> step_into -i 5
5959
<?xml version="1.0" encoding="iso-8859-1"?>
60-
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file://counter.inc" lineno="6"></xdebug:message></response>
60+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file://skip-vendor-directory.inc" lineno="7"></xdebug:message></response>
6161
%A
6262
[%d] [Path Mapping] INFO: Scanning for map files with pattern '%sdebugger%e.xdebug%e*.map'
6363
[%d] [Path Mapping] DEBUG: No map files found with pattern '%sdebugger%e.xdebug%e*.map'
@@ -74,12 +74,14 @@ echo file_get_contents( $xdebugLogFileName );
7474
[%d] [Path Mapping] INFO: Location %sautoload.inc:7 needs to be skipped
7575
[%d] [Path Mapping] INFO: Mapping location %scounter.inc:15
7676
[%d] [Path Mapping] INFO: Couldn't map location %sxdebug%ecounter.inc:15
77-
[%d] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://%scounter.inc" lineno="15"></xdebug:message></response>
78-
%A
79-
[%d] [Step Debug] <- step_into -i 5
8077
[%d] [Path Mapping] INFO: Mapping location %sautoload.inc:8
8178
[%d] [Path Mapping] INFO: Location %sautoload.inc:8 needs to be skipped
8279
[%d] [Path Mapping] INFO: Mapping location %scounter.inc:6
8380
[%d] [Path Mapping] INFO: Couldn't map location %scounter.inc:6
84-
[%d] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file://%scounter.inc" lineno="6"></xdebug:message></response>
81+
[%d] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://%scounter.inc" lineno="6"></xdebug:message></response>
82+
%A
83+
[%d] [Step Debug] <- step_into -i 5
84+
[%d] [Path Mapping] INFO: Mapping location %sskip-vendor-directory.inc:7
85+
[%d] [Path Mapping] INFO: Couldn't map location %sskip-vendor-directory.inc:7
86+
[%d] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file://%sskip-vendor-directory.inc" lineno="7"></xdebug:message></response>
8587
%A

0 commit comments

Comments
 (0)