Skip to content

Commit

Permalink
argdist, trace: Support naked executable names in probes (iovisor#720)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
goldshtn authored and 4ast committed Oct 4, 2016
1 parent 12a09dc commit ec67971
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/python/bcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def _find_file(filename):
return filename

@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
directory that contains an executable file named bin_path, and
Expand Down
2 changes: 1 addition & 1 deletion tools/argdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def generate_text(self):
def _attach_u(self):
libpath = BPF.find_library(self.library)
if libpath is None:
libpath = BPF._find_exe(self.library)
libpath = BPF.find_exe(self.library)
if libpath is None or len(libpath) == 0:
self._bail("unable to find library %s" % self.library)

Expand Down
2 changes: 1 addition & 1 deletion tools/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def _attach_u(self, bpf):
libpath = BPF.find_library(self.library)
if libpath is None:
# 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:
self._bail("unable to find library %s" % self.library)

Expand Down

0 comments on commit ec67971

Please sign in to comment.