Skip to content

Commit

Permalink
Fix USDT probes arguments' encoding in Python3 (iovisor#1736)
Browse files Browse the repository at this point in the history
* Fix USDT probes arguments' encoding in Python3

Running `trace` on a binary's USDT while fetching some arguments (
`sudo python3 trace.py -p $(pidof ruby) 'u:ruby:array__create "%d",
arg1'`) fails with `argument 2: <class 'TypeError'>: wrong type`.

This PR fixes the encoding of the USDT probe name in
udst.py `get_probe_arg_ctype` function. I've tested this works on Python 2 too.
  • Loading branch information
javierhonduco authored and yonghong-song committed May 8, 2018
1 parent 4139b19 commit 42da08a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/bcc/usdt.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def get_text(self):

def get_probe_arg_ctype(self, probe_name, arg_index):
return lib.bcc_usdt_get_probe_argctype(
self.context, probe_name, arg_index)
self.context, probe_name.encode('ascii'), arg_index).decode()

def enumerate_probes(self):
probes = []
Expand Down

0 comments on commit 42da08a

Please sign in to comment.