1+ define set_ts
2+ set $tsrm_ls = $arg0
3+ end
4+
5+ document set_ts
6+ set the ts resource, it is impossible for gdb to
7+ call ts_resource_ex while no process is running,
8+ but we could get the resource from the argument
9+ of frame info.
10+ end
11+
112define ____executor_globals
213 if basic_functions_module.zts
3- set $tsrm_ls = ts_resource_ex(0 , 0 )
14+ if !$tsrm_ls
15+ set $tsrm_ls = ts_resource_ex(0 , 0 )
16+ end
417 set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls ))[executor_globals_id-1 ])
518 set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls ))[compiler_globals_id-1 ])
619 else
@@ -38,12 +51,53 @@ define dump_bt
3851 set $t = $arg0
3952 while $t
4053 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
54+ set $fst = $t ->function_state
55+ if $fst .function->common .function_name
56+ if $fst .arguments
57+ set $count = (int)*($fst .arguments)
58+
59+ if $t ->object
60+ if $fst .function.common .scope
61+ printf " %s->" , $fst .function.common .scope ->name
62+ else
63+ if !$eg
64+ ____executor_globals
65+ end
66+
67+ set $known_class = 0
68+ if $eg
69+ set $handle = $t ->object.value.obj.handle
70+ set $handlers = $t ->object.value.obj.handlers
71+ set $zobj = (zend_object *)$eg .objects_store.object_buckets[$handle ].bucket.obj.object
72+
73+ if $handlers ->get_class_entry == &zend_std_object_get_class
74+ set $known_class = 1
75+
76+ if $handlers .get_class_name
77+ if $handlers .get_class_name != &zend_std_object_get_class_name
78+ set $known_class = 0
79+ end
80+ end
81+
82+ if $known_class
83+ printf " %s->" , $zobj ->ce.name
84+ end
85+ end
86+ end
87+
88+ if !$known_class
89+ printf " (Unknown)->"
90+ end
91+ end
92+ else
93+ if $fst .function.common .scope
94+ printf " %s::" , $fst .function.common .scope ->name
95+ end
96+ end
97+
98+ printf " %s(" , $fst .function->common .function_name
4599 while $count > 0
46- set $zvalue = *(zval **)($t ->function_state .arguments - $count )
100+ set $zvalue = *(zval **)($fst .arguments - $count )
47101 set $type = $zvalue ->type
48102 if $type == 0
49103 printf " NULL"
@@ -73,7 +127,7 @@ define dump_bt
73127 if $type == 7
74128 printf " resource(#%d)" , $zvalue ->value.lval
75129 end
76- if $type == 8
130+ if $type == 8
77131 printf " constant"
78132 end
79133 if $type == 9
@@ -89,7 +143,7 @@ define dump_bt
89143 end
90144 printf " ) "
91145 else
92- printf " %s() " , $t ->function_state .function->common .function_name
146+ printf " %s() " , $fst .function->common .function_name
93147 end
94148 else
95149 printf " ??? "
@@ -600,7 +654,7 @@ define zmemcheck
600654 end
601655 end
602656 if $not_found
603- printf " no such block that begins at %p.\n " , $aptr
657+ printf " no such block that begins at %p.\n " , $aptr
604658 end
605659 if $arg0 == 0
606660 printf " -------------------------------------------------------------------------------\n "
0 commit comments