]> granicus.if.org Git - php/commitdiff
it's good for gc debuging
authorXinchen Hui <laruence@php.net>
Tue, 16 Sep 2014 06:15:01 +0000 (14:15 +0800)
committerXinchen Hui <laruence@php.net>
Tue, 16 Sep 2014 06:15:01 +0000 (14:15 +0800)
.gdbinit

index c1ef530f8e6a7d4171bbbda58f79313ce10245c1..98bb173a5a672921f73a2c36f22a31d3b63bdf64 100644 (file)
--- a/.gdbinit
+++ b/.gdbinit
@@ -638,3 +638,28 @@ document zmemcheck
        usage: zmemcheck [ptr].
        if ptr is 0, all blocks will be listed.
 end
+
+define lookup_root
+       set $found = 0
+       if gc_globals->roots
+               set $current = gc_globals->roots->next
+               printf "looking ref %p in roots\n", $arg0
+               while $current != &gc_globals->roots
+                       if $current->ref == $arg0
+                               set $found = $current
+                               break
+                       end
+                       set $current = $current->next
+               end
+               if $found != 0
+                       printf "found root %p\n", $found
+               else
+                       printf "not found\n"
+               end
+       end
+end
+
+document lookup_root
+       lookup a refcounted in root
+       usage: lookup_root [ptr].
+end