5488N/A# gdb macros which may be useful for folks using gdb to debug
5488N/A# apache. Delete it if it bothers you.
5488N/A set $t = (apr_table_entry_t *)((apr_array_header_t *)$arg0)->elts
5488N/A set $n = ((apr_array_header_t *)$arg0)->nelts
5488N/A if $t[$i].val == (void *)0L
5488N/A printf "[%u] '%s'=>NULL\n", $i, $t[$i].key
5488N/A printf "[%u] '%s'='%s' [%p]\n", $i, $t[$i].key, $t[$i].val, $t[$i].val
6083N/A set $sl = (apr_skiplist *)$arg0
5488N/A printf "skiplist@%p: size=%lu: height=%d\n", $sl, $sl->size, $sl->height
5488N/A printf "(%p,%.12lx)", $m, $m->data
6083N/A printf " (%p,%.12lx)", $u, $u->data
6083N/A printf "'%s' => '%p'\n", $ent->key, $ent->val
5502N/A Print the entries in a hash table indexed by strings
5488N/A printf "'%s' => '%s'\n", $ent->key, $ent->val
5488N/A Print the entries in a hash table indexed by strings with string values
5488N/A set $a = (char **)((apr_array_header_t *)$arg0)->elts
5488N/A set $n = (int)((apr_array_header_t *)$arg0)->nelts
5488N/A printf "[%u] '%s'\n", $i, $a[$i]
5488N/A Print all of the elements in an array of strings.
5488N/A if $arg0[$i] < 0x20 || $arg0[$i] > 0x7e
5488N/A set $suppressheader = $arg3
5488N/A set $bucket = (struct apr_bucket *)$arg0
5488N/A print_bkt_datacol "bucket" "%-9s" $bucket->type->name $sh
5488N/A printf "(0x%08lx)", (unsigned long)$bucket
5488N/A print_bkt_datacol "length" "%-6ld" (long)($bucket->length) $sh
5488N/A print_bkt_datacol "data" "0x%08lx" $bucket->data $sh
5488N/A if (($bucket->type == &apr_bucket_type_eos) || \
5695N/A ($bucket->type == &apr_bucket_type_flush))
5488N/A # metadata buckets, no content
5488N/A print_bkt_datacol "contents" "%c" ' ' $sh
5488N/A print_bkt_datacol "rc" "n/%c" 'a' $sh
5488N/A if ($bucket->type == &ap_bucket_type_error)
5488N/A # metadata bucket, no content but it does have an error code in it
5695N/A print_bkt_datacol "contents" "%c" ' ' $sh
5488N/A set $status = ((ap_bucket_error *)$bucket->data)->status
5488N/A printf " (status=%3d) ", $status
5488N/A print_bkt_datacol "rc" "n/%c" 'a' $sh
5488N/A if (($bucket->type == &apr_bucket_type_file) || \
5488N/A ($bucket->type == &apr_bucket_type_pipe) || \
5488N/A ($bucket->type == &apr_bucket_type_socket))
5488N/A # buckets that contain data not in memory (ie not printable)
5488N/A print_bkt_datacol "contents" "[**unprintable**%c" ']' $sh
5488N/A if $bucket->type == &apr_bucket_type_file
5488N/A set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
5488N/A print_bkt_datacol "rc" "%d" $refcount $sh
5488N/A if (($bucket->type == &apr_bucket_type_heap) || \
5488N/A ($bucket->type == &apr_bucket_type_pool) || \
5488N/A ($bucket->type == &apr_bucket_type_mmap) || \
5488N/A ($bucket->type == &apr_bucket_type_transient) || \
5488N/A ($bucket->type == &apr_bucket_type_immortal))
5488N/A if $bucket->type == &apr_bucket_type_heap
5488N/A set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
5488N/A set $p = (apr_bucket_heap *)$bucket->data
5488N/A set $data = $p->base+$bucket->start
5488N/A if $bucket->type == &apr_bucket_type_pool
5488N/A set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
5488N/A set $p = (apr_bucket_pool *)$bucket->data
5488N/A set $p = (apr_bucket_heap *)$bucket->data
5488N/A set $data = $p->base+$bucket->start
5488N/A if $bucket->type == &apr_bucket_type_mmap
6083N/A # is this safe if not APR_HAS_MMAP?
5488N/A set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
5488N/A set $p = (apr_bucket_mmap *)$bucket->data
6021N/A 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) &((struct 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, \
set $f = $r->output_filters
if $f == $r->output_filters
printf "r->output_filters =>\n"
if $f == $r->proto_output_filters
printf "r->proto_output_filters =>\n"
if $f == $r->connection->output_filters
printf "r->connection->output_filters =>\n"
printf " %s(0x%lx): type=%d, ctx=0x%lx, r=%s(0x%lx), c=0x%lx\n", \
$f->frec->name, (unsigned long)$f, $f->frec->ftype, (unsigned long)$f->ctx, \
$f->r == $r ? "r" : ($f->r == 0L ? "null" : \
($f->r == $r->main ? "r->main" : \
($r->main && $f->r == $r->main->main ? "r->main->main" : "????"))), \
document dump_filter_chain
Print filter chain info given a request_rec pointer
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
printf "r=(0x%lx): uri=%s, handler=%s, r->main=0x%lx\n", \
$r, $r->unparsed_uri, $r->handler ? $r->handler : "(none)", $r->main
printf "Allocator current_free_index = %d, max_free_index = %d\n", \
($arg0)->current_free_index, ($arg0)->max_free_index
printf "Allocator free list:\n"
set $max =(sizeof $arg0->free)/(sizeof $arg0->free[0])
set $node = $arg0->free[$i]
printf "%d, ", 4096 << $node->index
set $kb = $kb + (4 << $node->index)
printf "Sum of free blocks: %dkiB\n", $kb
Print status of an allocator and its freelists.
set $node = $arg0->active
set $size = $size + (4096 << $node->index)
set $free = $free + ($node->endp - $node->first_avail)
if $node == $arg0->active
printf "Pool '%s' [%p]: %d/%d free (%d blocks)\n", $p->tag, $p, $free, $size, $nodes
# Set sane defaults for common signals:
handle SIGPIPE noprint pass nostop
handle SIGUSR1 print pass nostop