Skip to content

Commit be473d6

Browse files
committedApr 14, 2013
Partial fix for xdebug 2.2.1
1 parent af7a6ca commit be473d6

File tree

2 files changed

+199
-12
lines changed

2 files changed

+199
-12
lines changed
 

‎cgparser.py

+24-12
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,22 @@ class XdebugCachegrindFsaParser:
205205
# -2 got eof or fl, finish parsing
206206
# -1 error, finish parsing
207207
# 0 start
208-
# 1 got version, expecting cmd
208+
# 1 got version, expecting cmd or creator
209209
# 2 got cmd, expecting part
210-
# 3 gor part, expecting events
210+
# 3 got part, expecting events or positions
211211
# 4 got events, expecting fl or eof
212+
# 5 got creator, expecting cmd
213+
# 6 got positions, expecting events
212214
header_fsm = {
213-
# 0 1 2 3 4
214-
0: [ 1, -1, -1, -1, -1], # version
215-
1: [-1, 2, -1, -1, -1], # cmd
216-
2: [-1, -1, 3, -1, -1], # part
217-
3: [-1, -1, -1, 4, -1], # events
218-
4: [-1, -1, -1, -1, -2], # fl
219-
5: [-1, -1, -1, -1, -2], # eof
215+
# 0 1 2 3 4 5 6 # token:
216+
0: [ 1, -1, -1, -1, -1, -1, -1], # version
217+
1: [-1, 2, -1, -1, -1, 2, -1], # cmd
218+
2: [-1, -1, 3, -1, -1, -1, -1], # part
219+
3: [-1, -1, -1, 4, -1, -1, 4], # events
220+
4: [-1, -1, -1, -1, -2, -1, -1], # fl
221+
5: [-1, -1, -1, -1, -2, -1, -1], # eof
222+
6: [-1, 5, -1, -1, -1, -1, -1], # creator
223+
7: [-1, -1, -1, 6, -1, -1, -1], # positions
220224
}
221225

222226
# body states:
@@ -231,7 +235,7 @@ class XdebugCachegrindFsaParser:
231235
# 6 got subcall num, expecting fl or cfn or eof
232236
# 7 got summary, expecting num
233237
body_fsm = {
234-
# 0 1 2 3 4 5 6 7
238+
# 0 1 2 3 4 5 6 7 # token:
235239
0: [ 0, -1, -1, -1, -1, -1, -1, -1], # header
236240
1: [ 1, -1, -1, 1, -1, -1, 1, -1], # fl
237241
2: [-1, 2, -1, -1, -1, -1, -1, -1], # fn
@@ -250,6 +254,7 @@ def get_header(self):
250254

251255
state = 0;
252256
line_no = 0
257+
version = None
253258

254259
while True:
255260
token = None
@@ -258,7 +263,7 @@ def get_header(self):
258263
line_no += 1
259264
if line == '\n':
260265
continue
261-
if line == 'version: 0.9.6\n':
266+
if line[0:9] == 'version: ':
262267
token = 0
263268
if line[0:5] == 'cmd: ':
264269
token = 1
@@ -268,6 +273,10 @@ def get_header(self):
268273
token = 3
269274
if line[0:3] == 'fl=':
270275
token = 4
276+
if line[0:9] == 'creator: ':
277+
token = 6
278+
if line[0:11] == 'positions: ':
279+
token = 7
271280
except StopIteration:
272281
token = 5
273282

@@ -282,10 +291,13 @@ def get_header(self):
282291
elif state == -1:
283292
raise CgParseError(line_no, line, token)
284293

294+
elif state == 1:
295+
version = line[9:-1]
296+
285297
elif state == 2:
286298
cmd = line[5:-1]
287299

288-
return RawHeader('0.9.6', cmd, '1', 'Time')
300+
return RawHeader(version, cmd, '1', 'Time')
289301

290302
def get_body(self):
291303
body = []

‎fixtures/1.php.xdebug-2.2.1.cg

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
version: 1
2+
creator: xdebug 2.2.1
3+
cmd: /home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
4+
part: 1
5+
positions: line
6+
7+
events: Time
8+
9+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
10+
fn=c
11+
16 2
12+
13+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
14+
fn=c
15+
16 2
16+
17+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
18+
fn=a->__construct
19+
3 31
20+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
21+
cfn=c
22+
calls=1 0 0
23+
4 2
24+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
25+
cfn=c
26+
calls=1 0 0
27+
5 2
28+
29+
fl=php:internal
30+
fn=php::usleep
31+
20 100090
32+
33+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
34+
fn=d
35+
19 102
36+
cfl=php:internal
37+
cfn=php::usleep
38+
calls=1 0 0
39+
20 100090
40+
41+
fl=php:internal
42+
fn=php::usleep
43+
20 100101
44+
45+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
46+
fn=d
47+
19 87
48+
cfl=php:internal
49+
cfn=php::usleep
50+
calls=1 0 0
51+
20 100101
52+
53+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
54+
fn=b->__construct
55+
10 56
56+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
57+
cfn=d
58+
calls=1 0 0
59+
11 100193
60+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
61+
cfn=d
62+
calls=1 0 0
63+
12 100189
64+
65+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
66+
fn=c
67+
16 3
68+
69+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
70+
fn=c
71+
16 3
72+
73+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
74+
fn=a->__construct
75+
3 53
76+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
77+
cfn=c
78+
calls=1 0 0
79+
4 3
80+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
81+
cfn=c
82+
calls=1 0 0
83+
5 3
84+
85+
fl=php:internal
86+
fn=php::usleep
87+
20 100133
88+
89+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
90+
fn=d
91+
19 92
92+
cfl=php:internal
93+
cfn=php::usleep
94+
calls=1 0 0
95+
20 100133
96+
97+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
98+
fn=c
99+
16 4
100+
101+
fl=php:internal
102+
fn=php::usleep
103+
20 100079
104+
105+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
106+
fn=d
107+
19 56
108+
cfl=php:internal
109+
cfn=php::usleep
110+
calls=1 0 0
111+
20 100079
112+
113+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
114+
fn=c
115+
16 2
116+
117+
fl=php:internal
118+
fn=php::register_shutdown_function
119+
31 18
120+
121+
fl=php:internal
122+
fn=php::register_shutdown_function
123+
32 2
124+
125+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
126+
fn={main}
127+
128+
summary: 401180
129+
130+
1 255
131+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
132+
cfn=a->__construct
133+
calls=1 0 0
134+
23 36
135+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
136+
cfn=b->__construct
137+
calls=1 0 0
138+
24 200440
139+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
140+
cfn=a->__construct
141+
calls=1 0 0
142+
25 60
143+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
144+
cfn=d
145+
calls=1 0 0
146+
26 100226
147+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
148+
cfn=c
149+
calls=1 0 0
150+
27 4
151+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
152+
cfn=d
153+
calls=1 0 0
154+
28 100135
155+
cfl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
156+
cfn=c
157+
calls=1 0 0
158+
29 2
159+
cfl=php:internal
160+
cfn=php::register_shutdown_function
161+
calls=1 0 0
162+
31 18
163+
cfl=php:internal
164+
cfn=php::register_shutdown_function
165+
calls=1 0 0
166+
32 2
167+
168+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
169+
fn=c
170+
16 1
171+
172+
fl=/home/wicked/Alawar/xdebugtoolkit-github/fixtures/1.php
173+
fn=c
174+
16 0
175+

0 commit comments

Comments
 (0)
Please sign in to comment.