Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 670 lines (608 sloc) 13.474 kB
8e9805b @laruence Now we can set the tsrm_ls manually
laruence authored
1 define set_ts
2 set $tsrm_ls = $arg0
3 end
4
5 document set_ts
6 set the ts resource, it is impossible for gdb to
7 call ts_resource_ex while no process is running,
8 but we could get the resource from the argument
9 of frame info.
10 end
11
cfbf35a Support for ZTS
Marcus Boerger authored
12 define ____executor_globals
6dcb27d - MFH
Marcus Boerger authored
13 if basic_functions_module.zts
8e9805b @laruence Now we can set the tsrm_ls manually
laruence authored
14 if !$tsrm_ls
15 set $tsrm_ls = ts_resource_ex(0, 0)
16 end
49e9d8f @laruence Fix wrong type in the marco of fetching thread globals
laruence authored
17 set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1])
18 set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
cfbf35a Support for ZTS
Marcus Boerger authored
19 else
20 set $eg = executor_globals
edc7e30 - MFH Add compiler globals as
Marcus Boerger authored
21 set $cg = compiler_globals
cfbf35a Support for ZTS
Marcus Boerger authored
22 end
23 end
24
25 document ____executor_globals
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
26 portable way of accessing executor_globals, set $eg
edc7e30 - MFH Add compiler globals as
Marcus Boerger authored
27 this also sets compiler_globals to $cg
6dcb27d - MFH
Marcus Boerger authored
28 ZTS detection is automatically based on ext/standard module struct
cfbf35a Support for ZTS
Marcus Boerger authored
29 end
30
e4e7e2b - Added a function to print all CVs from the local scope.
Derick Rethans authored
31 define print_cvs
32 ____executor_globals
33 set $p = $eg.current_execute_data.CVs
34 set $c = $eg.current_execute_data.op_array.last_var
35 set $v = $eg.current_execute_data.op_array.vars
36 set $i = 0
37
38 printf "Compiled variables count: %d\n", $c
39 while $i < $c
40 printf "%d = %s\n", $i, $v[$i].name
41 if $p[$i] != 0
42 printzv *$p[$i]
43 else
44 printf "*uninitialized*\n"
45 end
46 set $i = $i + 1
47 end
48 end
49
c1706b5 add really nice dump_bt function for debugging in gdb
Thies C. Arntzen authored
50 define dump_bt
cfbf35a Support for ZTS
Marcus Boerger authored
51 set $t = $arg0
52 while $t
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
53 printf "[%p] ", $t
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
54 set $fst = $t->function_state
55 if $fst.function->common.function_name
56 if $fst.arguments
57 set $count = (int)*($fst.arguments)
58
59 if $t->object
752280d @reeze Add missing ____executor_globals in dump_bt if needed
reeze authored
60 if $fst.function.common.scope
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
61 printf "%s->", $fst.function.common.scope->name
62 else
8e9805b @laruence Now we can set the tsrm_ls manually
laruence authored
63 if !$eg
dedbba4 @reeze Eliminate process running requirement of dump_bt in .gdbinit
reeze authored
64 ____executor_globals
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
65 end
66
dedbba4 @reeze Eliminate process running requirement of dump_bt in .gdbinit
reeze authored
67 set $known_class = 0
68 if $eg
69 set $handle = $t->object.value.obj.handle
70 set $handlers = $t->object.value.obj.handlers
71 set $zobj = (zend_object *)$eg.objects_store.object_buckets[$handle].bucket.obj.object
72
73 if $handlers->get_class_entry == &zend_std_object_get_class
74 set $known_class = 1
75
76 if $handlers.get_class_name
77 if $handlers.get_class_name != &zend_std_object_get_class_name
78 set $known_class = 0
79 end
80 end
81
82 if $known_class
83 printf "%s->", $zobj->ce.name
84 end
85 end
86 end
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
87
dedbba4 @reeze Eliminate process running requirement of dump_bt in .gdbinit
reeze authored
88 if !$known_class
8e9805b @laruence Now we can set the tsrm_ls manually
laruence authored
89 printf "(Unknown)->"
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
90 end
91 end
92 else
93 if $fst.function.common.scope
94 printf "%s::", $fst.function.common.scope->name
95 end
96 end
97
98 printf "%s(", $fst.function->common.function_name
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
99 while $count > 0
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
100 set $zvalue = *(zval **)($fst.arguments - $count)
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
101 set $type = $zvalue->type
102 if $type == 0
103 printf "NULL"
104 end
105 if $type == 1
106 printf "%ld", $zvalue->value.lval
107 end
108 if $type == 2
109 printf "%lf", $zvalue->value.dval
110 end
111 if $type == 3
112 if $zvalue->value.lval
113 printf "true"
114 else
115 printf "false"
17f5bf2 @laruence Add zbacktrace_ex to .gdbinit which will print extra argument info th…
laruence authored
116 end
117 end
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
118 if $type == 4
119 printf "array(%d)[%p]", $zvalue->value.ht->nNumOfElements, $zvalue
120 end
121 if $type == 5
122 printf "object[%p]", $zvalue
123 end
124 if $type == 6
125 ____print_str $zvalue->value.str.val $zvalue->value.str.len
126 end
127 if $type == 7
128 printf "resource(#%d)", $zvalue->value.lval
129 end
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
130 if $type == 8
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
131 printf "constant"
132 end
133 if $type == 9
134 printf "const_array"
135 end
136 if $type > 9
137 printf "unknown type %d", $type
138 end
139 set $count = $count -1
140 if $count > 0
141 printf ", "
142 end
17f5bf2 @laruence Add zbacktrace_ex to .gdbinit which will print extra argument info th…
laruence authored
143 end
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
144 printf ") "
17f5bf2 @laruence Add zbacktrace_ex to .gdbinit which will print extra argument info th…
laruence authored
145 else
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
146 printf "%s() ", $fst.function->common.function_name
17f5bf2 @laruence Add zbacktrace_ex to .gdbinit which will print extra argument info th…
laruence authored
147 end
c1706b5 add really nice dump_bt function for debugging in gdb
Thies C. Arntzen authored
148 else
149 printf "??? "
150 end
151 if $t->op_array != 0
152 printf "%s:%d ", $t->op_array->filename, $t->opline->lineno
153 end
154 set $t = $t->prev_execute_data
155 printf "\n"
cfbf35a Support for ZTS
Marcus Boerger authored
156 end
c1706b5 add really nice dump_bt function for debugging in gdb
Thies C. Arntzen authored
157 end
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
158
c1706b5 add really nice dump_bt function for debugging in gdb
Thies C. Arntzen authored
159 document dump_bt
160 dumps the current execution stack. usage: dump_bt executor_globals.current_execute_data
161 end
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
162
163 define printzv
7177ada some improvements to the debugging macros
Sterling Hughes authored
164 set $ind = 1
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
165 ____printzv $arg0 0
166 end
167
168 document printzv
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
169 prints zval contents
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
170 end
171
7177ada some improvements to the debugging macros
Sterling Hughes authored
172 define ____printzv_contents
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
173 set $zvalue = $arg0
6dcb27d - MFH
Marcus Boerger authored
174 set $type = $zvalue->type
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
175
ea74505 Fix macros after GC patch.
Andrei Zmievski authored
176 printf "(refcount=%d", $zvalue->refcount__gc
177 if $zvalue->is_ref__gc
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
178 printf ",is_ref"
179 end
180 printf ") "
6dcb27d - MFH
Marcus Boerger authored
181 if $type == 0
182 printf "NULL"
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
183 end
6dcb27d - MFH
Marcus Boerger authored
184 if $type == 1
185 printf "long: %ld", $zvalue->value.lval
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
186 end
6dcb27d - MFH
Marcus Boerger authored
187 if $type == 2
188 printf "double: %lf", $zvalue->value.dval
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
189 end
6dcb27d - MFH
Marcus Boerger authored
190 if $type == 3
191 printf "bool: "
192 if $zvalue->value.lval
193 printf "true"
194 else
195 printf "false"
196 end
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
197 end
6dcb27d - MFH
Marcus Boerger authored
198 if $type == 4
199 printf "array(%d): ", $zvalue->value.ht->nNumOfElements
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
200 if ! $arg1
201 printf "{\n"
202 set $ind = $ind + 1
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
203 ____print_ht $zvalue->value.ht 1
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
204 set $ind = $ind - 1
205 set $i = $ind
206 while $i > 0
207 printf " "
208 set $i = $i - 1
209 end
210 printf "}"
211 end
6dcb27d - MFH
Marcus Boerger authored
212 set $type = 0
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
213 end
6dcb27d - MFH
Marcus Boerger authored
214 if $type == 5
215 printf "object"
216 ____executor_globals
217 set $handle = $zvalue->value.obj.handle
218 set $handlers = $zvalue->value.obj.handlers
219 if basic_functions_module.zts
220 set $zobj = zend_objects_get_address($zvalue, $tsrm_ls)
221 else
222 set $zobj = zend_objects_get_address($zvalue)
223 end
224 if $handlers->get_class_entry == &zend_std_object_get_class
225 set $cname = $zobj->ce.name
226 else
227 set $cname = "Unknown"
228 end
229 printf "(%s) #%d", $cname, $handle
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
230 if ! $arg1
6dcb27d - MFH
Marcus Boerger authored
231 if $handlers->get_properties == &zend_std_get_properties
232 set $ht = $zobj->properties
233 if $ht
234 printf "(%d): ", $ht->nNumOfElements
235 printf "{\n"
236 set $ind = $ind + 1
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
237 ____print_ht $ht 1
6dcb27d - MFH
Marcus Boerger authored
238 set $ind = $ind - 1
239 set $i = $ind
240 while $i > 0
241 printf " "
242 set $i = $i - 1
243 end
244 printf "}"
245 else
246 echo "no properties found"
247 end
cfbf35a Support for ZTS
Marcus Boerger authored
248 end
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
249 end
6dcb27d - MFH
Marcus Boerger authored
250 set $type = 0
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
251 end
6dcb27d - MFH
Marcus Boerger authored
252 if $type == 6
78d11cb @m6w6 - add print_inh (prints a very simple class tree, ie. extensible)
m6w6 authored
253 printf "string(%d): ", $zvalue->value.str.len
254 ____print_str $zvalue->value.str.val $zvalue->value.str.len
6dcb27d - MFH
Marcus Boerger authored
255 end
256 if $type == 7
257 printf "resource: #%d", $zvalue->value.lval
258 end
259 if $type == 8
260 printf "constant"
261 end
262 if $type == 9
263 printf "const_array"
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
264 end
6dcb27d - MFH
Marcus Boerger authored
265 if $type > 9
266 printf "unknown type %d", $type
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
267 end
268 printf "\n"
269 end
270
7177ada some improvements to the debugging macros
Sterling Hughes authored
271 define ____printzv
272 ____executor_globals
273 set $zvalue = $arg0
274
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
275 printf "[%p] ", $zvalue
7177ada some improvements to the debugging macros
Sterling Hughes authored
276
277 if $zvalue == $eg.uninitialized_zval_ptr
278 printf "*uninitialized* "
279 end
280
6dcb27d - MFH
Marcus Boerger authored
281 set $zcontents = (zval*) $zvalue
7177ada some improvements to the debugging macros
Sterling Hughes authored
282 if $arg1
283 ____printzv_contents $zcontents $arg1
284 else
b2ea792 Fixed printzv macro
Moriyoshi Koizumi authored
285 ____printzv_contents $zcontents 0
7177ada some improvements to the debugging macros
Sterling Hughes authored
286 end
287 end
288
289 define ____print_const_table
290 set $ht = $arg0
291 set $p = $ht->pListHead
292
293 while $p != 0
6dcb27d - MFH
Marcus Boerger authored
294 set $const = (zend_constant *) $p->pData
7177ada some improvements to the debugging macros
Sterling Hughes authored
295
296 set $i = $ind
297 while $i > 0
298 printf " "
299 set $i = $i - 1
300 end
301
78d11cb @m6w6 - add print_inh (prints a very simple class tree, ie. extensible)
m6w6 authored
302 if $p->nKeyLength > 0
303 ____print_str $p->arKey $p->nKeyLength
304 printf " => "
7177ada some improvements to the debugging macros
Sterling Hughes authored
305 else
306 printf "%d => ", $p->h
307 end
308
6dcb27d - MFH
Marcus Boerger authored
309 ____printzv_contents &$const->value 0
7177ada some improvements to the debugging macros
Sterling Hughes authored
310 set $p = $p->pListNext
311 end
312 end
313
314 define print_const_table
315 set $ind = 1
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
316 printf "[%p] {\n", $arg0
7177ada some improvements to the debugging macros
Sterling Hughes authored
317 ____print_const_table $arg0
318 printf "}\n"
319 end
320
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
321 define ____print_ht
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
322 set $ht = (HashTable*)$arg0
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
323 set $p = $ht->pListHead
324
325 while $p != 0
326 set $i = $ind
327 while $i > 0
328 printf " "
329 set $i = $i - 1
330 end
331
78d11cb @m6w6 - add print_inh (prints a very simple class tree, ie. extensible)
m6w6 authored
332 if $p->nKeyLength > 0
333 ____print_str $p->arKey $p->nKeyLength
334 printf " => "
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
335 else
336 printf "%d => ", $p->h
337 end
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
338
339 if $arg1 == 0
340 printf "%p\n", (void*)$p->pData
341 end
342 if $arg1 == 1
343 set $zval = *(zval **)$p->pData
344 ____printzv $zval 1
345 end
346 if $arg1 == 2
347 printf "%s\n", (char*)$p->pData
348 end
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
349
350 set $p = $p->pListNext
351 end
352 end
353
354 define print_ht
355 set $ind = 1
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
356 printf "[%p] {\n", $arg0
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
357 ____print_ht $arg0 1
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
358 printf "}\n"
359 end
360
361 document print_ht
362 dumps elements of HashTable made of zval
363 end
364
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
365 define print_htptr
366 set $ind = 1
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
367 printf "[%p] {\n", $arg0
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
368 ____print_ht $arg0 0
369 printf "}\n"
370 end
371
372 document print_htptr
373 dumps elements of HashTable made of pointers
374 end
375
376 define print_htstr
377 set $ind = 1
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
378 printf "[%p] {\n", $arg0
a4e3f29 - MFH Add print_htptr, print_htstr
Marcus Boerger authored
379 ____print_ht $arg0 2
380 printf "}\n"
381 end
382
383 document print_htstr
384 dumps elements of HashTable made of strings
385 end
386
6dcb27d - MFH
Marcus Boerger authored
387 define ____print_ft
388 set $ht = $arg0
389 set $p = $ht->pListHead
390
391 while $p != 0
392 set $func = (zend_function*)$p->pData
393
394 set $i = $ind
395 while $i > 0
396 printf " "
397 set $i = $i - 1
398 end
399
78d11cb @m6w6 - add print_inh (prints a very simple class tree, ie. extensible)
m6w6 authored
400 if $p->nKeyLength > 0
401 ____print_str $p->arKey $p->nKeyLength
402 printf " => "
6dcb27d - MFH
Marcus Boerger authored
403 else
404 printf "%d => ", $p->h
405 end
406
407 printf "\"%s\"\n", $func->common.function_name
408 set $p = $p->pListNext
409 end
410 end
411
412 define print_ft
413 set $ind = 1
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
414 printf "[%p] {\n", $arg0
6dcb27d - MFH
Marcus Boerger authored
415 ____print_ft $arg0
416 printf "}\n"
417 end
418
419 document print_ft
420 dumps a function table (HashTable)
421 end
422
55f0daf @m6w6 - treat interfaces and classes gracefully in print_inh
m6w6 authored
423 define ____print_inh_class
424 set $ce = $arg0
425 if $ce->ce_flags & 0x10 || $ce->ce_flags & 0x20
426 printf "abstract "
427 else
428 if $ce->ce_flags & 0x40
429 printf "final "
430 end
431 end
432 printf "class %s", $ce->name
433 if $ce->parent != 0
434 printf " extends %s", $ce->parent->name
435 end
436 if $ce->num_interfaces != 0
437 printf " implements"
438 set $tmp = 0
439 while $tmp < $ce->num_interfaces
440 printf " %s", $ce->interfaces[$tmp]->name
441 set $tmp = $tmp + 1
442 if $tmp < $ce->num_interfaces
443 printf ","
444 end
445 end
446 end
447 set $ce = $ce->parent
448 end
449
450 define ____print_inh_iface
451 set $ce = $arg0
452 printf "interface %s", $ce->name
453 if $ce->num_interfaces != 0
454 set $ce = $ce->interfaces[0]
455 printf " extends %s", $ce->name
456 else
457 set $ce = 0
458 end
459 end
460
78d11cb @m6w6 - add print_inh (prints a very simple class tree, ie. extensible)
m6w6 authored
461 define print_inh
462 set $ce = $arg0
463 set $depth = 0
464 while $ce != 0
465 set $tmp = $depth
466 while $tmp != 0
467 printf " "
468 set $tmp = $tmp - 1
469 end
55f0daf @m6w6 - treat interfaces and classes gracefully in print_inh
m6w6 authored
470 set $depth = $depth + 1
471 if $ce->ce_flags & 0x80
472 ____print_inh_iface $ce
473 else
474 ____print_inh_class $ce
78d11cb @m6w6 - add print_inh (prints a very simple class tree, ie. extensible)
m6w6 authored
475 end
476 printf " {\n"
477 end
478 while $depth != 0
479 set $tmp = $depth
480 while $tmp != 1
481 printf " "
482 set $tmp = $tmp - 1
483 end
484 printf "}\n"
485 set $depth = $depth - 1
486 end
487 end
488
489 define print_pi
490 set $pi = $arg0
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
491 printf "[%p] {\n", $pi
78d11cb @m6w6 - add print_inh (prints a very simple class tree, ie. extensible)
m6w6 authored
492 printf " h = %lu\n", $pi->h
493 printf " flags = %d (", $pi->flags
494 if $pi->flags & 0x100
495 printf "ZEND_ACC_PUBLIC"
496 else
497 if $pi->flags & 0x200
498 printf "ZEND_ACC_PROTECTED"
499 else
500 if $pi->flags & 0x400
501 printf "ZEND_ACC_PRIVATE"
502 else
503 if $pi->flags & 0x800
504 printf "ZEND_ACC_CHANGED"
505 end
506 end
507 end
508 end
509 printf ")\n"
510 printf " name = "
511 ____print_str $pi->name $pi->name_length
512 printf "\n}\n"
513 end
514
515 define ____print_str
516 set $tmp = 0
517 set $str = $arg0
518 printf "\""
519 while $tmp < $arg1
520 if $str[$tmp] > 32 && $str[$tmp] < 127
521 printf "%c", $str[$tmp]
522 else
523 printf "\\%o", $str[$tmp]
524 end
525 set $tmp = $tmp + 1
526 end
527 printf "\""
528 end
529
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
530 define printzn
cfbf35a Support for ZTS
Marcus Boerger authored
531 ____executor_globals
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
532 set $ind = 0
533 set $znode = $arg0
534 if $znode->op_type == 1
535 set $optype = "IS_CONST"
536 end
537 if $znode->op_type == 2
538 set $optype = "IS_TMP_VAR"
539 end
540 if $znode->op_type == 4
541 set $optype = "IS_VAR"
542 end
543 if $znode->op_type == 8
544 set $optype = "IS_UNUSED"
545 end
546
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
547 printf "[%p] %s", $znode, $optype
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
548
549 if $znode->op_type == 1
550 printf ": "
3974225 Fixed printzn part.
Moriyoshi Koizumi authored
551 ____printzv &$znode->u.constant 0
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
552 end
553 if $znode->op_type == 2
554 printf ": "
cfbf35a Support for ZTS
Marcus Boerger authored
555 set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
3974225 Fixed printzn part.
Moriyoshi Koizumi authored
556 ____printzv ((union _temp_variable *)$tvar)->tmp_var 0
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
557 end
558 if $znode->op_type == 4
559 printf ": "
cfbf35a Support for ZTS
Marcus Boerger authored
560 set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var)
3974225 Fixed printzn part.
Moriyoshi Koizumi authored
561 ____printzv *$tvar->var.ptr_ptr 0
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
562 end
563 if $znode->op_type == 8
564 printf "\n"
565 end
566 end
567
568 document printzn
e184a55 Improved readability of zmemcheck output
Moriyoshi Koizumi authored
569 print type and content of znode.
570 usage: printzn &opline->op1
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
571 end
572
573 define printzops
574 printf "op1 => "
575 printzn &execute_data->opline.op1
576 printf "op2 => "
577 printzn &execute_data->opline.op2
578 printf "result => "
579 printzn &execute_data->opline.result
580 end
581
582 document printzops
583 dump operands of the current opline
584 end
585
097bfda - Add "zbacktrace" user-defined command.
Moriyoshi Koizumi authored
586 define zbacktrace
587 ____executor_globals
588 dump_bt $eg.current_execute_data
589 end
590
591 document zbacktrace
592 prints backtrace.
593 This command is almost a short cut for
594 > (gdb) ____executor_globals
595 > (gdb) dump_bt $eg.current_execute_data
596 end
597
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
598 define zmemcheck
599 set $p = alloc_globals.head
600 set $stat = "?"
33fb9a6 Improved zmemcheck macro so it displays the size of each memory block…
Moriyoshi Koizumi authored
601 set $total_size = 0
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
602 if $arg0 != 0
603 set $not_found = 1
604 else
605 set $not_found = 0
606 end
33fb9a6 Improved zmemcheck macro so it displays the size of each memory block…
Moriyoshi Koizumi authored
607 printf " block size status file:line\n"
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
608 printf "-------------------------------------------------------------------------------\n"
609 while $p
610 set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test)
611 if $arg0 == 0 || (void *)$aptr == (void *)$arg0
612 if $p->magic == 0x7312f8dc
613 set $stat = "OK"
614 end
615 if $p->magic == 0x99954317
616 set $stat = "FREED"
617 end
618 if $p->magic == 0xfb8277dc
619 set $stat = "CACHED"
620 end
e184a55 Improved readability of zmemcheck output
Moriyoshi Koizumi authored
621 set $filename = strrchr($p->filename, '/')
622 if !$filename
623 set $filename = $p->filename
624 else
625 set $filename = $filename + 1
626 end
ded11f4 @laruence Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)
laruence authored
627 printf " %p ", $aptr
33fb9a6 Improved zmemcheck macro so it displays the size of each memory block…
Moriyoshi Koizumi authored
628 if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10
629 printf "ZVAL?(%-2d) ", $p->size
630 else
631 printf "%-9d ", $p->size
632 end
633 set $total_size = $total_size + $p->size
634 printf "%-06s %s:%d", $stat, $filename, $p->lineno
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
635 if $p->orig_filename
e184a55 Improved readability of zmemcheck output
Moriyoshi Koizumi authored
636 set $orig_filename = strrchr($p->orig_filename, '/')
637 if !$orig_filename
638 set $orig_filename = $p->orig_filename
639 else
640 set $orig_filename = $orig_filename + 1
641 end
642 printf " <= %s:%d\n", $orig_filename, $p->orig_lineno
643 else
644 printf "\n"
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
645 end
646 if $arg0 != 0
647 set $p = 0
648 set $not_found = 0
649 else
650 set $p = $p->pNext
651 end
652 else
653 set $p = $p->pNext
654 end
655 end
656 if $not_found
613674c @reeze Implemented FR #63188 (Display class name when debugging with gdb mac…
reeze authored
657 printf "no such block that begins at %p.\n", $aptr
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
658 end
33fb9a6 Improved zmemcheck macro so it displays the size of each memory block…
Moriyoshi Koizumi authored
659 if $arg0 == 0
660 printf "-------------------------------------------------------------------------------\n"
661 printf " total: %d bytes\n", $total_size
662 end
80bfd18 Added zmemcheck macro, which may help you examine the memory blocks b…
Moriyoshi Koizumi authored
663 end
664
665 document zmemcheck
e184a55 Improved readability of zmemcheck output
Moriyoshi Koizumi authored
666 show status of a memory block.
667 usage: zmemcheck [ptr].
668 if ptr is 0, all blocks will be listed.
6e3faef Added various gdb macros to examine zval, znode, and HashTable
Moriyoshi Koizumi authored
669 end
Something went wrong with that request. Please try again.