[webkit-dev] gdb archer and tracking live objects

Holger Freyther zecke at selfish.org
Mon Mar 15 00:38:25 PDT 2010


Hi all,

one of the archer branches of gdb allows to turn gdb into a python interpreter 
and allow scripting.

My idea was to use this to track all refcounted objects in WebCore and answer 
questions like. How many objects are alive? How many objects changed from 
point a to b? What are the refcounts? Where was the ref count increased?

I have a slightly modified release build to turn RefCountedBase into a non 
inline class and only compile the RefCounted.cpp with -ggdb3 debug support to 
easily set a breakpoint there.

With the attached python script I'm able to keep track of RefCountedBase 
objects, have commands to print the python dictionary from a gdb cli. I have 
no other exploring functions in place.

I wonder if I could develop this tool inside a subdirectory 
WebKitTools/Scripts without the usual review process?




Due some limitations in the python support the workflow is currently like this:

gdb -P script GtKLauncher
(gdb) webkit-setup
... questions about pending breakpoints...
(gdb) r
CTRL+C
(gdb) webkit-objects 
WebCore has 2891 live objects of 0 kinds
0xb3e05784
0xb3d99378
0xb3e1e6ac


-------------- next part --------------
A non-text attachment was scrubbed...
Name: webkit.py
Type: text/x-python
Size: 3379 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100315/1d83674e/attachment.py>


More information about the webkit-dev mailing list