Skip to content

Commit 5343179

Browse files
committed
tracing/probes: Fix tracepoint event with $arg* to fetch correct argument
To hide the first dummy 'data' argument on the tracepoint probe events, the BTF argument array was modified (skip the first argument for tracepoint), but the '$arg*' meta argument parser missed that. Fix to increment the argument index if it is tracepoint probe. And decrement the index when searching the type of the argument. Link: https://lore.kernel.org/all/168657113778.3038017.12245893750241701312.stgit@mhiramat.roam.corp.google.com/ Reviewed-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent a2bd0c0 commit 5343179

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

kernel/trace/trace_probe.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,10 @@ static int parse_btf_arg(const char *varname, struct fetch_insn *code,
456456

457457
if (name && !strcmp(name, varname)) {
458458
code->op = FETCH_OP_ARG;
459-
code->param = i;
459+
if (ctx->flags & TPARG_FL_TPOINT)
460+
code->param = i + 1;
461+
else
462+
code->param = i;
460463
return 0;
461464
}
462465
}
@@ -470,8 +473,11 @@ static const struct fetch_type *parse_btf_arg_type(int arg_idx,
470473
struct btf *btf = traceprobe_get_btf();
471474
const char *typestr = NULL;
472475

473-
if (btf && ctx->params)
476+
if (btf && ctx->params) {
477+
if (ctx->flags & TPARG_FL_TPOINT)
478+
arg_idx--;
474479
typestr = type_from_btf_id(btf, ctx->params[arg_idx].type);
480+
}
475481

476482
return find_fetch_type(typestr, ctx->flags);
477483
}

0 commit comments

Comments
 (0)