[Lldb-commits] [lldb] [lldb] Add step back single instruction for targets supporting reverse execution (PR #191183)

via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 10 10:14:19 PDT 2026


================
@@ -2774,6 +2782,13 @@ CommandObjectMultiwordThread::CommandObjectMultiwordThread(
                      "Defaults to current thread unless specified.",
                      nullptr, eStepTypeTrace)));
 
+  LoadSubCommand("step-back-inst",
----------------
jimingham wrote:

Once we add commands, people put them in scripts and rely on them, so it gets harder to change them.  So we shouldn't add something ad hoc here.
In the longer term, all the step commands should take a direction (and if no direction is supplied, get that from the Process's direction (GetBaseDirection).  And to make them consistent they should follow the model established in `process continue` using -F for forward and -R for backwards.

So I think we should do this right from the beginning by adding it as:

`(lldb) thread step-inst -R
`
That shouldn't be too hard.  

You can do it either of two ways.  One would be to add the RunDirection to ThreadStepScopeOptionGroup but in the option definition, make it be in a separate option group.   Then add a `bool allows_reverse` to the CommandObjectThreadStepWithTypeAndScope constructor.  If that is `true` then you add both option groups from ThreadStepScopeOptionGroup to the options for the command you are making, otherwise just add the first group.

The other would be to add another OptionGroup with -R and -F, and only add that option group if `allows_reverse` is passed in as true.  Doing it this way would allow you to share this option group with `thread continue`.

Then for this PR you'd only pass that true for thread `step-inst` for now.

https://github.com/llvm/llvm-project/pull/191183


More information about the lldb-commits mailing list