Difference between revisions of "Gecko:Debugging Tools"

From MozillaWiki
Jump to: navigation, search
(add bz's gdbinit)
Line 2: Line 2:
  
 
[http://web.mit.edu/bzbarsky/www/gdbinit bz's gdbinit]
 
[http://web.mit.edu/bzbarsky/www/gdbinit bz's gdbinit]
 +
 +
== Printing arrays ==
 +
 +
[http://blog.mozilla.com/cjones/2010/04/30/print-nstarrays-in-gdb/ Chris Jones' handy ptarray command]
  
 
== Frame Tree Dump ==
 
== Frame Tree Dump ==

Revision as of 20:24, 18 August 2011

.gdbinit

bz's gdbinit

Printing arrays

Chris Jones' handy ptarray command

Frame Tree Dump

<bz> for a frame dump, you can use the layout debugger, or... if you're in a debugger and want to examine the tree, you can do

def frametree
  set $r = ($arg0)->PresContext()->GetPresShell()->GetRootFrame()
  if ($r)
    call ((class nsIFrameDebug*)(class ViewportFrame*)$r)->List(stderr, 2)
  end
end


<bz> That should work when called on any nsIFrame to dump the tree it belongs to

Printing nsIAtoms

<bz> To print an nsIAtom, you see what concrete type it is using "set print object on", then cast it to that type, etc

<bz> if it's an nsStaticAtom:

 def satom
   p *((class nsStaticAtomWrapper*)$arg0)->mStaticAtom
 end

<bz> to be used as: satom content->Tag() or satom frame->GetType()

<bz> for nsGkAtoms it'll work great

Reflow Logs

See [Debugging Frame Reflow]