]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tools: support decoding ha_caller type exec context
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2026 16:44:50 +0000 (17:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2026 17:06:38 +0000 (18:06 +0100)
The TH_EX_CTX_CALLER type takes an ha_caller pointer which allows a
caller to mark its caller's location using MK_CALLER().

include/haproxy/tinfo-t.h
src/tools.c

index e7f0c9e4be4822eeb45795884d623b0625574158..6cd06d9834646c881e5263ae87f3588eee78ab7e 100644 (file)
@@ -80,6 +80,7 @@ enum thread_exec_ctx_type {
        TH_EX_CTX_NONE = 0,                 /* context not filled */
        TH_EX_CTX_OTHER,                    /* context only known by a generic pointer */
        TH_EX_CTX_INITCALL,                 /* the pointer is an initcall providing file:line */
+       TH_EX_CTX_CALLER,                   /* the pointer is an ha_caller of the caller providing file:line etc */
 };
 
 struct thread_exec_ctx {
@@ -88,6 +89,7 @@ struct thread_exec_ctx {
        union {
                const void *pointer;        /* generic pointer (for other) */
                const struct initcall *initcall;  /* used with TH_EX_CTX_INITCALL */
+               const struct ha_caller *ha_caller;  /* used with TH_EX_CTX_CALLER */
        };
 };
 
index 97532e2d762dd55e2a75efd26e3c4468302e0d59..39b43ba2c5712b2ce9ce61bc58d82bff75615037 100644 (file)
@@ -7522,6 +7522,13 @@ void chunk_append_thread_ctx(struct buffer *output, const struct thread_exec_ctx
                chunk_appendf(output,"ctx registered at %s:%d", slash, ctx->initcall->loc_line);
                break;
        }
+       case TH_EX_CTX_CALLER: {
+               const char *file = ctx->ha_caller->file;
+               const char *slash = strrchr(file, '/');
+               slash = slash ? slash + 1 : file;
+               chunk_appendf(output,"ctx registered at %s@%s:%d", ctx->ha_caller->func, slash, ctx->ha_caller->line);
+               break;
+       }
        default:
                chunk_appendf(output,"other ctx %p", ctx->pointer);
                break;