Skip to content

Commit 8e9805b

Browse files
committed
Now we can set the tsrm_ls manually
get(ZTS build): (gdb) zbacktrace You can't do that without a process to debug. (gdb) set_ts 0x4112500 (gdb) zbacktrace [0x2b232e83a1d8] call_user_func(array(2)[0x2b232e879528], array(1)[0x2b232e878fa0]) /tmp/1.php:4 [0x7fffcb2efd80] A->__call("xxx", array(1)[0x2b232e878fa0])
1 parent 139ac42 commit 8e9805b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.gdbinit

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
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+
112
define ____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
@@ -47,7 +60,7 @@ define dump_bt
4760
if $fst.function.common.scope
4861
printf "%s->", $fst.function.common.scope->name
4962
else
50-
if !$eg && !basic_functions_module.zts
63+
if !$eg
5164
____executor_globals
5265
end
5366

@@ -73,7 +86,7 @@ define dump_bt
7386
end
7487

7588
if !$known_class
76-
printf "Unknown->"
89+
printf "(Unknown)->"
7790
end
7891
end
7992
else

0 commit comments

Comments
 (0)