laruence                                 Tue, 06 Dec 2011 12:32:59 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=320496

Log:
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

Changed paths:
    U   php/php-src/branches/PHP_5_4/.gdbinit
    U   php/php-src/trunk/.gdbinit

Modified: php/php-src/branches/PHP_5_4/.gdbinit
===================================================================
--- php/php-src/branches/PHP_5_4/.gdbinit	2011-12-06 12:31:14 UTC (rev 320495)
+++ php/php-src/branches/PHP_5_4/.gdbinit	2011-12-06 12:32:59 UTC (rev 320496)
@@ -37,61 +37,57 @@
 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"
+			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
-						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 ", "
-						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 @@
 	____executor_globals
 	set $zvalue = $arg0

-	printf "[0x%08x] ", $zvalue
+	printf "[%p] ", $zvalue

 	if $zvalue == $eg.uninitialized_zval_ptr
 		printf "*uninitialized* "
@@ -263,7 +259,7 @@

 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 @@

 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 @@

 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 @@

 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 @@

 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 @@

 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 @@
 		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 @@

 define zbacktrace
 	____executor_globals
-	set $__plain = 1
 	dump_bt $eg.current_execute_data
 end

@@ -546,21 +541,6 @@
 	> (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 @@
 			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 @@
 		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"

Modified: php/php-src/trunk/.gdbinit
===================================================================
--- php/php-src/trunk/.gdbinit	2011-12-06 12:31:14 UTC (rev 320495)
+++ php/php-src/trunk/.gdbinit	2011-12-06 12:32:59 UTC (rev 320496)
@@ -37,61 +37,57 @@
 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"
+			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
-						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 ", "
-						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 @@
 	____executor_globals
 	set $zvalue = $arg0

-	printf "[0x%08x] ", $zvalue
+	printf "[%p] ", $zvalue

 	if $zvalue == $eg.uninitialized_zval_ptr
 		printf "*uninitialized* "
@@ -263,7 +259,7 @@

 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 @@

 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 @@

 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 @@

 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 @@

 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 @@

 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 @@
 		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 @@

 define zbacktrace
 	____executor_globals
-	set $__plain = 1
 	dump_bt $eg.current_execute_data
 end

@@ -546,21 +541,6 @@
 	> (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 @@
 			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 @@
 		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"
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to