Commit d10c6429 authored by Nathan Scott's avatar Nathan Scott

correct error reporting on python text compilation

The exception raised in the BPF class constructor assumed
that the "src_file" argument was used to pass eBPF code -
this is not the case for many of the tools scripts, which
tend to use "text".
Signed-off-by: default avatarNathan Scott <nathans@redhat.com>
parent 37633800
......@@ -287,6 +287,8 @@ class BPF(object):
if text:
self.module = lib.bpf_module_create_c_from_string(text.encode("ascii"),
self.debug, cflags_array, len(cflags_array))
if not self.module:
raise Exception("Failed to compile BPF text:\n%s" % text)
else:
src_file = BPF._find_file(src_file)
hdr_file = BPF._find_file(hdr_file)
......@@ -296,9 +298,8 @@ class BPF(object):
else:
self.module = lib.bpf_module_create_c(src_file.encode("ascii"),
self.debug, cflags_array, len(cflags_array))
if not self.module:
raise Exception("Failed to compile BPF module %s" % src_file)
if not self.module:
raise Exception("Failed to compile BPF module %s" % src_file)
for usdt_context in usdt_contexts:
usdt_context.attach_uprobes(self)
......
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