Commit 1b4f99e0 authored by Brenden Blanco's avatar Brenden Blanco

Fix errors on python3

parent 9911182c
...@@ -72,7 +72,7 @@ class KernelSymbolCache(object): ...@@ -72,7 +72,7 @@ class KernelSymbolCache(object):
psym = ct.pointer(sym) psym = ct.pointer(sym)
if lib.bcc_symcache_resolve(self.cache, addr, psym) < 0: if lib.bcc_symcache_resolve(self.cache, addr, psym) < 0:
return "[unknown]", 0 return "[unknown]", 0
return sym.name, sym.offset return sym.name.decode(), sym.offset
def resolve_name(self, name): def resolve_name(self, name):
addr = ct.c_ulonglong() addr = ct.c_ulonglong()
...@@ -437,11 +437,12 @@ class BPF(object): ...@@ -437,11 +437,12 @@ class BPF(object):
def _check_path_symbol(cls, module, symname, addr): def _check_path_symbol(cls, module, symname, addr):
sym = bcc_symbol() sym = bcc_symbol()
psym = ct.pointer(sym) psym = ct.pointer(sym)
if lib.bcc_resolve_symname(module, symname, addr or 0x0, psym) < 0: if lib.bcc_resolve_symname(module.encode("ascii"),
symname.encode("ascii"), addr or 0x0, psym) < 0:
if not sym.module: if not sym.module:
raise Exception("could not find library %s" % module) raise Exception("could not find library %s" % module)
raise Exception("could not determine address of symbol %s" % symname) raise Exception("could not determine address of symbol %s" % symname)
return sym.module, sym.offset return sym.module.decode(), sym.offset
@staticmethod @staticmethod
def find_library(libname): def find_library(libname):
......
...@@ -47,7 +47,7 @@ int kprobe__htab_map_lookup_elem(struct pt_regs *ctx, struct bpf_map *map, u64 * ...@@ -47,7 +47,7 @@ int kprobe__htab_map_lookup_elem(struct pt_regs *ctx, struct bpf_map *map, u64 *
stackid = stack_entries[k] stackid = stack_entries[k]
self.assertIsNotNone(stackid) self.assertIsNotNone(stackid)
stack = stack_traces[stackid].ip stack = stack_traces[stackid].ip
self.assertEqual(b.ksym(stack[0]), "htab_map_lookup_elem") self.assertEqual(b.ksym(stack[0]), b"htab_map_lookup_elem")
if __name__ == "__main__": if __name__ == "__main__":
......
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