Commit ec679711 authored by Sasha Goldshtein's avatar Sasha Goldshtein Committed by 4ast

argdist, trace: Support naked executable names in probes (#720)

Fixes the error message from `BPF._find_exe` which would
occur if argdist or trace had a naked executable name
not qualified with a path, such as:

```
trace 'r:bash:readline "%s", retval'
```

This is now supported again.
parent 12a09dc8
...@@ -120,9 +120,9 @@ class BPF(object): ...@@ -120,9 +120,9 @@ class BPF(object):
return filename return filename
@staticmethod @staticmethod
def _find_exe(cls, bin_path): def find_exe(bin_path):
""" """
_find_exe(bin_path) find_exe(bin_path)
Traverses the PATH environment variable, looking for the first Traverses the PATH environment variable, looking for the first
directory that contains an executable file named bin_path, and directory that contains an executable file named bin_path, and
......
...@@ -379,7 +379,7 @@ int PROBENAME(struct pt_regs *ctx SIGNATURE) ...@@ -379,7 +379,7 @@ int PROBENAME(struct pt_regs *ctx SIGNATURE)
def _attach_u(self): def _attach_u(self):
libpath = BPF.find_library(self.library) libpath = BPF.find_library(self.library)
if libpath is None: if libpath is None:
libpath = BPF._find_exe(self.library) libpath = BPF.find_exe(self.library)
if libpath is None or len(libpath) == 0: if libpath is None or len(libpath) == 0:
self._bail("unable to find library %s" % self.library) self._bail("unable to find library %s" % self.library)
......
...@@ -472,7 +472,7 @@ int %s(%s) ...@@ -472,7 +472,7 @@ int %s(%s)
libpath = BPF.find_library(self.library) libpath = BPF.find_library(self.library)
if libpath is None: if libpath is None:
# This might be an executable (e.g. 'bash') # This might be an executable (e.g. 'bash')
libpath = BPF._find_exe(self.library) libpath = BPF.find_exe(self.library)
if libpath is None or len(libpath) == 0: if libpath is None or len(libpath) == 0:
self._bail("unable to find library %s" % self.library) self._bail("unable to find library %s" % self.library)
......
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