These are the files that I tested with, the first is without a shebang and the other one begins with a shebang.
File: test_no_shebang.php
<?php
$line_2 = 2;
$line_3 = 3;
$line_4 = 4;
File: test_with_shebang.php
#!/usr/bin/env php
<?php
$line_2 = 2;
$line_3 = 3;
$line_4 = 4;
If I set the breakpoint at line two for the file "test_no_shebang.php" then XDebug protocol will report the correct line numbers when stepping over the file:
<< stack_get -d 0
<response command='stack_get' transaction_id='7' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' xmlns='urn:debugger_protocol_v1'><stack lineno='2' level='0' type='file' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php' where='{main}'/></response>
1 <?php
2 >> $line_2 = 2;
3 $line_3 = 3;
4
5 $line_4 = 4;
<< step_over
<response command='step_over' transaction_id='10' reason='ok' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' status='break' xmlns='urn:debugger_protocol_v1'><xdebug:message lineno='3' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php'/></response>
<< stack_get -d 0
<response command='stack_get' transaction_id='11' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' xmlns='urn:debugger_protocol_v1'><stack lineno='3' level='0' type='file' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php' where='{main}'/></response>
1 <?php
2 $line_2 = 2;
3 >> $line_3 = 3;
4
5 $line_4 = 4;
<< step_over
<response command='step_over' transaction_id='13' reason='ok' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' status='break' xmlns='urn:debugger_protocol_v1'><xdebug:message lineno='5' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php'/></response>
<< stack_get -d 0
<response command='stack_get' transaction_id='14' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' xmlns='urn:debugger_protocol_v1'><stack lineno='5' level='0' type='file' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php' where='{main}'/></response>
2 $line_2 = 2;
3 $line_3 = 3;
4
5 >> $line_4 = 4;
============================================
However, if I try the same with the file ""test_with_shebang.php" the line numbers are reported wrongly (with the breakpoint set at line 3 now) after I step over once, as seen below:
<< stack_get -d 0
<response command='stack_get' transaction_id='7' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' xmlns='urn:debugger_protocol_v1'><stack lineno='3' level='0' type='file' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php' where='{main}'/></response>
1 #!/usr/bin/env php
2 <?php
3 >> $line_2 = 2;
4 $line_3 = 3;
5
6 $line_4 = 4;
Comment: Ok line offset
<< step_over
<response command='step_over' transaction_id='10' reason='ok' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' status='break' xmlns='urn:debugger_protocol_v1'><xdebug:message lineno='5' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php'/></response>
<< stack_get -d 0
<response command='stack_get' transaction_id='11' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' xmlns='urn:debugger_protocol_v1'><stack lineno='5' level='0' type='file' filename='file:///Users/joes/Desktop/xdebug_breakpoint_test.php' where='{main}'/></response>
2 <?php
3 $line_2 = 2;
4 $line_3 = 3;
5 >>
6 $line_4 = 4;
Comment: Something went wrong, suddenly we find ourselves to be at line 5.
<< step_over
<response command='step_over' transaction_id='13' reason='ok' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' status='stopping' xmlns='urn:debugger_protocol_v1'/>
<< stack_get -d 0
<response command='stack_get' transaction_id='14' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' xmlns='urn:debugger_protocol_v1'><error code='5'><message><![CDATA[command is not available]]></message></error></response>
Comment: Couldn't step_over to line 6
===============================================
Also 'xcmd_get_executable_lines' will report the wrong lines for the file "test_with_shebang.php". It seems there's an error in the line offset by -1.
<< xcmd_get_executable_lines -d 0
<response command='xcmd_get_executable_lines' transaction_id='10' xmlns:xdebug='http://xdebug.org/dbgp/xdebug' xmlns='urn:debugger_protocol_v1'>
<xdebug:lines>
<xdebug:line lineno='2'/>
<xdebug:line lineno='3'/>
<xdebug:line lineno='5'/>
</xdebug:lines>
</response>
|