proc,terminal: Implement reverse step, next and stepout (#1785)

* proc: move defer breakpoint code into a function

Moves the code that sets a breakpoint on the first deferred function,
used by both next and StepOut, to its function.

* proc: implement reverse step/next/stepout

When the direction of execution is reversed (on a recording) Step, Next and
StepOut will behave similarly to their forward version. However there are
some subtle interactions between their behavior, prologue skipping, deferred
calls and normal calls. Specifically:

- when stepping backwards we need to set a breakpoint on the first
  instruction after each CALL instruction, once this breakpoint is reached we
  need to execute a single StepInstruction operation to reverse step into the
  CALL.
- to insure that the prologue is skipped reverse next needs to check if it
  is on the first instruction after the prologue, and if it is behave like
  reverse stepout.
- there is no reason to set breakpoints on deferred calls when reverse
  nexting or reverse stepping out, they will never be hit.
- reverse step out should generally place its breakpoint on the CALL
  instruction that created the current stack frame (which will be the CALL
  instruction immediately preceding the instruction at the return address).
- reverse step out needs to treat panic calls and deferreturn calls
  specially.

* service,terminal: implement reverse step, next, stepout
This commit is contained in:
Alessandro Arzilli
2020-03-11 23:40:41 +01:00
committed by GitHub
parent e90a5b48ca
commit 1a9e38aa0c
17 changed files with 589 additions and 140 deletions

View File

@ -40,7 +40,9 @@ type RecordingManipulation interface {
// to the trace directory.
Recorded() (recorded bool, tracedir string)
// Direction changes execution direction.
Direction(Direction) error
ChangeDirection(Direction) error
// GetDirection returns the current direction of execution.
GetDirection() Direction
// When returns current recording position.
When() (string, error)
// Checkpoint sets a checkpoint at the current position.