Difference between revisions of "Gecko:Debugging Tools"
From MozillaWiki
(→Printing nsIAtoms) |
|||
Line 79: | Line 79: | ||
== Printing nsIAtoms == | == Printing nsIAtoms == | ||
− | + | def pa | |
− | + | set $atom = $arg0 | |
− | + | if (sizeof(*((&*$atom)->mString)) == 2) | |
− | + | pu (&*$atom)->mString | |
− | + | end | |
− | + | end | |
− | |||
− | |||
− | |||
− | |||
− | |||
== Reflow Logs == | == Reflow Logs == | ||
See [[http://www.mozilla.org/newlayout/doc/frame_reflow_debug.html Debugging Frame Reflow]] | See [[http://www.mozilla.org/newlayout/doc/frame_reflow_debug.html Debugging Frame Reflow]] |
Revision as of 03:13, 4 April 2012
Contents
.gdbinit
GDB pretty printers
Printing arrays
define ptarray if $argc == 0 help ptarray else set $size = $arg0.mHdr->mLength set $capacity = $arg0.mHdr->mCapacity set $size_max = $size - 1 set $elts = $arg0.Elements() end if $argc == 1 set $i = 0 while $i < $size printf "elem[%u]: ", $i p *($elts + $i) set $i++ end end if $argc == 2 set $idx = $arg1 if $idx < 0 || $idx > $size_max printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max else printf "elem[%u]: ", $idx p *($elts + $idx) end end if $argc == 3 set $start_idx = $arg1 set $stop_idx = $arg2 if $start_idx > $stop_idx set $tmp_idx = $start_idx set $start_idx = $stop_idx set $stop_idx = $tmp_idx end if $start_idx < 0 || $stop_idx < 0 || $start_idx > $size_max || $stop_idx > $size_max printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max else set $i = $start_idx while $i <= $stop_idx printf "elem[%u]: ", $i p *($elts + $i) set $i++ end end end if $argc > 0 printf "nsTArray length = %u\n", $size printf "nsTArray capacity = %u\n", $capacity printf "Element " whatis *$elts end end
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 call nsFrame::DumpFrameTree($arg0) end
<bz> That should work when called on any nsIFrame to dump the tree it belongs to
Printing nsIAtoms
def pa set $atom = $arg0 if (sizeof(*((&*$atom)->mString)) == 2) pu (&*$atom)->mString end end
Reflow Logs
See [Debugging Frame Reflow]