|
|
| version 1.1, 2012/02/21 23:47:51 | version 1.1.1.3, 2013/07/22 01:31:35 |
|---|---|
| Line 1 | Line 1 |
| define set_ts | |
| set $tsrm_ls = $arg0 | |
| end | |
| document set_ts | |
| set the ts resource, it is impossible for gdb to | |
| call ts_resource_ex while no process is running, | |
| but we could get the resource from the argument | |
| of frame info. | |
| end | |
| define ____executor_globals | define ____executor_globals |
| if basic_functions_module.zts | if basic_functions_module.zts |
| set $tsrm_ls = ts_resource_ex(0, 0) | if !$tsrm_ls |
| set $eg = ((zend_executor_globals) (*((void ***) $tsrm_ls))[executor_globals_id-1]) | set $tsrm_ls = ts_resource_ex(0, 0) |
| set $cg = ((zend_compiler_globals) (*((void ***) $tsrm_ls))[compiler_globals_id-1]) | end |
| set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1]) | |
| set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1]) | |
| else | else |
| set $eg = executor_globals | set $eg = executor_globals |
| set $cg = compiler_globals | set $cg = compiler_globals |
| Line 37 end | Line 50 end |
| define dump_bt | define dump_bt |
| set $t = $arg0 | set $t = $arg0 |
| while $t | while $t |
| printf "[0x%08x] ", $t | printf "[%p] ", $t |
| if $t->function_state.function->common.function_name | set $fst = $t->function_state |
| printf "%s() ", $t->function_state.function->common.function_name | if $fst.function->common.function_name |
| if $fst.arguments | |
| set $count = (int)*($fst.arguments) | |
| if $t->object | |
| if $fst.function.common.scope | |
| printf "%s->", $fst.function.common.scope->name | |
| else | |
| if !$eg | |
| ____executor_globals | |
| end | |
| set $known_class = 0 | |
| if $eg | |
| set $handle = $t->object.value.obj.handle | |
| set $handlers = $t->object.value.obj.handlers | |
| set $zobj = (zend_object *)$eg.objects_store.object_buckets[$handle].bucket.obj.object | |
| if $handlers->get_class_entry == &zend_std_object_get_class | |
| set $known_class = 1 | |
| if $handlers.get_class_name | |
| if $handlers.get_class_name != &zend_std_object_get_class_name | |
| set $known_class = 0 | |
| end | |
| end | |
| if $known_class | |
| printf "%s->", $zobj->ce.name | |
| end | |
| end | |
| end | |
| if !$known_class | |
| printf "(Unknown)->" | |
| end | |
| end | |
| else | |
| if $fst.function.common.scope | |
| printf "%s::", $fst.function.common.scope->name | |
| end | |
| end | |
| printf "%s(", $fst.function->common.function_name | |
| while $count > 0 | |
| set $zvalue = *(zval **)($fst.arguments - $count) | |
| set $type = $zvalue->type | |
| if $type == 0 | |
| printf "NULL" | |
| end | |
| if $type == 1 | |
| printf "%ld", $zvalue->value.lval | |
| end | |
| if $type == 2 | |
| printf "%lf", $zvalue->value.dval | |
| end | |
| if $type == 3 | |
| if $zvalue->value.lval | |
| printf "true" | |
| else | |
| printf "false" | |
| end | |
| end | |
| if $type == 4 | |
| printf "array(%d)[%p]", $zvalue->value.ht->nNumOfElements, $zvalue | |
| end | |
| if $type == 5 | |
| printf "object[%p]", $zvalue | |
| end | |
| if $type == 6 | |
| ____print_str $zvalue->value.str.val $zvalue->value.str.len | |
| end | |
| if $type == 7 | |
| printf "resource(#%d)", $zvalue->value.lval | |
| end | |
| if $type == 8 | |
| printf "constant" | |
| end | |
| if $type == 9 | |
| printf "const_array" | |
| end | |
| if $type > 9 | |
| printf "unknown type %d", $type | |
| end | |
| set $count = $count -1 | |
| if $count > 0 | |
| printf ", " | |
| end | |
| end | |
| printf ") " | |
| else | |
| printf "%s() ", $fst.function->common.function_name | |
| end | |
| else | else |
| printf "??? " | printf "??? " |
| end | end |
| Line 167 define ____printzv | Line 272 define ____printzv |
| ____executor_globals | ____executor_globals |
| set $zvalue = $arg0 | set $zvalue = $arg0 |
| printf "[0x%08x] ", $zvalue | printf "[%p] ", $zvalue |
| if $zvalue == $eg.uninitialized_zval_ptr | if $zvalue == $eg.uninitialized_zval_ptr |
| printf "*uninitialized* " | printf "*uninitialized* " |
| Line 208 end | Line 313 end |
| define print_const_table | define print_const_table |
| set $ind = 1 | set $ind = 1 |
| printf "[0x%08x] {\n", $arg0 | printf "[%p] {\n", $arg0 |
| ____print_const_table $arg0 | ____print_const_table $arg0 |
| printf "}\n" | printf "}\n" |
| end | end |
| Line 248 end | Line 353 end |
| define print_ht | define print_ht |
| set $ind = 1 | set $ind = 1 |
| printf "[0x%08x] {\n", $arg0 | printf "[%p] {\n", $arg0 |
| ____print_ht $arg0 1 | ____print_ht $arg0 1 |
| printf "}\n" | printf "}\n" |
| end | end |
| Line 259 end | Line 364 end |
| define print_htptr | define print_htptr |
| set $ind = 1 | set $ind = 1 |
| printf "[0x%08x] {\n", $arg0 | printf "[%p] {\n", $arg0 |
| ____print_ht $arg0 0 | ____print_ht $arg0 0 |
| printf "}\n" | printf "}\n" |
| end | end |
| Line 270 end | Line 375 end |
| define print_htstr | define print_htstr |
| set $ind = 1 | set $ind = 1 |
| printf "[0x%08x] {\n", $arg0 | printf "[%p] {\n", $arg0 |
| ____print_ht $arg0 2 | ____print_ht $arg0 2 |
| printf "}\n" | printf "}\n" |
| end | end |
| Line 306 end | Line 411 end |
| define print_ft | define print_ft |
| set $ind = 1 | set $ind = 1 |
| printf "[0x%08x] {\n", $arg0 | printf "[%p] {\n", $arg0 |
| ____print_ft $arg0 | ____print_ft $arg0 |
| printf "}\n" | printf "}\n" |
| end | end |
| Line 383 end | Line 488 end |
| define print_pi | define print_pi |
| set $pi = $arg0 | set $pi = $arg0 |
| printf "[0x%08x] {\n", $pi | printf "[%p] {\n", $pi |
| printf " h = %lu\n", $pi->h | printf " h = %lu\n", $pi->h |
| printf " flags = %d (", $pi->flags | printf " flags = %d (", $pi->flags |
| if $pi->flags & 0x100 | if $pi->flags & 0x100 |
| Line 439 define printzn | Line 544 define printzn |
| set $optype = "IS_UNUSED" | set $optype = "IS_UNUSED" |
| end | end |
| printf "[0x%08x] %s", $znode, $optype | printf "[%p] %s", $znode, $optype |
| if $znode->op_type == 1 | if $znode->op_type == 1 |
| printf ": " | printf ": " |
| Line 519 define zmemcheck | Line 624 define zmemcheck |
| else | else |
| set $filename = $filename + 1 | set $filename = $filename + 1 |
| end | end |
| printf " 0x%08x ", $aptr | printf " %p ", $aptr |
| if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10 | if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10 |
| printf "ZVAL?(%-2d) ", $p->size | printf "ZVAL?(%-2d) ", $p->size |
| else | else |
| Line 549 define zmemcheck | Line 654 define zmemcheck |
| end | end |
| end | end |
| if $not_found | if $not_found |
| printf "no such block that begins at 0x%08x.\n", $aptr | printf "no such block that begins at %p.\n", $aptr |
| end | end |
| if $arg0 == 0 | if $arg0 == 0 |
| printf "-------------------------------------------------------------------------------\n" | printf "-------------------------------------------------------------------------------\n" |