mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-09 07:09:35 +00:00
e240be5495
These is a collection of functions I'm occasionally using to navigate in core dumps. Only working ones were extracted. Those requiring knowledge of global variables (e.g. pools, proxy list) use the one extracted from the post_mortem struct. That one is defined in post-mortem.gdb and needs to be initialized using "pm_init post_mortem" or "pm_init <pointer>". From this point a number of global variables are accessible even if symbols are missing; those ones are then used by other functions to dump streams, threads, pools, proxies etc. The files can be sourced or copy-pasted into a gdb session. It's worth trying to keep them up-to-date, as the old ones used to navigate through tasks are no longer usable due to massive changes.
22 lines
670 B
Plaintext
22 lines
670 B
Plaintext
# dump pool contents (2.9 and above, with buckets)
|
|
define pools_dump
|
|
set $h = $po
|
|
set $p = *(void **)$h
|
|
while ($p != $h)
|
|
set $e = (struct pool_head *)(((char *)$p) - (unsigned long)&((struct pool_head *)0)->list)
|
|
|
|
set $total = 0
|
|
set $used = 0
|
|
set $idx = 0
|
|
while $idx < sizeof($e->buckets) / sizeof($e->buckets[0])
|
|
set $total=$total + $e->buckets[$idx].allocated
|
|
set $used=$used + $e->buckets[$idx].used
|
|
set $idx=$idx + 1
|
|
end
|
|
|
|
set $mem = $total * $e->size
|
|
printf "list=%#lx pool_head=%p name=%s size=%u alloc=%u used=%u mem=%u\n", $p, $e, $e->name, $e->size, $total, $used, $mem
|
|
set $p = *(void **)$p
|
|
end
|
|
end
|