Skip to content

libbpf-rs: Make func_name optional for uprobe attach#1096

Merged
danielocfb merged 2 commits intolibbpf:masterfrom
chenhengqi:optional-func-name
Feb 26, 2025
Merged

libbpf-rs: Make func_name optional for uprobe attach#1096
danielocfb merged 2 commits intolibbpf:masterfrom
chenhengqi:optional-func-name

Conversation

@chenhengqi
Copy link
Contributor

Change UprobeOpts::func_name to Option
so that user can attach uprobe to specifc offset in binary.
This would be useful for target that have symbol stripped.

Copy link
Collaborator

@d-e-s-o d-e-s-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine for the most part, thanks! Would you mind adding a test for this functionality?

Change UprobeOpts::func_name to Option<String> so that
user can attach uprobe to specifc offset in binary.
This would be useful for target that have symbol stripped.

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Add a new test case test_object_uprobe_with_func_offset()
to exercise the new functionality.

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Copy link
Collaborator

@danielocfb danielocfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the test!

@danielocfb danielocfb merged commit 3dae861 into libbpf:master Feb 26, 2025
14 checks passed
d-e-s-o added a commit to d-e-s-o/libbpf-rs that referenced this pull request Feb 26, 2025
Add a CHANGELOG entry for pull request libbpf#1096, which adjusted the
UprobeOpts::func_name member to be an Option. Also improve the
documentation for the same slightly, by covering the None case.

Signed-off-by: Daniel Müller <deso@posteo.net>
d-e-s-o added a commit that referenced this pull request Feb 26, 2025
Add a CHANGELOG entry for pull request #1096, which adjusted the
UprobeOpts::func_name member to be an Option. Also improve the
documentation for the same slightly, by covering the None case.

Signed-off-by: Daniel Müller <deso@posteo.net>
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.

3 participants