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.
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 {
/* 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 */
};
};
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;