From: Willy Tarreau Date: Wed, 22 Mar 2023 10:37:54 +0000 (+0100) Subject: MINOR: debug: support dumping the libs addresses when running in verbose mode X-Git-Tag: v2.8-dev6~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ef2742a514f66f728015a8ff9123b5f64b7d887;p=thirdparty%2Fhaproxy.git MINOR: debug: support dumping the libs addresses when running in verbose mode Starting haproxy with -dL helps enumerate the list of libraries in use. But sometimes in order to go further we'd like to see their address ranges. This is already supported on the CLI's "show libs" but not on the command line where it can sometimes help troubleshoot startup issues. Let's dump them when in verbose mode. This way it doesn't change the existing behavior for those trying to enumerate libs to produce an archive. --- diff --git a/doc/management.txt b/doc/management.txt index 96bd30c3d9..36b196ff95 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -271,6 +271,9 @@ list of options is : ./haproxy -W -q -c -dL -f foo.cfg | tar -T - -hzcf archive.tgz + When started in verbose mode (-V) the shared libraries' address ranges are + also enumerated, unless the quiet mode is in use (-q). + -dM[[,]][help|options,...] : forces memory poisoning, and/or changes memory other debugging options. Memory poisonning means that each and every memory region allocated with malloc() or pool_alloc() will be filled with diff --git a/src/haproxy.c b/src/haproxy.c index 3def1ed983..852e514025 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2310,7 +2310,7 @@ static void init(int argc, char **argv) if (global.mode & MODE_DUMP_LIBS) { qfprintf(stdout, "List of loaded object files:\n"); chunk_reset(&trash); - if (dump_libs(&trash, 0)) + if (dump_libs(&trash, ((arg_mode & (MODE_QUIET|MODE_VERBOSE)) == MODE_VERBOSE))) printf("%s", trash.area); } #endif