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

Control arguments and return values at runtime #1647

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

clementguidi
Copy link
Contributor

These changes give the user full control over the argument and return value
collection at runtime.

We can use the -A/--argument option from the client to collect new argument
values in the trace, or change existing specifications. We can use the
-R/--retval option from the client to collect new return values in the trace,
or change existing specifications. And we can use the -a/--auto-args option
from the client to collect all arguments and return values.

Example:

$ uftrace --agent record my-program
$ uftrace -p $(pidof my-program) -A func@arg1
$ uftrace -p $(pidof my-program) -R func@retval
$ uftrace -p $(pidof my-program) -a

Based on #1646.

@clementguidi
Copy link
Contributor Author

clementguidi commented Mar 6, 2023

Test 286 fails with optimizations enabled, because they interfere with the auto-args. Do you suggest a way to deal with this?

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Use the =-A/--argument= option from the client to collect new argument
values in the trace, or change existing specifications.

Example:
$ uftrace --agent record my-program
$ uftrace -p $(pidof my-program) -A func@arg1
$ uftrace -p $(pidof my-program) -A func@arg2

This will add the values of 'arg1' and then 'arg2' for function 'func' to the
trace data.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Use the =-R/--retval= option from the client to collect new return
values in the trace, or change existing specifications.

Example:
$ uftrace --agent record my-program
$ uftrace -p $(pidof my-program) -R func@retval

This will add the value of the 'func' function's return value to the trace data.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Start collecting all arguments and return values in trace data at runtime. Use
automatic spec definitions.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Argument and return value collection require specs to be defined so libmcount
knows how to format them. The specs are usually defined at start-up. The
definitions will be missing if they are not setup from the start.

This commit allows to setup auto-args and prepare debug information at runtime.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
The parent uftrace instance is in charge of saving trace data and metadata. But
it is now aware of the debug information that the agent saves inside libmcount
at runtime.

We fetch these data from the target process when libmcount exits.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
Test collecting new arguments and return values at runtime.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
@clementguidi clementguidi marked this pull request as ready for review June 16, 2023 18:40
@clementguidi clementguidi marked this pull request as draft July 7, 2023 19:42
@clementguidi
Copy link
Contributor Author

I'll stop stop on this feature for now. Changing arg/retval spec at runtime requires a more elaborate data format.

I plan to work on session control at runtime, i.e. initiating and finishing recording sessions without terminating the target process (e.g. if the target is a daemon). Then each session can have different arg/retval specs, which solves the problem in this particular use case (multiple sessions).

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

1 participant