MINOR: debug: dump the mapping of the libs into post_mortem

Having the libs and their addresses listed in the post_mortem struct
is also helpful. Sometimes it helps notice that one version is not the
expected one, e.g. due to some LD_LIBRARY_PATH. We don't emit it on
"show dev" however since that's already available via "show libs".
This commit is contained in:
Willy Tarreau 2023-11-23 08:26:52 +01:00
parent 37e3dd718c
commit a88a3482b5

View File

@ -106,6 +106,11 @@ struct post_mortem {
} thread_info[MAX_THREADS];
#endif
} process;
#if defined(HA_HAVE_DUMP_LIBS)
/* information about dynamic shared libraries involved */
char *libs; // dump of one addr / path per line, or NULL
#endif
} post_mortem ALIGNED(256) = { };
/* Points to a copy of the buffer where the dump functions should write, when
@ -2147,11 +2152,26 @@ static int feed_post_mortem()
if (strcmp(post_mortem.platform.utsname.sysname, "Linux") == 0)
feed_post_mortem_linux();
#if defined(HA_HAVE_DUMP_LIBS)
chunk_reset(&trash);
if (dump_libs(&trash, 1))
post_mortem.libs = strdup(trash.area);
#endif
return ERR_NONE;
}
REGISTER_POST_CHECK(feed_post_mortem);
static void deinit_post_mortem(void)
{
#if defined(HA_HAVE_DUMP_LIBS)
ha_free(&post_mortem.libs);
#endif
}
REGISTER_POST_DEINIT(deinit_post_mortem);
#ifdef USE_THREAD
/* init code is called one at a time so let's collect all per-thread info on
* the last starting thread. These info are not critical anyway and there's no