Skip to content

Commit

Permalink
Merge pull request iovisor#992 from goldshtn/trace-argdist-usdt-arg
Browse files Browse the repository at this point in the history
trace, argdist: Treat small USDT arguments correctly
  • Loading branch information
4ast authored Feb 20, 2017
2 parents 203fd27 + 3a5256f commit 0af31ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions tools/argdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,12 @@ def _generate_hash_field(self, i):
def _generate_usdt_arg_assignment(self, i):
expr = self.exprs[i]
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") \
% (expr, expr[3], expr)
% (arg_ctype, expr, expr[3], expr)
else:
return ""

Expand Down
7 changes: 5 additions & 2 deletions tools/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,12 @@ def _generate_field_assign(self, idx):
expr = self.values[idx].strip()
text = ""
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") \
% (expr, expr[3], expr)
% (arg_ctype, expr, expr[3], expr)

if field_type == "s":
return text + """
Expand Down

0 comments on commit 0af31ef

Please sign in to comment.