View Issue Details

IDProjectCategoryView StatusLast Update
0002118XdebugStep Debuggingpublic2022-09-16 14:13
Reporterbarel Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.1.5 
Summary0002118: xdebug_break reports incorrect line information
Description

When code is stopped by adding an xdebug_break() call to the code, the line reported for the breakpoint is actually the next line. Then if you step into or step out you remain in that same line.

According to the documentation provided in the xdebug.org page "This function makes the debugger break on the line it is called from, as if a normal file/line breakpoint was set on this line through the debugger protocol." So its behaviour does not match what is documented (and desired from my point of view)

Steps To Reproduce

This is easily reproducible by running test case tests/debugger/bug02049.phpt in the Xdebug tests. In the expected output of that test you can see:

-> run -i 4
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="run" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://bug02049.inc" lineno="5"></xdebug:message></response>

-> stack_get -i 5
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="stack_get" transaction_id="5"><stack where="{main}" level="0" type="file" filename="file://bug02049.inc" lineno="5"></stack></response>

...

-> step_over -i 11
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="step_over" transaction_id="11" status="break" reason="ok"><xdebug:message filename="file://bug02049.inc" lineno="5"></xdebug:message></response>

-> stack_get -i 12
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="stack_get" transaction_id="12"><stack where="{main}" level="0" type="file" filename="file://bug02049.inc" lineno="5"></stack></response>

this is wrong it should be:

-> run -i 4
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="run" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://bug02049.inc" lineno="4"></xdebug:message></response>

-> stack_get -i 5
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="stack_get" transaction_id="5"><stack where="{main}" level="0" type="file" filename="file://bug02049.inc" lineno="4"></stack></response>

...

-> step_over -i 11
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="step_over" transaction_id="11" status="break" reason="ok"><xdebug:message filename="file://bug02049.inc" lineno="5"></xdebug:message></response>

-> stack_get -i 12
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="stack_get" transaction_id="12"><stack where="{main}" level="0" type="file" filename="file://bug02049.inc" lineno="5"></stack></response>

(the difference is the lineno in the two first commands)

Additional Information

I tested this in Ubuntu using PHP 8.0.19 but I suspect it happens in all OS and supported PHP versions given that this Xdebug test passes everywhere

TagsNo tags attached.
Operating SystemUbuntu
PHP Version8.0.10-8.0.19

Activities

barel

2022-09-16 14:13

reporter   ~0006375

When I said "step out" in "if you step into or step out you remain in that same line." I meant "step over"

Issue History

Date Modified Username Field Change
2022-09-16 14:09 barel New Issue
2022-09-16 14:13 barel Note Added: 0006375