diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h index 9e0b950e1..e7f0c9e4b 100644 --- a/include/haproxy/tinfo-t.h +++ b/include/haproxy/tinfo-t.h @@ -79,6 +79,7 @@ enum { 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 */ }; struct thread_exec_ctx { @@ -86,6 +87,7 @@ struct thread_exec_ctx { /* 32-bit hole here on 64-bit platforms */ union { const void *pointer; /* generic pointer (for other) */ + const struct initcall *initcall; /* used with TH_EX_CTX_INITCALL */ }; }; diff --git a/src/tools.c b/src/tools.c index f6e1d273b..97532e2d7 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7515,6 +7515,13 @@ void chunk_append_thread_ctx(struct buffer *output, const struct thread_exec_ctx chunk_appendf(output,"%s", pfx ? pfx : ""); switch (ctx->type) { + case TH_EX_CTX_INITCALL: { + const char *file = ctx->initcall->loc_file; + const char *slash = strrchr(file, '/'); + slash = slash ? slash + 1 : file; + chunk_appendf(output,"ctx registered at %s:%d", slash, ctx->initcall->loc_line); + break; + } default: chunk_appendf(output,"other ctx %p", ctx->pointer); break;