MINOR: debug: add features and build options to "show dev"
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Jan 2024 10:08:04 +0000 (11:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Jan 2024 18:07:51 +0000 (19:07 +0100)
The "show dev" CLI command is still missing useful elements such as the
build options, SSL version etc. Let's just add the build features and
the build options there so that it's possible to collect all of this
from a running process without having to start the executable with -vv.

This is still dumped all at once from the parsing function since the
output is small. If it were to grow, this would possibly require to be
reworked to support a context.

It might be helpful to backport this to 2.9 since it can help narrow
down certain issues.

(cherry picked from commit 9d869b10dea0f4234eb14787f658d6b64a0a4021)
Signed-off-by: Willy Tarreau <w@1wt.eu>

src/debug.c

index 049b911..040c23a 100644 (file)
@@ -493,11 +493,20 @@ static int debug_parse_cli_show_libs(char **args, char *payload, struct appctx *
 /* parse a "show dev" command. It returns 1 if it emits anything otherwise zero. */
 static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *appctx, void *private)
 {
+       const char **build_opt;
+
        if (*args[2])
                return cli_err(appctx, "This command takes no argument.\n");
 
        chunk_reset(&trash);
 
+       chunk_appendf(&trash, "Features\n  %s\n", build_features);
+
+       chunk_appendf(&trash, "Build options\n");
+       for (build_opt = NULL; (build_opt = hap_get_next_build_opt(build_opt)); )
+               if (append_prefixed_str(&trash, *build_opt, "  ", '\n', 0) == 0)
+                       chunk_strcat(&trash, "\n");
+
        chunk_appendf(&trash, "Platform info\n");
        if (*post_mortem.platform.hw_vendor)
                chunk_appendf(&trash, "  machine vendor: %s\n", post_mortem.platform.hw_vendor);