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

[lldb] Implement CLI support for reverse-continue #132783

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rocallahan
Copy link
Contributor

@rocallahan rocallahan commented Mar 24, 2025

This introduces the options "-F/--forward" and "-R/--reverse" to process continue.

These only work if you're running with a gdbserver backend that supports reverse execution, such as rr. For testing we rely on the fake reverse-execution functionality in lldbreverse.py.

Copy link

github-actions bot commented Mar 24, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

This introduces the options "-F/--forward" and
"-R/--reverse" to `process continue`.

These only work if you're running with a gdbserver
backend that supports reverse execution, such as
rr. For testing we rely on the fake reverse-
execution functionality in `lldbreverse.py`.
@rocallahan
Copy link
Contributor Author

I suppose we need to add documentation for this but I'm not sure where...

@rocallahan
Copy link
Contributor Author

@jimingham @labath Here's a PR adding process continue --reverse and --forward. I guess it needs to add documentation somewhere under docs? I'm not sure where.

def thread_continue_forward : Option<"forward", "F">, Group<3>,
Desc<"Execute in forward direction">;
def thread_continue_reverse : Option<"reverse", "R">, Group<3>,
Desc<"Execute in forward direction">;
Copy link
Member

Choose a reason for hiding this comment

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

s/forward/reverse

@vogelsgesang
Copy link
Member

I suppose we need to add documentation for this but I'm not sure where...

Afaict, your code change should already be sufficient such that help processor continue also lists the new -F and -R flags.

In addition, I guess we would eventually want to also document more generally how to use rr with lldb (how to start the rr replay, how to connect lldb to it, etc.) such that end users are able to discover this feature. However, I guess before doing so, we would like to also implement reverse single- stepping etc.?

Copy link
Member

@vogelsgesang vogelsgesang Mar 29, 2025

Choose a reason for hiding this comment

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

We probably also want to test that

  • reverse-continue on a non-reverse-capable process gives a decent error message
  • process continue --forward also work for non-reverse-capable processes

case 'R':
if (m_base_direction == lldb::RunDirection::eRunForward) {
error = Status::FromErrorString(
"cannot specify both 'forward' and 'reverse'");
Copy link
Member

Choose a reason for hiding this comment

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

We might want to add a test case for this error condition?

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