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
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
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))
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
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
134 set $p = (apr_bucket_heap *)$bucket->data
136 set $data = $p->base+$bucket->start
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
146 if (($bucket->type == &apr_bucket_type_transient) || \
147 ($bucket->type == &apr_bucket_type_immortal))
148 set $data = ((char *)$bucket->data)+$bucket->start
160 set $datalen = $bucket->length
166 printmemn $data $datalen
171 set $datalen = $datalen + 1
175 print_bkt_datacol "rc" "%d" $refcount $sh
177 print_bkt_datacol "rc" "n/%c" 'a' $sh
181 # 3rd-party bucket type
182 print_bkt_datacol "contents" "[**unknown**%c" ']' $sh
184 print_bkt_datacol "rc" "n/%c" 'a' $sh
195 dump_bucket_ex $arg0 0
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
208 printf " | type (address) | length | "
209 printf "data addr | contents | rc\n"
210 printf "----------------------------------------"
211 printf "----------------------------------------\n"
213 if $bucket == $sentinel
214 printf "brigade is empty\n"
218 while $bucket != $sentinel
220 dump_bucket_ex $bucket 1
222 set $bucket = $bucket->link.next
224 printf "end of brigade\n"
226 document dump_brigade
227 Print bucket brigade info
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, \
239 document dump_filters
240 Print filter chain info
243 define dump_process_rec
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
249 document dump_process_rec
250 Print process_rec info
253 define dump_server_rec
255 printf "name=%s:%d\n", \
256 $s->server_hostname, $s->port
257 dump_process_rec($s->process)
259 document dump_server_rec
260 Print server_rec info
271 document dump_servers
272 Print server_rec list info