]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tools: support an execution context that is just a function
authorWilly Tarreau <w@1wt.eu>
Wed, 11 Mar 2026 07:53:37 +0000 (08:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2026 17:06:38 +0000 (18:06 +0100)
The purpose here is to be able to spot certain callbacks, such as the
SSL message callbacks, which are difficult to associate to anything.
Thus we introduce a new context type, TH_EX_CTX_FUNC, for which the
context is just the function pointed to by the void *pointer. One
difficulty with callbacks is that the allocation and release contexts
will likely be different, so the code should be properly structured
to allow proper tracking, either by instrumenting all calls, or by
making sure that the free calls are easy to spot in a report.

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

index 5dce743835fe89265f4a383398ce0c130956f144..f061a6e79d551acd434fd31e030701719b69cdf9 100644 (file)
@@ -83,6 +83,7 @@ enum thread_exec_ctx_type {
        TH_EX_CTX_CALLER,                   /* the pointer is an ha_caller of the caller providing file:line etc */
        TH_EX_CTX_SMPF,                     /* directly registered sample fetch function, using .smpf_kwl */
        TH_EX_CTX_CONV,                     /* directly registered converter function, using .conv_kwl */
+       TH_EX_CTX_FUNC,                     /* hopefully recognizable function/callback, using .pointer */
 };
 
 struct thread_exec_ctx {
index 10a9badca5cfe5309253176220441de0dab8b318..58fa78013f0d25f68ed636495dea5ef403c01c65 100644 (file)
@@ -7535,6 +7535,10 @@ void chunk_append_thread_ctx(struct buffer *output, const struct thread_exec_ctx
        case TH_EX_CTX_CONV:
                chunk_appendf(output,"conv kwl starting with '%s'", ctx->conv_kwl->kw[0].kw);
                break;
+       case TH_EX_CTX_FUNC:
+               resolve_sym_name(output, "func '", ctx->pointer);
+               chunk_appendf(output,"'");
+               break;
        default:
                chunk_appendf(output,"other ctx %p", ctx->pointer);
                break;