MINOR: debug: store important pointers in post_mortem
Dealing with a core and a stripped executable is a pain when it comes to finding pools, proxies or thread contexts. Let's put a pointer to these heads and arrays in the post_mortem struct for easier location. Other critical lists like this could possibly benefit from being added later. Here we now have: - tgroup_info - thread_info - tgroup_ctx - thread_ctx - pools - proxies Example: $ objdump -h haproxy|grep post 34 _post_mortem 000014b0 0000000000cfd400 0000000000cfd400 008fc400 2**8 (gdb) set $pm=(struct post_mortem*)0x0000000000cfd400 (gdb) p $pm->tgroup_ctx[0] $8 = { threads_harmless = 254, threads_idle = 254, stopping_threads = 0, timers = { b = {0x0, 0x0} }, niced_tasks = 0, __pad = 0xf5662c <ha_tgroup_ctx+44> "", __end = 0xf56640 <ha_tgroup_ctx+64> "" } (gdb) info thr Id Target Id Frame * 1 Thread 0x7f9e7706a440 (LWP 21169) 0x00007f9e76a9c868 in raise () from /lib64/libc.so.6 2 Thread 0x7f9e76a60640 (LWP 21175) 0x00007f9e76b343c7 in wait4 () from /lib64/libc.so.6 3 Thread 0x7f9e7613d640 (LWP 21176) 0x00007f9e76b343c7 in wait4 () from /lib64/libc.so.6 4 Thread 0x7f9e7493a640 (LWP 21179) 0x00007f9e76b343c7 in wait4 () from /lib64/libc.so.6 5 Thread 0x7f9e7593c640 (LWP 21177) 0x00007f9e76b343c7 in wait4 () from /lib64/libc.so.6 6 Thread 0x7f9e7513b640 (LWP 21178) 0x00007f9e76b343c7 in wait4 () from /lib64/libc.so.6 7 Thread 0x7f9e6ffff640 (LWP 21180) 0x00007f9e76b343c7 in wait4 () from /lib64/libc.so.6 8 Thread 0x7f9e6f7fe640 (LWP 21181) 0x00007f9e76b343c7 in wait4 () from /lib64/libc.so.6 (gdb) p/x $pm->thread_info[0].pth_id $12 = 0x7f9e7706a440 (gdb) p/x $pm->thread_info[1].pth_id $13 = 0x7f9e76a60640 (gdb) set $px = *$pm->proxies while ($px != 0) printf "%#lx %s served=%u\n", $px, $px->id, $px->served set $px = ($px)->next end 0x125eda0 GLOBAL served=0 0x12645b0 stats served=0 0x1266940 comp served=0 0x1268e10 comp_bck served=0 0x1260cf0 <OCSP-UPDATE> served=0 0x12714c0 <HTTPCLIENT> served=0
This commit is contained in:
parent
93c3f2a0b4
commit
e5fccfe0b6
14
src/debug.c
14
src/debug.c
|
@ -45,6 +45,7 @@
|
|||
#include <haproxy/log.h>
|
||||
#include <haproxy/net_helper.h>
|
||||
#include <haproxy/sc_strm.h>
|
||||
#include <haproxy/proxy.h>
|
||||
#include <haproxy/stconn.h>
|
||||
#include <haproxy/task.h>
|
||||
#include <haproxy/thread.h>
|
||||
|
@ -149,6 +150,12 @@ struct post_mortem {
|
|||
/* information about dynamic shared libraries involved */
|
||||
char *libs; // dump of one addr / path per line, or NULL
|
||||
#endif
|
||||
struct tgroup_info *tgroup_info; // pointer to ha_tgroup_info
|
||||
struct thread_info *thread_info; // pointer to ha_thread_info
|
||||
struct tgroup_ctx *tgroup_ctx; // pointer to ha_tgroup_ctx
|
||||
struct thread_ctx *thread_ctx; // pointer to ha_thread_ctx
|
||||
struct list *pools; // pointer to the head of the pools list
|
||||
struct proxy **proxies; // pointer to the head of the proxies list
|
||||
|
||||
/* info about identified distinct components (executable, shared libs, etc).
|
||||
* These can be all listed at once in gdb using:
|
||||
|
@ -2543,6 +2550,13 @@ static int feed_post_mortem()
|
|||
post_mortem.libs = strdup(trash.area);
|
||||
#endif
|
||||
|
||||
post_mortem.tgroup_info = ha_tgroup_info;
|
||||
post_mortem.thread_info = ha_thread_info;
|
||||
post_mortem.tgroup_ctx = ha_tgroup_ctx;
|
||||
post_mortem.thread_ctx = ha_thread_ctx;
|
||||
post_mortem.pools = &pools;
|
||||
post_mortem.proxies = &proxies_list;
|
||||
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue