Commit:    613674c7a2789afb77e2ff7044b2f67578013966
Author:    Reeze Xia <re...@php.net>         Sun, 30 Sep 2012 03:16:26 +0800
Parents:   36c10242cd3babee807178def14485bd4b13bbc6
Branches:  PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=613674c7a2789afb77e2ff7044b2f67578013966

Log:
Implemented FR #63188 (Display class name when debugging with gdb macro 
zbacktrace)

Bugs:
https://bugs.php.net/63188

Changed paths:
  M  .gdbinit


Diff:
diff --git a/.gdbinit b/.gdbinit
index 4a26d96..0bff417 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -38,12 +38,41 @@ define dump_bt
        set $t = $arg0
        while $t
                printf "[%p] ", $t
-               if $t->function_state.function->common.function_name
-                       if $t->function_state.arguments
-                               set $count = 
(int)*($t->function_state.arguments)
-                               printf "%s(", 
$t->function_state.function->common.function_name
+               set $fst = $t->function_state
+               if $fst.function->common.function_name
+                       if $fst.arguments
+                               set $count = (int)*($fst.arguments)
+
+                               if $t->object
+                                       if $fst.function.common.scope->name
+                                               printf "%s->", 
$fst.function.common.scope->name
+                                       else
+                                               set $class_name_ptr = (char 
**)malloc(sizeof(char **))
+                                               set $class_name_len = (int 
*)malloc(sizeof(int *))
+
+                                               if basic_functions_module.zts
+                                                       set $dup = 
zend_get_object_classname($t->object, $class_name_ptr, $class_name_len, 
$tsrm_ls)
+                                               else
+                                                       set $dup = 
zend_get_object_classname($t->object, $class_name_ptr, $class_name_len)
+                                               end
+
+                                               printf "%s->", *$class_name_ptr
+
+                                               if !$dup
+                                                       call 
_efree(*$class_name_ptr, "[GDB]", 0, "", 0)
+                                               end
+                                               call (void) 
free($class_name_ptr)
+                                               call (void) 
free($class_name_len)
+                                       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 
**)($t->function_state.arguments - $count)
+                                       set $zvalue = *(zval **)($fst.arguments 
- $count)
                                        set $type = $zvalue->type
                                        if $type == 0
                                                printf "NULL"
@@ -73,7 +102,7 @@ define dump_bt
                                        if $type == 7
                                                printf "resource(#%d)", 
$zvalue->value.lval
                                        end
-                                       if $type == 8 
+                                       if $type == 8
                                                printf "constant"
                                        end
                                        if $type == 9
@@ -89,7 +118,7 @@ define dump_bt
                                end
                                printf ") "
                        else
-                               printf "%s() ", 
$t->function_state.function->common.function_name
+                               printf "%s() ", 
$fst.function->common.function_name
                        end
                else
                        printf "??? "
@@ -600,7 +629,7 @@ define zmemcheck
                end
        end
        if $not_found
-               printf "no such block that begins at %p.\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