Commit 0af31efb authored by 4ast's avatar 4ast Committed by GitHub

Merge pull request #992 from goldshtn/trace-argdist-usdt-arg

trace, argdist: Treat small USDT arguments correctly
parents 203fd276 3a5256f1
...@@ -293,9 +293,12 @@ static inline bool %s(char const *ignored, char const *str) { ...@@ -293,9 +293,12 @@ static inline bool %s(char const *ignored, char const *str) {
def _generate_usdt_arg_assignment(self, i): def _generate_usdt_arg_assignment(self, i):
expr = self.exprs[i] expr = self.exprs[i]
if self.probe_type == "u" and expr[0:3] == "arg": if self.probe_type == "u" and expr[0:3] == "arg":
return (" u64 %s = 0;\n" + arg_index = int(expr[3])
arg_ctype = self.usdt_ctx.get_probe_arg_ctype(
self.function, arg_index - 1)
return (" %s %s = 0;\n" +
" bpf_usdt_readarg(%s, ctx, &%s);\n") \ " bpf_usdt_readarg(%s, ctx, &%s);\n") \
% (expr, expr[3], expr) % (arg_ctype, expr, expr[3], expr)
else: else:
return "" return ""
......
...@@ -321,9 +321,12 @@ BPF_PERF_OUTPUT(%s); ...@@ -321,9 +321,12 @@ BPF_PERF_OUTPUT(%s);
expr = self.values[idx].strip() expr = self.values[idx].strip()
text = "" text = ""
if self.probe_type == "u" and expr[0:3] == "arg": if self.probe_type == "u" and expr[0:3] == "arg":
text = (" u64 %s = 0;\n" + arg_index = int(expr[3])
arg_ctype = self.usdt.get_probe_arg_ctype(
self.usdt_name, arg_index - 1)
text = (" %s %s = 0;\n" +
" bpf_usdt_readarg(%s, ctx, &%s);\n") \ " bpf_usdt_readarg(%s, ctx, &%s);\n") \
% (expr, expr[3], expr) % (arg_ctype, expr, expr[3], expr)
if field_type == "s": if field_type == "s":
return text + """ return text + """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment