1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # .gdbinit file for debugging Mozilla
7 # You may need to put an 'add-auto-load-safe-path' command in your
8 # $HOME/.gdbinit file to get GDB to trust this file. If your builds are
9 # generally in $HOME/moz, then you can say:
11 # add-auto-load-safe-path ~/moz
13 # Don't stop for the SIG32/33/etc signals that Flash produces
14 handle SIG32 noprint nostop pass
15 handle SIG33 noprint nostop pass
16 handle SIGPIPE noprint nostop pass
18 # Don't stop for certain other signals where it's not useful,
19 # such as the SIG64 signals triggered by the Linux
20 # sandboxing code on older kernels.
21 handle SIG38 noprint nostop pass
22 handle SIG64 noprint nostop pass
23 handle SIGSYS noprint nostop pass
25 # Show the concrete types behind nsIFoo
28 # run when using the auto-solib-add trick
36 # run -mail, when using the auto-solib-add trick
44 # Define a "pu" command to display PRUnichar * strings (100 chars max)
45 # Also allows an optional argument for how many chars to print as long as
57 # scratch array with space for 100 chars plus null terminator. Make
58 # sure to not use ' ' as the char so this copy/pastes well.
59 set $scratch = "____________________________________________________________________________________________________"
62 while (*$uni && $i++ < $limit)
64 set $scratch[$scratch_idx++] = *(char*)$uni++
67 set $scratch[$scratch_idx] = '\0'
71 print /x *(short*)$uni++
75 set $scratch[$scratch_idx] = '\0'
80 # Define a "ps" command to display subclasses of nsAC?String. Note that
81 # this assumes strings as of Gecko 1.9 (well, and probably a few
82 # releases before that as well); going back far enough will get you
83 # to string classes that this function doesn't work for.
86 if (sizeof(*$str.mData) == 1 && ($str.mFlags & 1) != 0)
89 pu $str.mData $str.mLength
93 # Define a "pa" command to display the string value for an nsAtom
96 if (sizeof(*((&*$atom)->mString)) == 2)
101 # define a "pxul" command to display the type of a XUL element from
102 # an nsXULElement* pointer.
105 print $p->mNodeInfo.mRawPtr->mInner.mName->mStaticAtom->mString
108 # define a "prefcnt" command to display the refcount of an XPCOM obj
111 print ((nsPurpleBufferEntry*)$p->mRefCnt.mTagged)->mRefCnt
114 # define a "ptag" command to display the tag name of a content node
117 pa $p->mNodeInfo.mRawPtr->mInner.mName
127 set $size = $arg0.mHdr->mLength
128 set $capacity = $arg0.mHdr->mCapacity
129 set $size_max = $size - 1
130 set $elts = $arg0.Elements()
135 printf "elem[%u]: ", $i
142 if $idx < 0 || $idx > $size_max
143 printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
145 printf "elem[%u]: ", $idx
150 set $start_idx = $arg1
151 set $stop_idx = $arg2
152 if $start_idx > $stop_idx
153 set $tmp_idx = $start_idx
154 set $start_idx = $stop_idx
155 set $stop_idx = $tmp_idx
157 if $start_idx < 0 || $stop_idx < 0 || $start_idx > $size_max || $stop_idx > $size_max
158 printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
161 while $i <= $stop_idx
162 printf "elem[%u]: ", $i
169 printf "nsTArray length = %u\n", $size
170 printf "nsTArray capacity = %u\n", $capacity
177 Prints nsTArray information.
179 Note: idx, idx1 and idx2 must be in acceptable range [0...size()-1].
181 ptarray a - Prints tarray content, size, capacity and T typedef
182 ptarray a 0 - Prints element[idx] from tarray
183 ptarray a 1 2 - Prints elements in range [idx1..idx2] from tarray
191 call $arg0->DumpFrameTree()
195 call $arg0->DumpFrameTreeInCSSPixels()
199 call $arg0->DumpFrameTreeLimited()
203 call $arg0->DumpFrameTreeLimitedInCSSPixels()