Skip to content

Commit c95fd5f

Browse files
committed
Merge branch 'pull-request/209' into PHP-5.4
* pull-request/209: Eliminate process running requirement of dump_bt in .gdbinit Add missing ____executor_globals in dump_bt if needed Implemented FR #63188 (Display class name when debugging with gdb macro zbacktrace)
2 parents 40bb925 + dedbba4 commit c95fd5f

File tree

1 file changed

+49
-8
lines changed

1 file changed

+49
-8
lines changed

.gdbinit

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,53 @@ define dump_bt
3838
set $t = $arg0
3939
while $t
4040
printf "[%p] ", $t
41-
if $t->function_state.function->common.function_name
42-
if $t->function_state.arguments
43-
set $count = (int)*($t->function_state.arguments)
44-
printf "%s(", $t->function_state.function->common.function_name
41+
set $fst = $t->function_state
42+
if $fst.function->common.function_name
43+
if $fst.arguments
44+
set $count = (int)*($fst.arguments)
45+
46+
if $t->object
47+
if $fst.function.common.scope
48+
printf "%s->", $fst.function.common.scope->name
49+
else
50+
if !$eg && !basic_functions_module.zts
51+
____executor_globals
52+
end
53+
54+
set $known_class = 0
55+
if $eg
56+
set $handle = $t->object.value.obj.handle
57+
set $handlers = $t->object.value.obj.handlers
58+
set $zobj = (zend_object *)$eg.objects_store.object_buckets[$handle].bucket.obj.object
59+
60+
if $handlers->get_class_entry == &zend_std_object_get_class
61+
set $known_class = 1
62+
63+
if $handlers.get_class_name
64+
if $handlers.get_class_name != &zend_std_object_get_class_name
65+
set $known_class = 0
66+
end
67+
end
68+
69+
if $known_class
70+
printf "%s->", $zobj->ce.name
71+
end
72+
end
73+
end
74+
75+
if !$known_class
76+
printf "Unknown->"
77+
end
78+
end
79+
else
80+
if $fst.function.common.scope
81+
printf "%s::", $fst.function.common.scope->name
82+
end
83+
end
84+
85+
printf "%s(", $fst.function->common.function_name
4586
while $count > 0
46-
set $zvalue = *(zval **)($t->function_state.arguments - $count)
87+
set $zvalue = *(zval **)($fst.arguments - $count)
4788
set $type = $zvalue->type
4889
if $type == 0
4990
printf "NULL"
@@ -73,7 +114,7 @@ define dump_bt
73114
if $type == 7
74115
printf "resource(#%d)", $zvalue->value.lval
75116
end
76-
if $type == 8
117+
if $type == 8
77118
printf "constant"
78119
end
79120
if $type == 9
@@ -89,7 +130,7 @@ define dump_bt
89130
end
90131
printf ") "
91132
else
92-
printf "%s() ", $t->function_state.function->common.function_name
133+
printf "%s() ", $fst.function->common.function_name
93134
end
94135
else
95136
printf "??? "
@@ -600,7 +641,7 @@ define zmemcheck
600641
end
601642
end
602643
if $not_found
603-
printf "no such block that begins at %p.\n", $aptr
644+
printf "no such block that begins at %p.\n", $aptr
604645
end
605646
if $arg0 == 0
606647
printf "-------------------------------------------------------------------------------\n"

0 commit comments

Comments
 (0)