Commit bc94d4c1 authored by Brenden Blanco's avatar Brenden Blanco

Fixup tplist and argdist for python3 compat

sys.exc_value and sys.exc_type should come from sys.exc_info()

Convert (decode) char* return values from C functions to a native python
str.
Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 977091ec
...@@ -446,7 +446,7 @@ class BPF(object): ...@@ -446,7 +446,7 @@ class BPF(object):
@staticmethod @staticmethod
def find_library(libname): def find_library(libname):
return lib.bcc_procutils_which_so(libname) return lib.bcc_procutils_which_so(libname.encode("ascii")).decode()
def attach_uprobe(self, name="", sym="", addr=None, def attach_uprobe(self, name="", sym="", addr=None,
fn_name="", pid=-1, cpu=0, group_fd=-1): fn_name="", pid=-1, cpu=0, group_fd=-1):
......
...@@ -673,8 +673,8 @@ struct __string_t { char s[%d]; }; ...@@ -673,8 +673,8 @@ struct __string_t { char s[%d]; };
except: except:
if self.args.verbose: if self.args.verbose:
traceback.print_exc() traceback.print_exc()
elif sys.exc_type is not SystemExit: elif sys.exc_info()[0] is not SystemExit:
print(sys.exc_value) print(sys.exc_info()[1])
self._close_probes() self._close_probes()
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -86,6 +86,6 @@ if __name__ == "__main__": ...@@ -86,6 +86,6 @@ if __name__ == "__main__":
else: else:
print_tracepoints() print_tracepoints()
except: except:
if sys.exc_type is not SystemExit: if sys.exc_info()[0] is not SystemExit:
print(sys.exc_value) print(sys.exc_info()[1])
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