]> granicus.if.org Git - php/commitdiff
Now we can set the tsrm_ls manually
authorXinchen Hui <laruence@php.net>
Mon, 1 Oct 2012 16:02:08 +0000 (00:02 +0800)
committerXinchen Hui <laruence@php.net>
Mon, 1 Oct 2012 16:02:08 +0000 (00:02 +0800)
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])

.gdbinit

index 87c942561571fc79459a433c7f42107622ec4d20..e7a565dfa9cc674a1b0732ba6e70db7ca24f549b 100644 (file)
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,6 +1,19 @@
+define set_ts
+       set $tsrm_ls = $arg0
+end
+
+document set_ts
+       set the ts resource, it is impossible for gdb to
+       call ts_resource_ex while no process is running,
+       but we could get the resource from the argument 
+       of frame info.
+end
+
 define ____executor_globals
        if basic_functions_module.zts
-               set $tsrm_ls = ts_resource_ex(0, 0)
+               if !$tsrm_ls
+                       set $tsrm_ls = ts_resource_ex(0, 0)
+               end
                set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1])
                set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
        else
@@ -47,7 +60,7 @@ define dump_bt
                                        if $fst.function.common.scope
                                                printf "%s->", $fst.function.common.scope->name
                                        else
-                                               if !$eg && !basic_functions_module.zts
+                                               if !$eg
                                                        ____executor_globals
                                                end
 
@@ -73,7 +86,7 @@ define dump_bt
                                                end
 
                                                if !$known_class
-                                                       printf "Unknown->"
+                                                       printf "(Unknown)->"
                                                end
                                        end
                                else