Index: trunk/debs/php5/.gdbinit |
— | — | @@ -1,508 +0,0 @@ |
2 | | -define ____executor_globals |
3 | | - if basic_functions_module.zts |
4 | | - set $tsrm_ls = ts_resource_ex(0, 0) |
5 | | - set $eg = ((zend_executor_globals) (*((void ***) $tsrm_ls))[executor_globals_id-1]) |
6 | | - else |
7 | | - set $eg = executor_globals |
8 | | - end |
9 | | -end |
10 | | - |
11 | | -document ____executor_globals |
12 | | - portable way of accessing executor_globals |
13 | | - ZTS detection is automatically based on ext/standard module struct |
14 | | -end |
15 | | - |
16 | | -define dump_bt |
17 | | - set $t = $arg0 |
18 | | - while $t |
19 | | - printf "[0x%08x] ", $t |
20 | | - if $t->function_state.function->common.function_name |
21 | | - printf "%s() ", $t->function_state.function->common.function_name |
22 | | - else |
23 | | - printf "??? " |
24 | | - end |
25 | | - if $t->op_array != 0 |
26 | | - printf "%s:%d ", $t->op_array->filename, $t->opline->lineno |
27 | | - end |
28 | | - set $t = $t->prev_execute_data |
29 | | - printf "\n" |
30 | | - end |
31 | | -end |
32 | | - |
33 | | -document dump_bt |
34 | | - dumps the current execution stack. usage: dump_bt executor_globals.current_execute_data |
35 | | -end |
36 | | - |
37 | | -define printzv |
38 | | - set $ind = 1 |
39 | | - ____printzv $arg0 0 |
40 | | -end |
41 | | - |
42 | | -document printzv |
43 | | - prints content of zval |
44 | | -end |
45 | | - |
46 | | -define ____printzv_contents |
47 | | - set $zvalue = $arg0 |
48 | | - set $type = $zvalue->type |
49 | | - |
50 | | - printf "(refcount=%d) ", $zvalue->refcount |
51 | | - if $type == 0 |
52 | | - printf "NULL" |
53 | | - end |
54 | | - if $type == 1 |
55 | | - printf "long: %ld", $zvalue->value.lval |
56 | | - end |
57 | | - if $type == 2 |
58 | | - printf "double: %lf", $zvalue->value.dval |
59 | | - end |
60 | | - if $type == 3 |
61 | | - printf "bool: " |
62 | | - if $zvalue->value.lval |
63 | | - printf "true" |
64 | | - else |
65 | | - printf "false" |
66 | | - end |
67 | | - end |
68 | | - if $type == 4 |
69 | | - printf "array(%d): ", $zvalue->value.ht->nNumOfElements |
70 | | - if ! $arg1 |
71 | | - printf "{\n" |
72 | | - set $ind = $ind + 1 |
73 | | - ____print_ht $zvalue->value.ht |
74 | | - set $ind = $ind - 1 |
75 | | - set $i = $ind |
76 | | - while $i > 0 |
77 | | - printf " " |
78 | | - set $i = $i - 1 |
79 | | - end |
80 | | - printf "}" |
81 | | - end |
82 | | - set $type = 0 |
83 | | - end |
84 | | - if $type == 5 |
85 | | - printf "object" |
86 | | - ____executor_globals |
87 | | - set $handle = $zvalue->value.obj.handle |
88 | | - set $handlers = $zvalue->value.obj.handlers |
89 | | - if basic_functions_module.zts |
90 | | - set $zobj = zend_objects_get_address($zvalue, $tsrm_ls) |
91 | | - else |
92 | | - set $zobj = zend_objects_get_address($zvalue) |
93 | | - end |
94 | | - if $handlers->get_class_entry == &zend_std_object_get_class |
95 | | - set $cname = $zobj->ce.name |
96 | | - else |
97 | | - set $cname = "Unknown" |
98 | | - end |
99 | | - printf "(%s) #%d", $cname, $handle |
100 | | - if ! $arg1 |
101 | | - if $handlers->get_properties == &zend_std_get_properties |
102 | | - set $ht = $zobj->properties |
103 | | - if $ht |
104 | | - printf "(%d): ", $ht->nNumOfElements |
105 | | - printf "{\n" |
106 | | - set $ind = $ind + 1 |
107 | | - ____print_ht $ht |
108 | | - set $ind = $ind - 1 |
109 | | - set $i = $ind |
110 | | - while $i > 0 |
111 | | - printf " " |
112 | | - set $i = $i - 1 |
113 | | - end |
114 | | - printf "}" |
115 | | - else |
116 | | - echo "no properties found" |
117 | | - end |
118 | | - end |
119 | | - end |
120 | | - set $type = 0 |
121 | | - end |
122 | | - if $type == 6 |
123 | | - printf "string(%d): ", $zvalue->value.str.len |
124 | | - ____print_str $zvalue->value.str.val $zvalue->value.str.len |
125 | | - end |
126 | | - if $type == 7 |
127 | | - printf "resource: #%d", $zvalue->value.lval |
128 | | - end |
129 | | - if $type == 8 |
130 | | - printf "constant" |
131 | | - end |
132 | | - if $type == 9 |
133 | | - printf "const_array" |
134 | | - end |
135 | | - if $type > 9 |
136 | | - printf "unknown type %d", $type |
137 | | - end |
138 | | - printf "\n" |
139 | | -end |
140 | | - |
141 | | -define ____printzv |
142 | | - ____executor_globals |
143 | | - set $zvalue = $arg0 |
144 | | - |
145 | | - printf "[0x%08x] ", $zvalue |
146 | | - |
147 | | - if $zvalue == $eg.uninitialized_zval_ptr |
148 | | - printf "*uninitialized* " |
149 | | - end |
150 | | - |
151 | | - set $zcontents = (zval*) $zvalue |
152 | | - if $arg1 |
153 | | - ____printzv_contents $zcontents $arg1 |
154 | | - else |
155 | | - ____printzv_contents $zcontents 0 |
156 | | - end |
157 | | -end |
158 | | - |
159 | | -define ____print_const_table |
160 | | - set $ht = $arg0 |
161 | | - set $p = $ht->pListHead |
162 | | - |
163 | | - while $p != 0 |
164 | | - set $const = (zend_constant *) $p->pData |
165 | | - |
166 | | - set $i = $ind |
167 | | - while $i > 0 |
168 | | - printf " " |
169 | | - set $i = $i - 1 |
170 | | - end |
171 | | - |
172 | | - if $p->nKeyLength > 0 |
173 | | - ____print_str $p->arKey $p->nKeyLength |
174 | | - printf " => " |
175 | | - else |
176 | | - printf "%d => ", $p->h |
177 | | - end |
178 | | - |
179 | | - ____printzv_contents &$const->value 0 |
180 | | - set $p = $p->pListNext |
181 | | - end |
182 | | -end |
183 | | - |
184 | | -define print_const_table |
185 | | - set $ind = 1 |
186 | | - printf "[0x%08x] {\n", $arg0 |
187 | | - ____print_const_table $arg0 |
188 | | - printf "}\n" |
189 | | -end |
190 | | - |
191 | | -define ____print_ht |
192 | | - set $ht = $arg0 |
193 | | - set $p = $ht->pListHead |
194 | | - |
195 | | - while $p != 0 |
196 | | - set $zval = *(zval **)$p->pData |
197 | | - |
198 | | - set $i = $ind |
199 | | - while $i > 0 |
200 | | - printf " " |
201 | | - set $i = $i - 1 |
202 | | - end |
203 | | - |
204 | | - if $p->nKeyLength > 0 |
205 | | - ____print_str $p->arKey $p->nKeyLength |
206 | | - printf " => " |
207 | | - else |
208 | | - printf "%d => ", $p->h |
209 | | - end |
210 | | - |
211 | | - ____printzv $zval 1 |
212 | | - set $p = $p->pListNext |
213 | | - end |
214 | | -end |
215 | | - |
216 | | -define print_ht |
217 | | - set $ind = 1 |
218 | | - printf "[0x%08x] {\n", $arg0 |
219 | | - ____print_ht $arg0 |
220 | | - printf "}\n" |
221 | | -end |
222 | | - |
223 | | -document print_ht |
224 | | - dumps elements of HashTable made of zval |
225 | | -end |
226 | | - |
227 | | -define ____print_ft |
228 | | - set $ht = $arg0 |
229 | | - set $p = $ht->pListHead |
230 | | - |
231 | | - while $p != 0 |
232 | | - set $func = (zend_function*)$p->pData |
233 | | - |
234 | | - set $i = $ind |
235 | | - while $i > 0 |
236 | | - printf " " |
237 | | - set $i = $i - 1 |
238 | | - end |
239 | | - |
240 | | - if $p->nKeyLength > 0 |
241 | | - ____print_str $p->arKey $p->nKeyLength |
242 | | - printf " => " |
243 | | - else |
244 | | - printf "%d => ", $p->h |
245 | | - end |
246 | | - |
247 | | - printf "\"%s\"\n", $func->common.function_name |
248 | | - set $p = $p->pListNext |
249 | | - end |
250 | | -end |
251 | | - |
252 | | -define print_ft |
253 | | - set $ind = 1 |
254 | | - printf "[0x%08x] {\n", $arg0 |
255 | | - ____print_ft $arg0 |
256 | | - printf "}\n" |
257 | | -end |
258 | | - |
259 | | -document print_ft |
260 | | - dumps a function table (HashTable) |
261 | | -end |
262 | | - |
263 | | -define ____print_inh_class |
264 | | - set $ce = $arg0 |
265 | | - if $ce->ce_flags & 0x10 || $ce->ce_flags & 0x20 |
266 | | - printf "abstract " |
267 | | - else |
268 | | - if $ce->ce_flags & 0x40 |
269 | | - printf "final " |
270 | | - end |
271 | | - end |
272 | | - printf "class %s", $ce->name |
273 | | - if $ce->parent != 0 |
274 | | - printf " extends %s", $ce->parent->name |
275 | | - end |
276 | | - if $ce->num_interfaces != 0 |
277 | | - printf " implements" |
278 | | - set $tmp = 0 |
279 | | - while $tmp < $ce->num_interfaces |
280 | | - printf " %s", $ce->interfaces[$tmp]->name |
281 | | - set $tmp = $tmp + 1 |
282 | | - if $tmp < $ce->num_interfaces |
283 | | - printf "," |
284 | | - end |
285 | | - end |
286 | | - end |
287 | | - set $ce = $ce->parent |
288 | | -end |
289 | | - |
290 | | -define ____print_inh_iface |
291 | | - set $ce = $arg0 |
292 | | - printf "interface %s", $ce->name |
293 | | - if $ce->num_interfaces != 0 |
294 | | - set $ce = $ce->interfaces[0] |
295 | | - printf " extends %s", $ce->name |
296 | | - else |
297 | | - set $ce = 0 |
298 | | - end |
299 | | -end |
300 | | - |
301 | | -define print_inh |
302 | | - set $ce = $arg0 |
303 | | - set $depth = 0 |
304 | | - while $ce != 0 |
305 | | - set $tmp = $depth |
306 | | - while $tmp != 0 |
307 | | - printf " " |
308 | | - set $tmp = $tmp - 1 |
309 | | - end |
310 | | - set $depth = $depth + 1 |
311 | | - if $ce->ce_flags & 0x80 |
312 | | - ____print_inh_iface $ce |
313 | | - else |
314 | | - ____print_inh_class $ce |
315 | | - end |
316 | | - printf " {\n" |
317 | | - end |
318 | | - while $depth != 0 |
319 | | - set $tmp = $depth |
320 | | - while $tmp != 1 |
321 | | - printf " " |
322 | | - set $tmp = $tmp - 1 |
323 | | - end |
324 | | - printf "}\n" |
325 | | - set $depth = $depth - 1 |
326 | | - end |
327 | | -end |
328 | | - |
329 | | -define print_pi |
330 | | - set $pi = $arg0 |
331 | | - printf "[0x%08x] {\n", $pi |
332 | | - printf " h = %lu\n", $pi->h |
333 | | - printf " flags = %d (", $pi->flags |
334 | | - if $pi->flags & 0x100 |
335 | | - printf "ZEND_ACC_PUBLIC" |
336 | | - else |
337 | | - if $pi->flags & 0x200 |
338 | | - printf "ZEND_ACC_PROTECTED" |
339 | | - else |
340 | | - if $pi->flags & 0x400 |
341 | | - printf "ZEND_ACC_PRIVATE" |
342 | | - else |
343 | | - if $pi->flags & 0x800 |
344 | | - printf "ZEND_ACC_CHANGED" |
345 | | - end |
346 | | - end |
347 | | - end |
348 | | - end |
349 | | - printf ")\n" |
350 | | - printf " name = " |
351 | | - ____print_str $pi->name $pi->name_length |
352 | | - printf "\n}\n" |
353 | | -end |
354 | | - |
355 | | -define ____print_str |
356 | | - set $tmp = 0 |
357 | | - set $str = $arg0 |
358 | | - printf "\"" |
359 | | - while $tmp < $arg1 |
360 | | - if $str[$tmp] > 32 && $str[$tmp] < 127 |
361 | | - printf "%c", $str[$tmp] |
362 | | - else |
363 | | - printf "\\%o", $str[$tmp] |
364 | | - end |
365 | | - set $tmp = $tmp + 1 |
366 | | - end |
367 | | - printf "\"" |
368 | | -end |
369 | | - |
370 | | -define printzn |
371 | | - ____executor_globals |
372 | | - set $ind = 0 |
373 | | - set $znode = $arg0 |
374 | | - if $znode->op_type == 1 |
375 | | - set $optype = "IS_CONST" |
376 | | - end |
377 | | - if $znode->op_type == 2 |
378 | | - set $optype = "IS_TMP_VAR" |
379 | | - end |
380 | | - if $znode->op_type == 4 |
381 | | - set $optype = "IS_VAR" |
382 | | - end |
383 | | - if $znode->op_type == 8 |
384 | | - set $optype = "IS_UNUSED" |
385 | | - end |
386 | | - |
387 | | - printf "[0x%08x] %s", $znode, $optype |
388 | | - |
389 | | - if $znode->op_type == 1 |
390 | | - printf ": " |
391 | | - ____printzv &$znode->u.constant 0 |
392 | | - end |
393 | | - if $znode->op_type == 2 |
394 | | - printf ": " |
395 | | - set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var) |
396 | | - ____printzv ((union _temp_variable *)$tvar)->tmp_var 0 |
397 | | - end |
398 | | - if $znode->op_type == 4 |
399 | | - printf ": " |
400 | | - set $tvar = (union _temp_variable *)((char *)$eg.current_execute_data->Ts + $znode->u.var) |
401 | | - ____printzv *$tvar->var.ptr_ptr 0 |
402 | | - end |
403 | | - if $znode->op_type == 8 |
404 | | - printf "\n" |
405 | | - end |
406 | | -end |
407 | | - |
408 | | -document printzn |
409 | | - print type and content of znode. |
410 | | - usage: printzn &opline->op1 |
411 | | -end |
412 | | - |
413 | | -define printzops |
414 | | - printf "op1 => " |
415 | | - printzn &execute_data->opline.op1 |
416 | | - printf "op2 => " |
417 | | - printzn &execute_data->opline.op2 |
418 | | - printf "result => " |
419 | | - printzn &execute_data->opline.result |
420 | | -end |
421 | | - |
422 | | -document printzops |
423 | | - dump operands of the current opline |
424 | | -end |
425 | | - |
426 | | -define zbacktrace |
427 | | - ____executor_globals |
428 | | - dump_bt $eg.current_execute_data |
429 | | -end |
430 | | - |
431 | | -document zbacktrace |
432 | | - prints backtrace. |
433 | | - This command is almost a short cut for |
434 | | - > (gdb) ____executor_globals |
435 | | - > (gdb) dump_bt $eg.current_execute_data |
436 | | -end |
437 | | - |
438 | | -define zmemcheck |
439 | | - set $p = alloc_globals.head |
440 | | - set $stat = "?" |
441 | | - set $total_size = 0 |
442 | | - if $arg0 != 0 |
443 | | - set $not_found = 1 |
444 | | - else |
445 | | - set $not_found = 0 |
446 | | - end |
447 | | - printf " block size status file:line\n" |
448 | | - printf "-------------------------------------------------------------------------------\n" |
449 | | - while $p |
450 | | - set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test) |
451 | | - if $arg0 == 0 || (void *)$aptr == (void *)$arg0 |
452 | | - if $p->magic == 0x7312f8dc |
453 | | - set $stat = "OK" |
454 | | - end |
455 | | - if $p->magic == 0x99954317 |
456 | | - set $stat = "FREED" |
457 | | - end |
458 | | - if $p->magic == 0xfb8277dc |
459 | | - set $stat = "CACHED" |
460 | | - end |
461 | | - set $filename = strrchr($p->filename, '/') |
462 | | - if !$filename |
463 | | - set $filename = $p->filename |
464 | | - else |
465 | | - set $filename = $filename + 1 |
466 | | - end |
467 | | - printf " 0x%08x ", $aptr |
468 | | - if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10 |
469 | | - printf "ZVAL?(%-2d) ", $p->size |
470 | | - else |
471 | | - printf "%-9d ", $p->size |
472 | | - end |
473 | | - set $total_size = $total_size + $p->size |
474 | | - printf "%-06s %s:%d", $stat, $filename, $p->lineno |
475 | | - if $p->orig_filename |
476 | | - set $orig_filename = strrchr($p->orig_filename, '/') |
477 | | - if !$orig_filename |
478 | | - set $orig_filename = $p->orig_filename |
479 | | - else |
480 | | - set $orig_filename = $orig_filename + 1 |
481 | | - end |
482 | | - printf " <= %s:%d\n", $orig_filename, $p->orig_lineno |
483 | | - else |
484 | | - printf "\n" |
485 | | - end |
486 | | - if $arg0 != 0 |
487 | | - set $p = 0 |
488 | | - set $not_found = 0 |
489 | | - else |
490 | | - set $p = $p->pNext |
491 | | - end |
492 | | - else |
493 | | - set $p = $p->pNext |
494 | | - end |
495 | | - end |
496 | | - if $not_found |
497 | | - printf "no such block that begins at 0x%08x.\n", $aptr |
498 | | - end |
499 | | - if $arg0 == 0 |
500 | | - printf "-------------------------------------------------------------------------------\n" |
501 | | - printf " total: %d bytes\n", $total_size |
502 | | - end |
503 | | -end |
504 | | - |
505 | | -document zmemcheck |
506 | | - show status of a memory block. |
507 | | - usage: zmemcheck [ptr]. |
508 | | - if ptr is 0, all blocks will be listed. |
509 | | -end |