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 rr commands to remove and move traces #3566

Merged
merged 5 commits into from
Jul 29, 2023

Conversation

vinhill
Copy link
Contributor

@vinhill vinhill commented Jul 19, 2023

As discussed in #1415, this pull request implements rr rm and rr mv commands to manage traces.

See #3558 for a similar pull request using std::filesystem that was closed because that library caused build errors.

src/MvCommand.cc Show resolved Hide resolved
src/MvCommand.cc Show resolved Hide resolved
src/util.h Outdated
* I.e. does not start with . or #, does not end with ~, is neither cpu_lock
* nor latest_trace.
*/
bool is_valid_trace_name(const std::string& entry, bool log_error=false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer using a dedicated enum instead of a bool parameters. Boolean parameters make the call site hard to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that function isn't pretty. If I understand you correctly, is_valid_trace_name(entry, TraceNameCheck::verbose) also doesn't seem best to me. Is a string* out param okay?

src/MvCommand.cc Outdated
return 1;
}

if (from_path == to_path) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to real_path(to_path) before we make this comparison?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I check that to_path doesn't exist and real_path requires an existing path.
But given from_path exists, I guess checking from_path==to_path is irrelevant.

src/MvCommand.cc Outdated Show resolved Hide resolved
src/RmCommand.cc Outdated Show resolved Hide resolved
src/TraceStream.h Outdated Show resolved Hide resolved
src/util.cc Outdated Show resolved Hide resolved
@vinhill vinhill requested a review from rocallahan July 24, 2023 20:36
Copy link
Collaborator

@rocallahan rocallahan left a comment

Choose a reason for hiding this comment

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

The rest looks fine.

src/MvCommand.cc Outdated Show resolved Hide resolved
@vinhill vinhill requested a review from rocallahan July 28, 2023 10:12
@rocallahan rocallahan merged commit 73f3156 into rr-debugger:master Jul 29, 2023
1 check passed
@rocallahan
Copy link
Collaborator

Thanks!

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