upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / .gdbinit
1 # gdb macros which may be useful for folks using gdb to debug
2 # apache.  Delete it if it bothers you.
3
4 define dump_table
5     set $t = (apr_table_entry_t *)((apr_array_header_t *)$arg0)->elts
6     set $n = ((apr_array_header_t *)$arg0)->nelts
7     set $i = 0
8     while $i < $n
9         printf "[%u] '%s'='%s'\n", $i, $t[$i].key, $t[$i].val
10         set $i = $i + 1
11     end
12 end
13 document dump_table
14     Print the key/value pairs in a table.
15 end
16
17
18 define rh
19         run -f /home/dgaudet/ap2/conf/mpm.conf
20 end
21
22 define ro
23         run -DONE_PROCESS
24 end
25
26 define dump_string_array
27     set $a = (char **)((apr_array_header_t *)$arg0)->elts
28     set $n = (int)((apr_array_header_t *)$arg0)->nelts
29     set $i = 0
30     while $i < $n
31         printf "[%u] '%s'\n", $i, $a[$i]
32         set $i = $i + 1
33     end
34 end
35 document dump_string_array
36     Print all of the elements in an array of strings.
37 end
38
39 define printmemn
40     set $i = 0
41     while $i < $arg1
42         if $arg0[$i] < 0x20 || $arg0[$i] > 0x7e
43             printf "~"
44         else
45             printf "%c", $arg0[$i]
46         end
47         set $i = $i + 1
48     end
49 end
50
51 define print_bkt_datacol
52     # arg0 == column name
53     # arg1 == format
54     # arg2 == value
55     # arg3 == suppress header?
56     set $suppressheader = $arg3
57
58     if !$suppressheader
59         printf " "
60         printf $arg0
61         printf "="
62     else
63         printf " | "
64     end
65     printf $arg1, $arg2
66 end
67
68 define dump_bucket_ex
69     # arg0 == bucket
70     # arg1 == suppress header?
71     set $bucket = (apr_bucket *)$arg0
72     set $sh = $arg1
73     set $refcount = -1
74
75     print_bkt_datacol "bucket" "%-9s" $bucket->type->name $sh
76     printf "(0x%08lx)", (unsigned long)$bucket
77     print_bkt_datacol "length" "%-6ld" (long)($bucket->length) $sh
78     print_bkt_datacol "data" "0x%08lx" $bucket->data $sh
79
80     if !$sh
81         printf "\n    "
82     end
83
84     if (($bucket->type == &apr_bucket_type_eos)   || \
85         ($bucket->type == &apr_bucket_type_flush))
86
87         # metadata buckets, no content
88         print_bkt_datacol "contents" "%c" ' ' $sh
89         printf "                     "
90         print_bkt_datacol "rc" "n/%c" 'a' $sh
91
92     else
93     if ($bucket->type == &ap_bucket_type_error)
94
95         # metadata bucket, no content but it does have an error code in it
96         print_bkt_datacol "contents" "%c" ' ' $sh
97         set $status = ((ap_bucket_error *)$bucket->data)->status
98         printf " (status=%3d)        ", $status
99         print_bkt_datacol "rc" "n/%c" 'a' $sh
100
101     else
102     if (($bucket->type == &apr_bucket_type_file) || \
103         ($bucket->type == &apr_bucket_type_pipe) || \
104         ($bucket->type == &apr_bucket_type_socket))
105
106         # buckets that contain data not in memory (ie not printable)
107
108         print_bkt_datacol "contents" "[**unprintable**%c" ']' $sh
109         printf "     "
110         if $bucket->type == &apr_bucket_type_file
111             set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
112             print_bkt_datacol "rc" "%d" $refcount $sh
113         end
114
115     else
116     if (($bucket->type == &apr_bucket_type_heap)      || \
117         ($bucket->type == &apr_bucket_type_pool)      || \
118         ($bucket->type == &apr_bucket_type_mmap)      || \
119         ($bucket->type == &apr_bucket_type_transient) || \
120         ($bucket->type == &apr_bucket_type_immortal))
121
122         # in-memory buckets
123
124         if $bucket->type == &apr_bucket_type_heap
125             set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
126             set $p = (apr_bucket_heap *)$bucket->data
127             set $data = $p->base+$bucket->start
128
129         else
130         if $bucket->type == &apr_bucket_type_pool
131             set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
132             set $p = (apr_bucket_pool *)$bucket->data
133             if !$p->pool
134                 set $p = (apr_bucket_heap *)$bucket->data
135             end
136             set $data = $p->base+$bucket->start
137
138         else
139         if $bucket->type == &apr_bucket_type_mmap
140             # is this safe if not APR_HAS_MMAP?
141             set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
142             set $p = (apr_bucket_mmap *)$bucket->data
143             set $data = ((char *)$p->mmap->mm)+$bucket->start
144
145         else
146         if (($bucket->type == &apr_bucket_type_transient) || \
147             ($bucket->type == &apr_bucket_type_immortal))
148             set $data = ((char *)$bucket->data)+$bucket->start
149
150         end
151         end
152         end
153         end
154
155         if $sh
156             printf " | ["
157         else
158             printf " contents=["
159         end
160         set $datalen = $bucket->length
161         if $datalen > 17
162             printmem $data 17
163             printf "..."
164             set $datalen = 20
165         else
166             printmemn $data $datalen
167         end
168         printf "]"
169         while $datalen < 20
170             printf " "
171             set $datalen = $datalen + 1
172         end
173
174         if $refcount != -1
175             print_bkt_datacol "rc" "%d" $refcount $sh
176         else
177             print_bkt_datacol "rc" "n/%c" 'a' $sh
178         end
179
180     else
181         # 3rd-party bucket type
182         print_bkt_datacol "contents" "[**unknown**%c" ']' $sh
183         printf "         "
184         print_bkt_datacol "rc" "n/%c" 'a' $sh
185     end
186     end
187     end
188     end
189
190     printf "\n"
191
192 end
193
194 define dump_bucket
195     dump_bucket_ex $arg0 0
196 end
197 document dump_bucket
198     Print bucket info
199 end
200
201 define dump_brigade
202     set $bb = (apr_bucket_brigade *)$arg0
203     set $bucket = $bb->list.next
204     set $sentinel = ((char *)((&($bb->list)) \
205                                - ((size_t) &((apr_bucket *)0)->link)))
206     printf "dump of brigade 0x%lx\n", (unsigned long)$bb
207
208     printf "   | type     (address)    | length | "
209     printf "data addr  | contents               | rc\n"
210     printf "----------------------------------------"
211     printf "----------------------------------------\n"
212
213     if $bucket == $sentinel
214         printf "brigade is empty\n"
215     end
216
217     set $j = 0
218     while $bucket != $sentinel
219         printf "%2d", $j
220         dump_bucket_ex $bucket 1
221         set $j = $j + 1
222         set $bucket = $bucket->link.next
223     end
224     printf "end of brigade\n"
225 end
226 document dump_brigade
227     Print bucket brigade info
228 end
229
230 define dump_filters
231     set $f = $arg0
232     while $f
233         printf "%s(0x%lx): ctx=0x%lx, r=0x%lx, c=0x%lx\n", \
234         $f->frec->name, (unsigned long)$f, (unsigned long)$f->ctx, \
235         $f->r, $f->c
236         set $f = $f->next
237     end
238 end
239 document dump_filters
240     Print filter chain info
241 end
242
243 define dump_process_rec
244     set $p = $arg0
245     printf "process_rec=0x%lx:\n", (unsigned long)$p
246     printf "   pool=0x%lx, pconf=0x%lx\n", \
247            (unsigned long)$p->pool, (unsigned long)$p->pconf
248 end
249 document dump_process_rec
250     Print process_rec info
251 end
252
253 define dump_server_rec
254     set $s = $arg0
255     printf "name=%s:%d\n", \
256             $s->server_hostname, $s->port
257     dump_process_rec($s->process)
258 end
259 document dump_server_rec
260     Print server_rec info
261 end
262
263 define dump_servers
264     set $s = $arg0
265     while $s
266         dump_server_rec($s)
267         printf "\n"
268         set $s = $s->next
269     end
270 end
271 document dump_servers
272     Print server_rec list info
273 end