Permalink
Browse files

Use zbacktrace_ex instead of zbacktrace(actullay is dump_bt)

Use %p instead of "0x08x" (IMO this is used for print pointer, which, unfortunately, don't work under x64)
If there is any wrong, plz revert this, thanks
  • Loading branch information...
1 parent c6d7204 commit ded11f4258a9569e914dde5cfe03f2c8e048cb49 @laruence laruence committed Dec 6, 2011
Showing with 57 additions and 77 deletions.
  1. +57 −77 .gdbinit
View
134 .gdbinit
@@ -37,61 +37,57 @@ end
define dump_bt
set $t = $arg0
while $t
- printf "[0x%08x] ", $t
+ printf "[%p] ", $t
if $t->function_state.function->common.function_name
- if !$__plain
- if $t->function_state.arguments
- set $count = (int)*($t->function_state.arguments)
- printf "%s(", $t->function_state.function->common.function_name
- while $count > 0
- set $zvalue = *(zval **)($t->function_state.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)[0x%08x]", $zvalue->value.ht->nNumOfElements, $zvalue
- end
- if $type == 5
- printf "object[0x%08x]", $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 ", "
+ if $t->function_state.arguments
+ set $count = (int)*($t->function_state.arguments)
+ printf "%s(", $t->function_state.function->common.function_name
+ while $count > 0
+ set $zvalue = *(zval **)($t->function_state.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
- printf ") "
- else
- printf "%s() ", $t->function_state.function->common.function_name
+ 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() ", $t->function_state.function->common.function_name
end
@@ -222,7 +218,7 @@ define ____printzv
____executor_globals
set $zvalue = $arg0
- printf "[0x%08x] ", $zvalue
+ printf "[%p] ", $zvalue
if $zvalue == $eg.uninitialized_zval_ptr
printf "*uninitialized* "
@@ -263,7 +259,7 @@ end
define print_const_table
set $ind = 1
- printf "[0x%08x] {\n", $arg0
+ printf "[%p] {\n", $arg0
____print_const_table $arg0
printf "}\n"
end
@@ -303,7 +299,7 @@ end
define print_ht
set $ind = 1
- printf "[0x%08x] {\n", $arg0
+ printf "[%p] {\n", $arg0
____print_ht $arg0 1
printf "}\n"
end
@@ -314,7 +310,7 @@ end
define print_htptr
set $ind = 1
- printf "[0x%08x] {\n", $arg0
+ printf "[%p] {\n", $arg0
____print_ht $arg0 0
printf "}\n"
end
@@ -325,7 +321,7 @@ end
define print_htstr
set $ind = 1
- printf "[0x%08x] {\n", $arg0
+ printf "[%p] {\n", $arg0
____print_ht $arg0 2
printf "}\n"
end
@@ -361,7 +357,7 @@ end
define print_ft
set $ind = 1
- printf "[0x%08x] {\n", $arg0
+ printf "[%p] {\n", $arg0
____print_ft $arg0
printf "}\n"
end
@@ -438,7 +434,7 @@ end
define print_pi
set $pi = $arg0
- printf "[0x%08x] {\n", $pi
+ printf "[%p] {\n", $pi
printf " h = %lu\n", $pi->h
printf " flags = %d (", $pi->flags
if $pi->flags & 0x100
@@ -494,7 +490,7 @@ define printzn
set $optype = "IS_UNUSED"
end
- printf "[0x%08x] %s", $znode, $optype
+ printf "[%p] %s", $znode, $optype
if $znode->op_type == 1
printf ": "
@@ -535,7 +531,6 @@ end
define zbacktrace
____executor_globals
- set $__plain = 1
dump_bt $eg.current_execute_data
end
@@ -546,21 +541,6 @@ document zbacktrace
> (gdb) dump_bt $eg.current_execute_data
end
-define zbacktrace_ex
- ____executor_globals
- set $__plain = 0
- dump_bt $eg.current_execute_data
- set $__plain = 1
-end
-
-document zbacktrace_ex
- prints backtrace with arguments info
- This command is almost a short cut for
- > set $__plain = 0
- > (gdb) ____executor_globals
- > (gdb) dump_bt $eg.current_execute_data
-end
-
define zmemcheck
set $p = alloc_globals.head
set $stat = "?"
@@ -590,7 +570,7 @@ define zmemcheck
else
set $filename = $filename + 1
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
printf "ZVAL?(%-2d) ", $p->size
else
@@ -620,7 +600,7 @@ define zmemcheck
end
end
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
if $arg0 == 0
printf "-------------------------------------------------------------------------------\n"

0 comments on commit ded11f4

Please sign in to comment.