Revision control

Other Tools

1
# .gdbinit file for debugging Mozilla
2
3
# You may need to put an 'add-auto-load-safe-path' command in your
4
# $HOME/.gdbinit file to get GDB to trust this file. If your builds are
5
# generally in $HOME/moz, then you can say:
6
#
7
# add-auto-load-safe-path ~/moz
8
9
# Don't stop for the SIG32/33/etc signals that Flash produces
10
handle SIG32 noprint nostop pass
11
handle SIG33 noprint nostop pass
12
handle SIGPIPE noprint nostop pass
13
14
# Don't stop for certain other signals where it's not useful,
15
# such as the SIG64 signals triggered by the Linux
16
# sandboxing code on older kernels.
17
handle SIG38 noprint nostop pass
18
handle SIG64 noprint nostop pass
19
handle SIGSYS noprint nostop pass
20
21
# Show the concrete types behind nsIFoo
22
set print object on
23
24
# run when using the auto-solib-add trick
25
def prun
26
tbreak main
27
run
28
set auto-solib-add 0
29
cont
30
end
31
32
# run -mail, when using the auto-solib-add trick
33
def pmail
34
tbreak main
35
run -mail
36
set auto-solib-add 0
37
cont
38
end
39
40
# Define a "pu" command to display PRUnichar * strings (100 chars max)
41
# Also allows an optional argument for how many chars to print as long as
42
# it's less than 100.
43
def pu
44
set $uni = $arg0
45
if $argc == 2
46
set $limit = $arg1
47
if $limit > 100
48
set $limit = 100
49
end
50
else
51
set $limit = 100
52
end
53
# scratch array with space for 100 chars plus null terminator. Make
54
# sure to not use ' ' as the char so this copy/pastes well.
55
set $scratch = "____________________________________________________________________________________________________"
56
set $i = 0
57
set $scratch_idx = 0
58
while (*$uni && $i++ < $limit)
59
if (*$uni < 0x80)
60
set $scratch[$scratch_idx++] = *(char*)$uni++
61
else
62
if ($scratch_idx > 0)
63
set $scratch[$scratch_idx] = '\0'
64
print $scratch
65
set $scratch_idx = 0
66
end
67
print /x *(short*)$uni++
68
end
69
end
70
if ($scratch_idx > 0)
71
set $scratch[$scratch_idx] = '\0'
72
print $scratch
73
end
74
end
75
76
# Define a "ps" command to display subclasses of nsAC?String. Note that
77
# this assumes strings as of Gecko 1.9 (well, and probably a few
78
# releases before that as well); going back far enough will get you
79
# to string classes that this function doesn't work for.
80
def ps
81
set $str = $arg0
82
if (sizeof(*$str.mData) == 1 && ($str.mFlags & 1) != 0)
83
print $str.mData
84
else
85
pu $str.mData $str.mLength
86
end
87
end
88
89
# Define a "pa" command to display the string value for an nsAtom
90
def pa
91
set $atom = $arg0
92
if (sizeof(*((&*$atom)->mString)) == 2)
93
pu (&*$atom)->mString
94
end
95
end
96
97
# define a "pxul" command to display the type of a XUL element from
98
# an nsXULElement* pointer.
99
def pxul
100
set $p = $arg0
101
print $p->mNodeInfo.mRawPtr->mInner.mName->mStaticAtom->mString
102
end
103
104
# define a "prefcnt" command to display the refcount of an XPCOM obj
105
def prefcnt
106
set $p = $arg0
107
print ((nsPurpleBufferEntry*)$p->mRefCnt.mTagged)->mRefCnt
108
end
109
110
# define a "ptag" command to display the tag name of a content node
111
def ptag
112
set $p = $arg0
113
pa $p->mNodeInfo.mRawPtr->mInner.mName
114
end
115
116
##
117
## nsTArray
118
##
119
define ptarray
120
if $argc == 0
121
help ptarray
122
else
123
set $size = $arg0.mHdr->mLength
124
set $capacity = $arg0.mHdr->mCapacity
125
set $size_max = $size - 1
126
set $elts = $arg0.Elements()
127
end
128
if $argc == 1
129
set $i = 0
130
while $i < $size
131
printf "elem[%u]: ", $i
132
p *($elts + $i)
133
set $i++
134
end
135
end
136
if $argc == 2
137
set $idx = $arg1
138
if $idx < 0 || $idx > $size_max
139
printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
140
else
141
printf "elem[%u]: ", $idx
142
p *($elts + $idx)
143
end
144
end
145
if $argc == 3
146
set $start_idx = $arg1
147
set $stop_idx = $arg2
148
if $start_idx > $stop_idx
149
set $tmp_idx = $start_idx
150
set $start_idx = $stop_idx
151
set $stop_idx = $tmp_idx
152
end
153
if $start_idx < 0 || $stop_idx < 0 || $start_idx > $size_max || $stop_idx > $size_max
154
printf "idx1, idx2 are not in acceptable range: [0..%u].\n", $size_max
155
else
156
set $i = $start_idx
157
while $i <= $stop_idx
158
printf "elem[%u]: ", $i
159
p *($elts + $i)
160
set $i++
161
end
162
end
163
end
164
if $argc > 0
165
printf "nsTArray length = %u\n", $size
166
printf "nsTArray capacity = %u\n", $capacity
167
printf "Element "
168
whatis *$elts
169
end
170
end
171
172
document ptarray
173
Prints nsTArray information.
174
Syntax: ptarray
175
Note: idx, idx1 and idx2 must be in acceptable range [0...size()-1].
176
Examples:
177
ptarray a - Prints tarray content, size, capacity and T typedef
178
ptarray a 0 - Prints element[idx] from tarray
179
ptarray a 1 2 - Prints elements in range [idx1..idx2] from tarray
180
end
181
182
def js
183
call DumpJSStack()
184
end
185
186
def ft
187
call $arg0->DumpFrameTree()
188
end
189
190
def ftl
191
call $arg0->DumpFrameTreeLimited()
192
end
193
194
source .gdbinit_python