summaryrefslogtreecommitdiffstats
path: root/.gdbinit
blob: 28244c75b214329e29b73e69869a195dac672cbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# gdb macros which may be useful for folks using gdb to debug
# apache.  Delete it if it bothers you.

define dump_table
    set $t = (apr_table_entry_t *)((apr_array_header_t *)$arg0)->elts
    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
	set $i = $i + 1
    end
end
document dump_table
    Print the key/value pairs in a table.
end


define rh
	run -f /home/dgaudet/ap2/conf/mpm.conf
end

define ro
	run -DONE_PROCESS
end

define dump_string_array
    set $a = (char **)((apr_array_header_t *)$arg0)->elts
    set $n = (int)((apr_array_header_t *)$arg0)->nelts
    set $i = 0
    while $i < $n
	printf "[%u] '%s'\n", $i, $a[$i]
	set $i = $i + 1
    end
end
document dump_string_array
    Print all of the elements in an array of strings.
end

define dump_bucket
    set $bucket = $arg0
    printf "bucket=%s(0x%lx), length=%ld, data=0x%lx\n", \
            $bucket->type->name, \
            (unsigned long)$bucket, (long)$bucket->length, \
            (unsigned long)$bucket->data
end
document dump_bucket
    Print bucket info
end

define dump_brigade
    set $bb = $arg0
    set $bucket = ((&((apr_bucket_brigade *)$bb)->list))->next
    set $sentinel = ((char *)((&(((apr_bucket_brigade *)$bb)->list)) \
                               - ((size_t) &((struct apr_bucket *)0)->link)))
    set $i = 0

    printf "dump of brigade 0x%lx\n", (unsigned long)$bb
    if $bucket == $sentinel
        printf "brigade is empty\n"
    end

    while $bucket != $sentinel
        printf "   %d: bucket=%s(0x%lx), length=%ld, data=0x%lx\n", \
                $i, $bucket->type->name, \
                (unsigned long)$bucket, (long)$bucket->length, \
                (unsigned long)$bucket->data
        set $i = $i + 1
        set $bucket = $bucket->link.next
    end
end
document dump_brigade
    Print bucket brigade info
end

define dump_filters
    set $f = $arg0
    while $f
        printf "%s(0x%lx): ctx=0x%lx, r=0x%lx, c=0x%lx\n", \
        $f->frec->name, (unsigned long)$f, (unsigned long)$f->ctx, \
        $f->r, $f->c
        set $f = $f->next
    end
end
document dump_filters
    Print filter chain info
end

define dump_process_rec
    set $p = $arg0
    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
end
document dump_process_rec
    Print process_rec info
end

define dump_server_rec
    set $s = $arg0
    printf "name=%s:%d\n", \
            $s->server_hostname, $s->port
    dump_process_rec($s->process)
end
document dump_server_rec
    Print server_rec info
end

define dump_servers
    set $s = $arg0
    while $s
        dump_server_rec($s)
        printf "\n"
        set $s = $s->next
    end
end
document dump_servers
    Print server_rec list info
end