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

Uprobe support #322

Merged
merged 4 commits into from
Jan 29, 2016
Merged

Uprobe support #322

merged 4 commits into from
Jan 29, 2016

Conversation

drzaeus77
Copy link
Collaborator

This adds uprobes support in two commits.

Brenden Blanco added 2 commits January 28, 2016 10:30
The base calling convention for uprobes is the same as kprobes, but just
the path in debug/tracing/ is slightly different. Add a new API for this
and slightly refactor the code.

Signed-off-by: Brenden Blanco <[email protected]>
This adds a similar set of functions to kprobes for userspace probes.
The calling convention is different, however, since the user must
provide a library/binary name and function symbol or address. Add two
simple test cases for both.

I don't see an easy way in this api to add auto-loading support, as in
kprobe functions that start with "kprobe__". Such niceties can come
later.

Signed-off-by: Brenden Blanco <[email protected]>
@drzaeus77
Copy link
Collaborator Author

Please leave comments on the attach_uprobe calling convention. Docstring will be my first change.

@drzaeus77
Copy link
Collaborator Author

Looks like the buildbots don't support uprobes. Might need to upgrade the kernel.

import time
import unittest

## code from ctypes impl
Copy link
Member

Choose a reason for hiding this comment

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

these lines are left over?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, removed.

The calculation of function address in non-shared libraries was
incorrect. Fix it.

Signed-off-by: Brenden Blanco <[email protected]>
@drzaeus77
Copy link
Collaborator Author

@4ast this code should be ready now

return cls._lib_load_address_cache[path]

# "LOAD off 0x0000000000000000 vaddr 0x0000000000400000 paddr 0x..."
with os.popen("""/usr/bin/objdump -x %s | awk '$1 == "LOAD" && $3 ~ /^[0x]*$/ { print $5 }'""" % path) as f:
Copy link
Member

Choose a reason for hiding this comment

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

either full path to objump in both places or both without?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in next patch.

Use the full path invocation of objdump in both places.

Add a docstring for the variants of attach_retprobe.

Signed-off-by: Brenden Blanco <[email protected]>
4ast added a commit that referenced this pull request Jan 29, 2016
@4ast 4ast merged commit f7ee4e8 into master Jan 29, 2016
@4ast
Copy link
Member

4ast commented Jan 29, 2016

Nice!

@drzaeus77 drzaeus77 deleted the uprobes branch January 29, 2016 06:20
@brendangregg brendangregg mentioned this pull request Jan 29, 2016
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.

None yet

2 participants