]> granicus.if.org Git - apache/blobdiff - .gdbinit
update transformation
[apache] / .gdbinit
index 124255f41156da77a28e10066a196dbdd2135d6d..6194156dd27f65c9353200c650209fb8630c60d1 100644 (file)
--- a/.gdbinit
+++ b/.gdbinit
@@ -6,7 +6,11 @@ define dump_table
     set $n = ((apr_array_header_t *)$arg0)->nelts
     set $i = 0
     while $i < $n
-       printf "[%u] '%s'='%s'\n", $i, $t[$i].key, $t[$i].val
+       if $t[$i].val == (void *)0L
+          printf "[%u] '%s'=>NULL\n", $i, $t[$i].key
+       else
+          printf "[%u] '%s'='%s'\n", $i, $t[$i].key, $t[$i].val
+       end
        set $i = $i + 1
     end
 end
@@ -14,9 +18,38 @@ document dump_table
     Print the key/value pairs in a table.
 end
 
+define dump_string_hash
+    set $h = $arg0->array
+    set $n = $arg0->max
+    set $i = 0
+    while $i < $n
+        set $ent = $h[$i]       
+        while $ent != (void *)0L
+            printf "'%s' => '%p'\n", $ent->key, $ent->val
+            set $ent = $ent->next
+        end
+       set $i = $i + 1
+    end
+end
+document dump_string_hash
+    Print the entries in a hash table indexed by strings
+end
 
-define rh
-       run -f /home/dgaudet/ap2/conf/mpm.conf
+define dump_string_shash
+    set $h = $arg0->array
+    set $n = $arg0->max
+    set $i = 0
+    while $i < $n
+        set $ent = $h[$i]       
+        while $ent != (void *)0L
+            printf "'%s' => '%s'\n", $ent->key, $ent->val
+            set $ent = $ent->next
+        end
+       set $i = $i + 1
+    end
+end
+document dump_string_shash
+    Print the entries in a hash table indexed by strings with string values
 end
 
 define ro
@@ -68,7 +101,7 @@ end
 define dump_bucket_ex
     # arg0 == bucket
     # arg1 == suppress header?
-    set $bucket = (apr_bucket *)$arg0
+    set $bucket = (struct apr_bucket *)$arg0
     set $sh = $arg1
     set $refcount = -1
 
@@ -106,6 +139,7 @@ define dump_bucket_ex
         # buckets that contain data not in memory (ie not printable)
 
         print_bkt_datacol "contents" "[**unprintable**%c" ']' $sh
+        printf "     "
         if $bucket->type == &apr_bucket_type_file
             set $refcount = ((apr_bucket_refcount *)$bucket->data)->refcount
             print_bkt_datacol "rc" "%d" $refcount $sh
@@ -201,7 +235,7 @@ define dump_brigade
     set $bb = (apr_bucket_brigade *)$arg0
     set $bucket = $bb->list.next
     set $sentinel = ((char *)((&($bb->list)) \
-                               - ((size_t) &((apr_bucket *)0)->link)))
+                               - ((size_t) &((struct apr_bucket *)0)->link)))
     printf "dump of brigade 0x%lx\n", (unsigned long)$bb
 
     printf "   | type     (address)    | length | "
@@ -270,3 +304,30 @@ end
 document dump_servers
     Print server_rec list info
 end
+
+define dump_allocator
+    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 $i = 0
+    set $max =(sizeof $arg0->free)/(sizeof $arg0->free[0])
+    while $i < $max
+        set $node = $arg0->free[$i]
+        if $node != 0
+            printf " #%2d: ", $i
+            while $node != 0
+                printf "%d, ", $node->endp - $node->first_avail
+                set $node = $node->next
+            end
+            printf "ends.\n"
+        end
+        set $i = $i + 1
+    end
+end
+document dump_allocator
+    Print status of an allocator and its freelists.
+end
+
+# Set sane defaults for common signals:
+handle SIGPIPE noprint pass nostop
+handle SIGUSR1 print pass nostop