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

Add --save-as param to record #3787

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

theIDinside
Copy link
Contributor

This is a resend of PR ##3576 because I messed that one up @GitMensch || @rocallahan

This PR is rebased onto master and also added test cases for the feature.

--save-as specifies the trace dir name (basename?), not the full path.

Merged output_trace_dir in RecordFlags with name into new type TraceOutputPath.

Changed all usage of output_trace_dir string to use this type instead.

This PR is backwards compatible, in the sense that the old usage of the -o flag remains the same, if --save-as is not provided, i.e., will error out, if dir exists etc. If --save-as is provided together with -o the new behavior will happen instead, where the output dir will be the "root dir", thus, the user can save many traces there.

If only --save-as is provided, record uses normal behavior, of setting the trace root dir to $RR_TRACE_DIR (or it's user provided env var).

Naming of user provided dirs, follows old behavior, i.e. appending -0, -1, -2 etc to the trace dir. I think this is preferable - if some automated thing is recording something with a specific name provided, this makes it so the end user don't have to manage the file system (i.e. checking if that name is "taken" and having to do clean up before recording, etc.)

Added test cases

`--save-as` specifies the trace dir name (basename?), not the full path.

Merged `output_trace_dir` in RecordFlags with `name` into new type `TraceOutputPath`.

Changed all usage of `output_trace_dir` string to use this type instead.

This PR is backwards compatible, in the sense that the old usage
of the `-o` flag remains the same, if `--save-as` is not provided, i.e.,
will error out, if dir exists etc. If `--save-as` is provided together
with `-o` the new behavior will happen instead, where the output dir
will be the "root dir", thus, the user can save many traces there.

If only `--save-as` is provided, record uses normal behavior, of setting
the trace root dir to $RR_TRACE_DIR (or it's user provided env var).

Naming of user provided dirs, follows old behavior, i.e. appending -0,
-1, -2 etc to the trace dir. I think this is preferable - if some
automated thing is recording something with a specific name provided,
this makes it so the end user don't have to manage the file system (i.e.
checking if that name is "taken" and having to do clean up before
recording, etc.)

Added test cases
@@ -663,6 +663,12 @@ void replace_in_buffer(MemoryRange src, const uint8_t* src_data,

// Strip any directory part from the filename `s`
void base_name(std::string& s);
struct TraceOutputPath {
std::string output_trace_dir;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please carefully document these fields.

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.

2 participants