Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-matched globbed target files for uprobe and usdt #1499

Merged
merged 5 commits into from
Sep 10, 2020

Conversation

viktormalik
Copy link
Contributor

@viktormalik viktormalik commented Sep 2, 2020

The change is pretty straightforward, it's mostly achieved by changing the form of strings returned by find_wildcard_matches for these probe types (the new form is target:function for uprobe and target:namespace:probename for usdt) and handling the new form where needed.

A noticeable behavior is for usdt probes when a process PID is specified. By default, all binaries and libraries executed by the process are searched for usdt probes. If a target path is specified along with a PID, only the binaries/libraries matching the path are searched. I wonder if this information should be put into the Reference Guide.

Resolves #1113.

Note: this change introduces usage of std::filesystem. This requires some changes, in particular adding the -lstdc++fs linker flag for some compiler versions and using GCC version 8 in Docker images (since GCC 7 does not support std::filesystem). These changes will probably be needed for #1263, too.

Checklist
  • Language changes are updated in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md
  • The new behaviour is covered by tests

@fbs
Copy link
Member

fbs commented Sep 8, 2020

Look ok! Adding std::filesystem should be fine, shame the detection has to happen like this but I don't see a better way either.

GCC version <9 and Clang (all versions) require a special linker flag to
support std::filesystem.
The default GCC versions in Bionic and Xenial do not support
std::filesystem. This change is needed so that we can start using
std::filesystem and the CI handles it.
find_wildcard_matches now returns the "path:fun" form for uprobes.

Adjust both regression and runtime tests to handle this new form.
Add a new test that tests glob expansion for binaries.
find_wildcard_matches now returns "target:namespace:probename" form for
usdt probes.

If a process PID is specified, all binaries and libraries executed by
the process should be searched for usdt probes. If a target path is
specified along with a PID, only the binaries/libraries matching the
path are searched.

Adjust regression and runtime tests to the new behavior and modify a
test for usdt wildcards to test the path wildcard, too.
One of the runtime tests must be skipped in embedded Alpine builds.
@danobi danobi merged commit f371ac9 into bpftrace:master Sep 10, 2020
@viktormalik viktormalik deleted the uprobe-usdt-glob-binaries branch September 10, 2020 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multi-matched globbed target files for uprobe and usdt
3 participants