mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-03-14 03:22:06 +01:00
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().
This commit is contained in:
parent
6e75da7a91
commit
2cd0cd84c6
@ -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 */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user