Bug 754472 - Implement multiple plugin click-to-play UI. r=jaws r=margaret r=dietrich
[gecko.git] / .gdbinit
blob51d043b48607f9bf6babf147e8df05b9f8fbd965
1 # .gdbinit file for debugging Mozilla
3 # Don't stop for the SIG32/33/etc signals that Flash produces
4 handle SIG32 noprint nostop pass
5 handle SIG33 noprint nostop pass
6 handle SIGPIPE noprint nostop pass
8 # Show the concrete types behind nsIFoo
9 set print object on
11 # run when using the auto-solib-add trick
12 def prun
13         tbreak main
14         run
15         set auto-solib-add 0
16         cont
17 end
19 # run -mail, when using the auto-solib-add trick
20 def pmail
21         tbreak main
22         run -mail
23         set auto-solib-add 0
24         cont
25 end
27 # Define a "pu" command to display PRUnichar * strings (100 chars max)
28 # Also allows an optional argument for how many chars to print as long as
29 # it's less than 100.
30 def pu
31   set $uni = $arg0
32   if $argc == 2
33     set $limit = $arg1
34     if $limit > 100
35       set $limit = 100
36     end
37   else
38     set $limit = 100
39   end
40   # scratch array with space for 100 chars plus null terminator.  Make
41   # sure to not use ' ' as the char so this copy/pastes well.
42   set $scratch = "____________________________________________________________________________________________________"
43   set $i = 0
44   set $scratch_idx = 0
45   while (*$uni && $i++ < $limit)
46     if (*$uni < 0x80)
47       set $scratch[$scratch_idx++] = *(char*)$uni++
48     else
49       if ($scratch_idx > 0)
50         set $scratch[$scratch_idx] = '\0'
51         print $scratch
52         set $scratch_idx = 0
53       end
54       print /x *(short*)$uni++
55     end
56   end
57   if ($scratch_idx > 0)
58     set $scratch[$scratch_idx] = '\0'
59     print $scratch
60   end
61 end
63 # Define a "ps" command to display subclasses of nsAC?String.  Note that
64 # this assumes strings as of Gecko 1.9 (well, and probably a few
65 # releases before that as well); going back far enough will get you
66 # to string classes that this function doesn't work for.
67 def ps
68   set $str = $arg0
69   if (sizeof(*$str.mData) == 1 && ($str.mFlags & 1) != 0)
70     print $str.mData
71   else
72     pu $str.mData $str.mLength
73   end
74 end
76 # Define a "pa" command to display the string value for an nsIAtom
77 def pa
78   set $atom = $arg0
79   if (sizeof(*((&*$atom)->mString)) == 2)
80     pu (&*$atom)->mString
81   end
82 end
84 # define a "pxul" command to display the type of a XUL element from
85 # an nsXULDocument* pointer.
86 def pxul
87   set $p = $arg0
88   print $p->mNodeInfo.mRawPtr->mInner.mName->mStaticAtom->mString
89 end
91 # define a "prefcnt" command to display the refcount of an XPCOM obj
92 def prefcnt
93   set $p = $arg0
94   print ((nsPurpleBufferEntry*)$p->mRefCnt.mTagged)->mRefCnt
95 end
97 # define a "ptag" command to display the tag name of a content node
98 def ptag
99   set $p = $arg0
100   pa $p->mNodeInfo.mRawPtr->mInner.mName
104 ## nsTArray
106 define ptarray
107         if $argc == 0
108                 help ptarray
109         else
110                 set $size = $arg0.mHdr->mLength
111                 set $capacity = $arg0.mHdr->mCapacity
112                 set $size_max = $size - 1
113                 set $elts = $arg0.Elements()
114         end
115         if $argc == 1
116                 set $i = 0
117                 while $i < $size
118                         printf "elem[%u]: ", $i
119                         p *($elts + $i)
120                         set $i++
121                 end
122         end
123         if $argc == 2
124                 set $idx = $arg1
125                 if $idx < 0 || $idx > $size_max
126                         printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
127                 else
128                         printf "elem[%u]: ", $idx
129                         p *($elts + $idx)
130                 end
131         end
132         if $argc == 3
133           set $start_idx = $arg1
134           set $stop_idx = $arg2
135           if $start_idx > $stop_idx
136             set $tmp_idx = $start_idx
137             set $start_idx = $stop_idx
138             set $stop_idx = $tmp_idx
139           end
140           if $start_idx < 0 || $stop_idx < 0 || $start_idx > $size_max || $stop_idx > $size_max
141             printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
142           else
143             set $i = $start_idx
144                 while $i <= $stop_idx
145                         printf "elem[%u]: ", $i
146                         p *($elts + $i)
147                         set $i++
148                 end
149           end
150         end
151         if $argc > 0
152                 printf "nsTArray length = %u\n", $size
153                 printf "nsTArray capacity = %u\n", $capacity
154                 printf "Element "
155                 whatis *$elts
156         end
159 document ptarray
160         Prints nsTArray information.
161         Syntax: ptarray   
162         Note: idx, idx1 and idx2 must be in acceptable range [0...size()-1].
163         Examples:
164         ptarray a - Prints tarray content, size, capacity and T typedef
165         ptarray a 0 - Prints element[idx] from tarray
166         ptarray a 1 2 - Prints elements in range [idx1..idx2] from tarray
169 def js
170   call DumpJSStack()
173 def ft
174   call nsFrame::DumpFrameTree($arg0)