Skip to content
Newer
Older
100644 73 lines (69 sloc) 2 KB
2917e7d @b1v1r debugging: Add start of gdb macro file, .gdbinit, to aide debugging i…
b1v1r authored May 14, 2013
1 # GDB Macros for easier debugging
2 #
3 # vim: set expandtab tabstop=4 shiftwidth=4 autoindent smartindent:
4 #
5
6 define dump_ib_list_t
7 set $node = (ib_list_node_t *)((ib_list_t *)$arg0)->head
8 set $n = ((ib_list_t *)$arg0)->nelts
9 set $i = 0
10 printf "LIST: %p length=%u\n", $arg0, $n
11 while $i < $n
12 printf "[%u] %p\n", $i, $node->data
13 set $node = $node->next
14 set $i = $i + 1
15 end
16 end
17 document dump_ib_list_t
18 dump_ib_list_t <ib_list_t *>
19 end
20
21 define dump_ib_stream_t
22 set $node = (ib_sdata_t *)((ib_stream_t *)$arg0)->head
23 set $n = ((ib_stream_t *)$arg0)->nelts
24 set $i = 0
25 printf "STREAM: %p chunks=%u length=%u\n", $arg0, $n, ((ib_stream_t *)$arg0)->slen
26 while $i < $n
27 if $node->dlen > 0
28 eval "printf \"[%%u] len=%%-5u %%.%us\\n\", $i, $node->dlen, (char *)$node->data", $node->dlen
29 else
30 printf "[%u] len=%-5u <NULL>\n", $i, $node->dlen
31 end
32 set $node = $node->next
33 set $i = $i + 1
34 end
35 end
36 document dump_ib_stream_t
37 dump_ib_stream_t <ib_stream_t *>
38 end
39
40 define dump_ib_tx_t
41 set $tx = (ib_tx_t *)$arg0
42 printf "TX: id=%s\n", $tx->id
43 printf "request_line: "
44 if $tx->request_line && $tx->request_line->raw
45 eval "printf \"%%.%us\\n\", (char *)$tx->request_line->raw->data", $tx->request_line->raw->length
46 else
47 printf "\n"
48 end
49 printf "request_headers:"
50 if $tx->request_header
51 set $node = $tx->request_header->head
52 set $n = $tx->request_header->size
53 set $i = 0
54 printf " num=%u\n", $n
55 while $i < $n
56 eval "printf \" %%.%us: %%.%us\\n\", (char *)$node->name->data, (char *)$node->value->data", $node->name->length, $node->value->length
57 set $node = $node->next
58 set $i = $i + 1
59 end
60 else
61 printf "\n"
62 end
63 printf "request_body: "
64 if $tx->request_body
65 dump_ib_stream_t $tx->request_body
66 else
67 printf "\n"
68 end
69 end
70 document dump_ib_tx_t
71 dump_ib_tx_t <ib_tx_t *>
72 end
Something went wrong with that request. Please try again.