View Issue Details

IDProjectCategoryView StatusLast Update
0001049Xdebugpublic2014-05-07 19:42
Reporterjakubmisek Assigned Toderick  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionno change required 
PlatformVisual Studio + PHP ToolsOSWindowsOS Version7 Pro
Product Version2.2.5 
Summary0001049: specific lines are not hit by debugger
Description

Breakpoints are not hit on specific lines. The same lines are skipped when stepping onto next line while debugging.

Steps To Reproduce

debug attached script file using any IDE, stepping into a function test*, stepping on the next line jumps out.

Additional Information

I assume it is related to how PHP processes/builds its opcode. Is there some well-known behavior of what lines can be stepped onto?

TagsNo tags attached.
Attached Files
index.php (604 bytes)
Operating System
PHP Version5.5.5-5.5.9

Activities

derick

2014-05-07 19:42

administrator   ~0002808

Hi!

This is pretty much expected behaviour. PHP generates opcodes on "wrong" lines in some cases, and array initialisations is one of those cases (As are if/else statements without { and } ).

If you use VLD (derickrethans.nl/projects.html#vld), you will see what gets generated:


derick@whisky:~ $ php -dvld.active=1 /tmp/index.php
Finding entry points
Branch analysis from position: 0
Return found
filename: /tmp/index.php
function name: (null)
number of ops: 20
compiled vars: none
line # * op fetch ext return operands

3 0 > EXT_STMT
1 NOP
11 2 EXT_STMT
3 NOP
22 4 EXT_STMT
5 NOP
30 6 EXT_STMT
7 EXT_FCALL_BEGIN
8 DO_FCALL 0 'test1'
9 EXT_FCALL_END
31 10 EXT_STMT
11 EXT_FCALL_BEGIN
12 DO_FCALL 0 'test2'
13 EXT_FCALL_END
32 14 EXT_STMT
15 EXT_FCALL_BEGIN
16 DO_FCALL 0 'test3'
17 EXT_FCALL_END
34 18 EXT_STMT
19 > RETURN 1

branch: # 0; line: 3- 34; sop: 0; eop: 19
path #1: 0,
Function test1:
Finding entry points
Branch analysis from position: 0
Return found
filename: /tmp/index.php
function name: test1
number of ops: 6
compiled vars: none
line # * op fetch ext return operands

3 0 > EXT_NOP
8 1 EXT_STMT
2 INIT_ARRAY ~0 123
3 > RETURN ~0
9 4 EXT_STMT
5
> RETURN null

branch: # 0; line: 3- 9; sop: 0; eop: 5
path #1: 0,
End of function test1.

Function test2:
Finding entry points
Branch analysis from position: 0
Return found
filename: /tmp/index.php
function name: test2
number of ops: 16
compiled vars: none
line # * op fetch ext return operands

11 0 > EXT_NOP
14 1 EXT_STMT
2 INIT_ARRAY ~0 1
3 ADD_ARRAY_ELEMENT ~0 2
15 4 ADD_ARRAY_ELEMENT ~0 3
5 ADD_ARRAY_ELEMENT ~0 4
6 ADD_ARRAY_ELEMENT ~0 5
7 ADD_ARRAY_ELEMENT ~0 6
16 8 ADD_ARRAY_ELEMENT ~0 6
9 ADD_ARRAY_ELEMENT ~0 7
10 ADD_ARRAY_ELEMENT ~0 87
18 11 ADD_ARRAY_ELEMENT ~0 8
19 12 ADD_ARRAY_ELEMENT ~0 123
13 > RETURN ~0
20 14 EXT_STMT
15
> RETURN null

branch: # 0; line: 11- 20; sop: 0; eop: 15
path #1: 0,
End of function test2.

Function test3:
Finding entry points
Branch analysis from position: 0
Return found
filename: /tmp/index.php
function name: test3
number of ops: 13
compiled vars: none
line # * op fetch ext return operands

22 0 > EXT_NOP
25 1 EXT_STMT
2 INIT_ARRAY ~0 1
3 ADD_ARRAY_ELEMENT ~0 2
4 ADD_ARRAY_ELEMENT ~0 3
5 INIT_ARRAY 0000002:0000001 ~0
26 6 INIT_ARRAY 0000002:0000002 4
7 ADD_ARRAY_ELEMENT 0000002:0000002 5
8 ADD_ARRAY_ELEMENT 0000002:0000002 6
27 9 ADD_ARRAY_ELEMENT 0000002:0000001 0000002:0000002
10 > RETURN 0000002:0000001
28 11 EXT_STMT
12
> RETURN null

branch: # 0; line: 22- 28; sop: 0; eop: 12
path #1: 0,
End of function test3.

IDEs can discover on which lines breakpoints can be set when using Xdebug, by using the xcmd_get_executable_lines command. I don't think that any IDEs really support this though, and I don't think it's part of the official DBGp specs either.

Issue History

Date Modified Username Field Change
2014-05-07 17:43 jakubmisek New Issue
2014-05-07 17:43 jakubmisek File Added: index.php
2014-05-07 19:42 derick Note Added: 0002808
2014-05-07 19:42 derick Status new => resolved
2014-05-07 19:42 derick Resolution open => no change required
2014-05-07 19:42 derick Assigned To => derick
2016-07-31 12:35 derick Category Debug client (console) => debugclient (debugging tool)
2016-07-31 12:35 derick Category debugclient (debugging tool) => (No Category)