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 if $t[$i].val == (void *)0L
10 printf "[%u] '%s'=>NULL\n", $i, $t[$i].key
12 printf "[%u] '%s'='%s'\n", $i, $t[$i].key, $t[$i].val
18 Print the key/value pairs in a table.
23 run -f /home/dgaudet/ap2/conf/mpm.conf
30 define dump_string_array
31 set $a = (char **)((apr_array_header_t *)$arg0)->elts
32 set $n = (int)((apr_array_header_t *)$arg0)->nelts
35 printf "[%u] '%s'\n", $i, $a[$i]
39 document dump_string_array
40 Print all of the elements in an array of strings.
46 if $arg0[$i] < 0x20 || $arg0[$i] > 0x7e
49 printf "%c", $arg0[$i]
55 define print_bkt_datacol
59 # arg3 == suppress header?
60 set $suppressheader = $arg3
74 # arg1 == suppress header?
75 set $bucket = (struct apr_bucket *)$arg0
79 print_bkt_datacol "bucket" "%-9s" $bucket->type->name $sh
80 printf "(0x%08lx)", (unsigned long)$bucket
81 print_bkt_datacol "length" "%-6ld" (long)($bucket->length) $sh
82 print_bkt_datacol "data" "0x%08lx" $bucket->data $sh
88 if (($bucket->type == &apr_bucket_type_eos) || \
89 ($bucket->type == &apr_bucket_type_flush))
91 # metadata buckets, no content
92 print_bkt_datacol "contents" "%c" ' ' $sh
94 print_bkt_datacol "rc" "n/%c" 'a' $sh
97 if ($bucket->type == &ap_bucket_type_error)
99 # metadata bucket, no content but it does have an error code in it
100 print_bkt_datacol "contents" "%c" ' ' $sh
101 set $status = ((ap_bucket_error *)$bucket->data)->status
102 printf " (status=%3d) ", $status
103 print_bkt_datacol "rc" "n/%c" 'a' $sh
106 if (($bucket->type == &apr_bucket_type_file) || \
107 ($bucket->type == &apr_bucket_type_pipe) || \
108 ($bucket->type == &apr_bucket_type_socket))
110 # buckets that contain data not in memory (ie not printable)
112 print_bkt_datacol "contents" "[**unprintable**%c" ']' $sh
114 if $bucket->type == &apr_bucket_type_file
115 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
116 print_bkt_datacol "rc" "%d" $refcount $sh
120 if (($bucket->type == &apr_bucket_type_heap) || \
121 ($bucket->type == &apr_bucket_type_pool) || \
122 ($bucket->type == &apr_bucket_type_mmap) || \
123 ($bucket->type == &apr_bucket_type_transient) || \
124 ($bucket->type == &apr_bucket_type_immortal))
128 if $bucket->type == &apr_bucket_type_heap
129 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
130 set $p = (apr_bucket_heap *)$bucket->data
131 set $data = $p->base+$bucket->start
134 if $bucket->type == &apr_bucket_type_pool
135 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
136 set $p = (apr_bucket_pool *)$bucket->data
138 set $p = (apr_bucket_heap *)$bucket->data
140 set $data = $p->base+$bucket->start
143 if $bucket->type == &apr_bucket_type_mmap
144 # is this safe if not APR_HAS_MMAP?
145 set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
146 set $p = (apr_bucket_mmap *)$bucket->data
147 set $data = ((char *)$p->mmap->mm)+$bucket->start
150 if (($bucket->type == &apr_bucket_type_transient) || \
151 ($bucket->type == &apr_bucket_type_immortal))
152 set $data = ((char *)$bucket->data)+$bucket->start
164 set $datalen = $bucket->length
170 printmemn $data $datalen
175 set $datalen = $datalen + 1
179 print_bkt_datacol "rc" "%d" $refcount $sh
181 print_bkt_datacol "rc" "n/%c" 'a' $sh
185 # 3rd-party bucket type
186 print_bkt_datacol "contents" "[**unknown**%c" ']' $sh
188 print_bkt_datacol "rc" "n/%c" 'a' $sh
199 dump_bucket_ex $arg0 0
206 set $bb = (apr_bucket_brigade *)$arg0
207 set $bucket = $bb->list.next
208 set $sentinel = ((char *)((&($bb->list)) \
209 - ((size_t) &((struct apr_bucket *)0)->link)))
210 printf "dump of brigade 0x%lx\n", (unsigned long)$bb
212 printf " | type (address) | length | "
213 printf "data addr | contents | rc\n"
214 printf "----------------------------------------"
215 printf "----------------------------------------\n"
217 if $bucket == $sentinel
218 printf "brigade is empty\n"
222 while $bucket != $sentinel
224 dump_bucket_ex $bucket 1
226 set $bucket = $bucket->link.next
228 printf "end of brigade\n"
230 document dump_brigade
231 Print bucket brigade info
237 printf "%s(0x%lx): ctx=0x%lx, r=0x%lx, c=0x%lx\n", \
238 $f->frec->name, (unsigned long)$f, (unsigned long)$f->ctx, \
243 document dump_filters
244 Print filter chain info
247 define dump_process_rec
249 printf "process_rec=0x%lx:\n", (unsigned long)$p
250 printf " pool=0x%lx, pconf=0x%lx\n", \
251 (unsigned long)$p->pool, (unsigned long)$p->pconf
253 document dump_process_rec
254 Print process_rec info
257 define dump_server_rec
259 printf "name=%s:%d\n", \
260 $s->server_hostname, $s->port
261 dump_process_rec($s->process)
263 document dump_server_rec
264 Print server_rec info
275 document dump_servers
276 Print server_rec list info