1 # gdb macros which may be useful for folks using gdb to debug
2 # apache. Delete it if it bothers you.
5 set $t = (apr_table_entry_t *)((apr_array_header_t *)$arg0)->elts
6 set $n = ((apr_array_header_t *)$arg0)->nelts
9 printf "[%u] '%s'='%s'\n", $i, $t[$i].key, $t[$i].val
14 Print the key/value pairs in a table.
19 run -f /home/dgaudet/ap2/conf/mpm.conf
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
31 printf "[%u] '%s'\n", $i, $a[$i]
35 document dump_string_array
36 Print all of the elements in an array of strings.
42 if $arg0[$i] < 0x20 || $arg0[$i] > 0x7e
45 printf "%c", $arg0[$i]
51 define print_bkt_datacol
55 # arg3 == suppress header?
56 set $suppressheader = $arg3
70 # arg1 == suppress header?
71 set $bucket = (apr_bucket *)$arg0
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
84 if (($bucket->type == &apr_bucket_type_eos) || \
85 ($bucket->type == &apr_bucket_type_flush))
87 # metadata buckets, no content
88 print_bkt_datacol "contents" "%c" ' ' $sh
90 print_bkt_datacol "rc" "n/%c" 'a' $sh
93 if ($bucket->type == &ap_bucket_type_error)
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
102 if (($bucket->type == &apr_bucket_type_file) || \
103 ($bucket->type == &apr_bucket_type_pipe) || \
104 ($bucket->type == &apr_bucket_type_socket))
106 # buckets that contain data not in memory (ie not printable)
108 print_bkt_datacol "contents" "[**unprintable**%c" ']' $sh
109 if $bucket->type == &apr_bucket_type_file
110 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
111 print_bkt_datacol "rc" "%d" $refcount $sh
115 if (($bucket->type == &apr_bucket_type_heap) || \
116 ($bucket->type == &apr_bucket_type_pool) || \
117 ($bucket->type == &apr_bucket_type_mmap) || \
118 ($bucket->type == &apr_bucket_type_transient) || \
119 ($bucket->type == &apr_bucket_type_immortal))
123 if $bucket->type == &apr_bucket_type_heap
124 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
125 set $p = (apr_bucket_heap *)$bucket->data
126 set $data = $p->base+$bucket->start
129 if $bucket->type == &apr_bucket_type_pool
130 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
131 set $p = (apr_bucket_pool *)$bucket->data
133 set $p = (apr_bucket_heap *)$bucket->data
135 set $data = $p->base+$bucket->start
138 if $bucket->type == &apr_bucket_type_mmap
139 # is this safe if not APR_HAS_MMAP?
140 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
141 set $p = (apr_bucket_mmap *)$bucket->data
142 set $data = ((char *)$p->mmap->mm)+$bucket->start
145 if (($bucket->type == &apr_bucket_type_transient) || \
146 ($bucket->type == &apr_bucket_type_immortal))
147 set $data = ((char *)$bucket->data)+$bucket->start
159 set $datalen = $bucket->length
165 printmemn $data $datalen
170 set $datalen = $datalen + 1
174 print_bkt_datacol "rc" "%d" $refcount $sh
176 print_bkt_datacol "rc" "n/%c" 'a' $sh
180 # 3rd-party bucket type
181 print_bkt_datacol "contents" "[**unknown**%c" ']' $sh
183 print_bkt_datacol "rc" "n/%c" 'a' $sh
194 dump_bucket_ex $arg0 0
201 set $bb = (apr_bucket_brigade *)$arg0
202 set $bucket = $bb->list.next
203 set $sentinel = ((char *)((&($bb->list)) \
204 - ((size_t) &((apr_bucket *)0)->link)))
205 printf "dump of brigade 0x%lx\n", (unsigned long)$bb
207 printf " | type (address) | length | "
208 printf "data addr | contents | rc\n"
209 printf "----------------------------------------"
210 printf "----------------------------------------\n"
212 if $bucket == $sentinel
213 printf "brigade is empty\n"
217 while $bucket != $sentinel
219 dump_bucket_ex $bucket 1
221 set $bucket = $bucket->link.next
223 printf "end of brigade\n"
225 document dump_brigade
226 Print bucket brigade info
232 printf "%s(0x%lx): ctx=0x%lx, r=0x%lx, c=0x%lx\n", \
233 $f->frec->name, (unsigned long)$f, (unsigned long)$f->ctx, \
238 document dump_filters
239 Print filter chain info
242 define dump_process_rec
244 printf "process_rec=0x%lx:\n", (unsigned long)$p
245 printf " pool=0x%lx, pconf=0x%lx\n", \
246 (unsigned long)$p->pool, (unsigned long)$p->pconf
248 document dump_process_rec
249 Print process_rec info
252 define dump_server_rec
254 printf "name=%s:%d\n", \
255 $s->server_hostname, $s->port
256 dump_process_rec($s->process)
258 document dump_server_rec
259 Print server_rec info
270 document dump_servers
271 Print server_rec list info