mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
MINOR: tools: decode execution context TH_EX_CTX_INITCALL
When the execution context is set to TH_EX_CTX_INITCALL, the pointer points to a valid initcall, and the decoder will show "kw registered at %s:%d" with file and line number of the initcall declaration. It's up to the caller to make the initcall pointer point to the one that was set during the initcall. The purpose here is to be able to preserve and pass that knowledge of an initcall down the chain so that future calls to functions registered via the initcall are still assigned to it.
This commit is contained in:
parent
33c928c745
commit
6e75da7a91
@ -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 */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user