-
Notifications
You must be signed in to change notification settings - Fork 588
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See new comments added to the type - are they enough?
@theIDinside can you please debug the new elements in util.h as requested and rebase, so that we may see that be integrated? |
`--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
Rebased it and added documentation to the fields |
Under what circumstances would someone want to use this feature? |
currently the default name is derived from the binary name; with |
I think the behaviour implemented in this PR is confusing. Currently the setup is relatively simple: you can override the default trace base directory (where new traces are added with their default names) with Note that you can get the effect of this PR by creating a symbolic link to the binary to record with the desired name. |
I think the following solution would work, but think something is missing:
Ideally, in each of those cases the "number suffix" is only done as a replacement (like !! or !n) with possibly more replacements (like !p for the process id under trace, if this is possible). |
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 withname
into new typeTraceOutputPath
.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