[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)

Robert O'Callahan via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 14 02:09:14 PST 2024


rocallahan wrote:

Ok, tell me what you think of this proposal:

1) Each thread plan has a virtual `GetDirection()` method returning `RunDirection`. Existing plans other than `ThreadBasePlan` return `eRunForward`.
2) There is a per-process `base direction` flag. `ThreadBasePlan::GetDirection()` returns the value of that flag. Defaults to `eRunForward`.
3) There is a new `SBProcess::ContinueInDirection(direction)` method. This method updates the "process base direction" flag. For simplicity, for now, _if the base direction changed_, pop all plans on all threads.
4) `SBProcess::Continue()` is unchanged, i.e. preserves the base direction.
5) When we resume execution:
5a) If we choose to resume a single runnable thread whose current plan has `StopOthers()` , just resume using that plan's direction.
5b) Otherwise use the process base direction, and before resuming, pop plans until all threads' current plans match that direction.

I think this is fairly simple while behaving much like what you suggest. It doesn't require introducing a new kind of `ThreadPlan` which is good. I think it can extend cleanly to support reverse-step etc.

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


More information about the lldb-commits mailing list