12438N/A# gdb macros which may be useful for folks using gdb to debug
12438N/A# apache. Delete it if it bothers you.
12438N/A set $t = (apr_table_entry_t *)((apr_array_header_t *)$arg0)->elts
12438N/A set $n = ((apr_array_header_t *)$arg0)->nelts
12438N/A printf "[%u] '%s'='%s'\n", $i, $t[$i].key, $t[$i].val
12438N/A set $a = (char **)((apr_array_header_t *)$arg0)->elts
12438N/A set $n = (int)((apr_array_header_t *)$arg0)->nelts
17768N/A printf "[%u] '%s'\n", $i, $a[$i]
document dump_string_array
Print all of the elements in an array of strings.
if $arg0[$i] < 0x20 || $arg0[$i] > 0x7e
# arg3 == suppress header?
set $suppressheader = $arg3
# arg1 == suppress header?
set $bucket = (apr_bucket *)$arg0
print_bkt_datacol "bucket" "%-9s" $bucket->type->name $sh
printf "(0x%08lx)", (unsigned long)$bucket
print_bkt_datacol "length" "%-6ld" (long)($bucket->length) $sh
print_bkt_datacol "data" "0x%08lx" $bucket->data $sh
if (($bucket->type == &apr_bucket_type_eos) || \
($bucket->type == &apr_bucket_type_flush))
# metadata buckets, no content
print_bkt_datacol "contents" "%c" ' ' $sh
print_bkt_datacol "rc" "n/%c" 'a' $sh
if ($bucket->type == &ap_bucket_type_error)
# metadata bucket, no content but it does have an error code in it
print_bkt_datacol "contents" "%c" ' ' $sh
set $status = ((ap_bucket_error *)$bucket->data)->status
printf " (status=%3d) ", $status
print_bkt_datacol "rc" "n/%c" 'a' $sh
if (($bucket->type == &apr_bucket_type_file) || \
($bucket->type == &apr_bucket_type_pipe) || \
($bucket->type == &apr_bucket_type_socket))
# buckets that contain data not in memory (ie not printable)
print_bkt_datacol "contents" "[**unprintable**%c" ']' $sh
if $bucket->type == &apr_bucket_type_file
set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
print_bkt_datacol "rc" "%d" $refcount $sh
if (($bucket->type == &apr_bucket_type_heap) || \
($bucket->type == &apr_bucket_type_pool) || \
($bucket->type == &apr_bucket_type_mmap) || \
($bucket->type == &apr_bucket_type_transient) || \
($bucket->type == &apr_bucket_type_immortal))
if $bucket->type == &apr_bucket_type_heap
set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
set $p = (apr_bucket_heap *)$bucket->data
set $data = $p->base+$bucket->start
if $bucket->type == &apr_bucket_type_pool
set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
set $p = (apr_bucket_pool *)$bucket->data
set $p = (apr_bucket_heap *)$bucket->data
set $data = $p->base+$bucket->start
if $bucket->type == &apr_bucket_type_mmap
# is this safe if not APR_HAS_MMAP?
set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
set $p = (apr_bucket_mmap *)$bucket->data
set $data = ((char *)$p->mmap->mm)+$bucket->start
if (($bucket->type == &apr_bucket_type_transient) || \
($bucket->type == &apr_bucket_type_immortal))
set $data = ((char *)$bucket->data)+$bucket->start
set $datalen = $bucket->length
set $datalen = $datalen + 1
print_bkt_datacol "rc" "%d" $refcount $sh
print_bkt_datacol "rc" "n/%c" 'a' $sh
print_bkt_datacol "contents" "[**unknown**%c" ']' $sh
print_bkt_datacol "rc" "n/%c" 'a' $sh
set $bb = (apr_bucket_brigade *)$arg0
set $sentinel = ((char *)((&($bb->list)) \
- ((size_t) &((apr_bucket *)0)->link)))
printf "dump of brigade 0x%lx\n", (unsigned long)$bb
printf " | type (address) | length | "
printf "data addr | contents | rc\n"
printf "----------------------------------------"
printf "----------------------------------------\n"
printf "brigade is empty\n"
while $bucket != $sentinel
printf "end of brigade\n"
Print bucket brigade info
printf "%s(0x%lx): ctx=0x%lx, r=0x%lx, c=0x%lx\n", \
$f->frec->name, (unsigned long)$f, (unsigned long)$f->ctx, \
printf "process_rec=0x%lx:\n", (unsigned long)$p
printf " pool=0x%lx, pconf=0x%lx\n", \
(unsigned long)$p->pool, (unsigned long)$p->pconf
document dump_process_rec
$s->server_hostname, $s->port
dump_process_rec($s->process)
Print server_rec list info