From 2cd0cd84c65877faf87b30b7ee11f2377acdfd3a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 12 Mar 2026 17:44:50 +0100 Subject: [PATCH] MINOR: tools: support decoding ha_caller type exec context 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 | 2 ++ src/tools.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h index e7f0c9e4b..6cd06d983 100644 --- a/include/haproxy/tinfo-t.h +++ b/include/haproxy/tinfo-t.h @@ -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 */ }; }; diff --git a/src/tools.c b/src/tools.c index 97532e2d7..39b43ba2c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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;