58
URDB: A Universal Reversible Debugger Based on Decomposing Debugging Histories Ana-Maria Visan Kapil Arya Gene Cooperman Tyler Denniston Northeastern University {amvisan,kapil,gene,tyler}@ccs.neu.edu October 23, 2011

URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB: A Universal Reversible Debugger Based onDecomposing Debugging Histories

Ana-Maria Visan Kapil Arya Gene CoopermanTyler Denniston

Northeastern University{amvisan,kapil,gene,tyler}@ccs.neu.edu

October 23, 2011

Page 2: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Your Typical Debugging Session

Launch program −→ Fault −→ Bug

Why is it so frustrating and time consuming?

I Analyze the bug near the errorI Produce a hypothesis about the cause of the bugI Restart the program from the beginning

Wouldn’t it be great to be able to go backwards?

Page 3: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Your Typical Debugging Session

Launch program −→ Fault −→ Bug

Why is it so frustrating and time consuming?

I Analyze the bug near the errorI Produce a hypothesis about the cause of the bugI Restart the program from the beginning

Wouldn’t it be great to be able to go backwards?

Page 4: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Your Typical Debugging Session

Launch program −→ Fault −→ Bug

Why is it so frustrating and time consuming?

I Analyze the bug near the errorI Produce a hypothesis about the cause of the bugI Restart the program from the beginning

Wouldn’t it be great to be able to go backwards?

Page 5: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Your Typical Debugging Session

Launch program −→ Fault −→ Bug

Why is it so frustrating and time consuming?

I Analyze the bug near the errorI Produce a hypothesis about the cause of the bugI Restart the program from the beginning

Wouldn’t it be great to be able to go backwards?

Page 6: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Your Typical Debugging Session

Launch program −→ Fault −→ Bug

Why is it so frustrating and time consuming?

I Analyze the bug near the errorI Produce a hypothesis about the cause of the bugI Restart the program from the beginning

Wouldn’t it be great to be able to go backwards?

Page 7: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Introducing URDB

URDB is a universal reversible debugger based on:I checkpointI restartI re-execution of debugging historiesI decomposing of debugging histories

Page 8: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Introducing URDB

URDB is a universal reversible debugger based on:I checkpointI restartI re-execution of debugging historiesI decomposing of debugging histories

Page 9: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Introducing URDB

URDB is a universal reversible debugger based on:I checkpointI restartI re-execution of debugging historiesI decomposing of debugging histories

Page 10: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Introducing URDB

URDB is a universal reversible debugger based on:I checkpointI restartI re-execution of debugging historiesI decomposing of debugging histories

Page 11: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Introducing URDB

URDB is a universal reversible debugger based on:I checkpointI restartI re-execution of debugging historiesI decomposing of debugging histories

Page 12: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB: The Novelty

I Universality, placing the user within the framework of a familiardebugger (GDB/Python/MATLAB/Perl)(Reversibility can be added in less than a day)

I The decomposition algorithms for manipulating a history ofdebugging primitives

I Transparent checkpointing of GDB sessions in DMTCP(Distributed MultiThreaded CheckPointing)

Page 13: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB: The Novelty

I Universality, placing the user within the framework of a familiardebugger (GDB/Python/MATLAB/Perl)(Reversibility can be added in less than a day)

I The decomposition algorithms for manipulating a history ofdebugging primitives

I Transparent checkpointing of GDB sessions in DMTCP(Distributed MultiThreaded CheckPointing)

Page 14: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB: The Novelty

I Universality, placing the user within the framework of a familiardebugger (GDB/Python/MATLAB/Perl)(Reversibility can be added in less than a day)

I The decomposition algorithms for manipulating a history ofdebugging primitives

I Transparent checkpointing of GDB sessions in DMTCP(Distributed MultiThreaded CheckPointing)

Page 15: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB: The Architecture

URDB

user

usercommands

a.out

gdb

commands

restartcheckpoint

gdb

packageDMTCP ckpt

Page 16: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

DMTCP: checkpointing an entire GDB session

ptrace is a system call that allows a superior process (e.g. GDB) totrace an inferior process (target application) at the binary level.

Why is this difficult?The inferior process is normally being traced by GDB.

During a checkpoint, DMTCP has control, and not GDB.

DMTCP then arranges for GDB to resume tracing the inferior processat the time of resume or restart.

Page 17: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

DMTCP: checkpointing an entire GDB session

ptrace is a system call that allows a superior process (e.g. GDB) totrace an inferior process (target application) at the binary level.

Why is this difficult?The inferior process is normally being traced by GDB.

During a checkpoint, DMTCP has control, and not GDB.

DMTCP then arranges for GDB to resume tracing the inferior processat the time of resume or restart.

Page 18: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

DMTCP: checkpointing an entire GDB session

ptrace is a system call that allows a superior process (e.g. GDB) totrace an inferior process (target application) at the binary level.

Why is this difficult?The inferior process is normally being traced by GDB.

During a checkpoint, DMTCP has control, and not GDB.

DMTCP then arranges for GDB to resume tracing the inferior processat the time of resume or restart.

Page 19: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

DMTCP: checkpointing an entire GDB session

ptrace is a system call that allows a superior process (e.g. GDB) totrace an inferior process (target application) at the binary level.

Why is this difficult?The inferior process is normally being traced by GDB.

During a checkpoint, DMTCP has control, and not GDB.

DMTCP then arranges for GDB to resume tracing the inferior processat the time of resume or restart.

Page 20: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Debugging Primitives and Their Reverse Analogs

I step: enter a function callI next: do not enter any function callsI continue: until next breakpointI finish: until end of function

breakpoint

reverse−finishfunction 1

function 2

time

reverse−next

forward execution

reverse execution

continuereverse−

stepreverse−

Page 21: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Debugging Primitives and Their Reverse Analogs

I step: enter a function callI next: do not enter any function callsI continue: until next breakpointI finish: until end of function

reverse−step

breakpointfunction 1

function 2

time

reverse−next

forward execution

reverse execution

continuereverse−

reverse−finish

Page 22: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Debugging Primitives and Their Reverse Analogs

I step: enter a function callI next: do not enter any function callsI continue: until next breakpointI finish: until end of function

reverse−step

breakpoint

reverse−finishfunction 1

function 2

time

reverse−next

forward execution

reverse execution

reverse−continue

Page 23: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Debugging Primitives and Their Reverse Analogs

I step: enter a function callI next: do not enter any function callsI continue: until next breakpointI finish: until end of function

reverse−step

breakpointfunction 1

function 2

time

reverse−next

forward execution

reverse execution

continuereverse−

reverse−finish

Page 24: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

When a Reverse Command is Issued ...

Prerequisites

I checkpoint CI debugging history h

Algorithmrestart from checkpoint Cnew_h −→ decomposition_algorithm(h)/* new_h is the decomposed debugging history */restart from checkpoint Cre-execute new_h, minus the last command

Page 25: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB: An Example

reverse-step([step, next, step]) −→ [step, next]

reverse-step([continue, next]) −→ ?

Page 26: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB: An Example

reverse-step([step, next, step]) −→ [step, next]

reverse-step([continue, next]) −→ ?

Page 27: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, next]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 28: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 29: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 30: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next, next]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 31: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next, next]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 32: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 33: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next, step]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 34: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next, step]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 35: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next, step]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 36: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 37: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-step

[continue, step, next, …, next]

while True doif last command is continue or next/bkpt then

undo_command()do_step()while we are not at breakpoint do

do_next()else if last command is step then

undo_command()break

else /* last command is next */undo_command()do_step()while deeper() do

do_next()

Page 38: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Multiple Checkpoints

UsefulnessTo reduce the cost of replaying histories.

Core IdeaI If the decomposed debugging history is currently empty, then one

reverts to the earlier checkpoint and its debugging history.I Future Work: extra checkpoints will be taken automatically.

Page 39: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Multiple Checkpoints

UsefulnessTo reduce the cost of replaying histories.

Core IdeaI If the decomposed debugging history is currently empty, then one

reverts to the earlier checkpoint and its debugging history.I Future Work: extra checkpoints will be taken automatically.

Page 40: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB Timings Across Debuggers

The test program inserts (via a function call) twenty numbers into alinked list.

Command gdb-7.2 MATLAB Perl Pythoncheckpoint 1.86s 2.02s 0.17s 0.18srestart 1.20s 1.65s 0.20s 0.17sreverse-next 20.44s 21.61s 16.75s 12.93sreverse-step 22.14s 18.40s 16.42s 12.80sreverse-continue 7.78s 7.43s 5.77s 5.62sreverse-finish 3.67s 1.86s 0.88s 0.78s

Page 41: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB Timings Across Debuggers

The test program inserts (via a function call) twenty numbers into alinked list.

Command gdb-7.2 MATLAB Perl Pythoncheckpoint 1.86s 2.02s 0.17s 0.18srestart 1.20s 1.65s 0.20s 0.17sreverse-next 20.44s 21.61s 16.75s 12.93sreverse-step 22.14s 18.40s 16.42s 12.80sreverse-continue 7.78s 7.43s 5.77s 5.62sreverse-finish 3.67s 1.86s 0.88s 0.78s

Page 42: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB versus gdb-7.2

I Test program: a C program that inserts 1,000,000 elements into alinked list (the program allocated its own memory and avoided theuse of C malloc).

I URDB was 5,200 times faster than the target record mode ofgdb-7.2!

I gdb-7.2: the reverse time depends on the number of reverse stepsexecuted.

I URDB: the reverse time depends on the number of forwardinstructions from the last checkpoint.

Page 43: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB versus gdb-7.2

I Test program: a C program that inserts 1,000,000 elements into alinked list (the program allocated its own memory and avoided theuse of C malloc).

I URDB was 5,200 times faster than the target record mode ofgdb-7.2!

I gdb-7.2: the reverse time depends on the number of reverse stepsexecuted.

I URDB: the reverse time depends on the number of forwardinstructions from the last checkpoint.

Page 44: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB versus gdb-7.2

I Test program: a C program that inserts 1,000,000 elements into alinked list (the program allocated its own memory and avoided theuse of C malloc).

I URDB was 5,200 times faster than the target record mode ofgdb-7.2!

I gdb-7.2: the reverse time depends on the number of reverse stepsexecuted.

I URDB: the reverse time depends on the number of forwardinstructions from the last checkpoint.

Page 45: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

URDB versus gdb-7.2

I Test program: a C program that inserts 1,000,000 elements into alinked list (the program allocated its own memory and avoided theuse of C malloc).

I URDB was 5,200 times faster than the target record mode ofgdb-7.2!

I gdb-7.2: the reverse time depends on the number of reverse stepsexecuted.

I URDB: the reverse time depends on the number of forwardinstructions from the last checkpoint.

Page 46: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Related Work: 4 previous approaches

(1) Record/Reverse-execute via logging the state of eachinstruction

I Grishman, AFIPS, 1970I Zelkowitz, Communications of the ACM, 1973I Tolmach and Appel, LFP, 1990I TotalViewI gdb-7.2

(2) Record/Replay via virtual machine snapshots

I King, Dunlap, and Chen, USENIX, 2005

Page 47: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Related Work: 4 previous approaches

(1) Record/Reverse-execute via logging the state of eachinstruction

I Grishman, AFIPS, 1970I Zelkowitz, Communications of the ACM, 1973I Tolmach and Appel, LFP, 1990I TotalViewI gdb-7.2

(2) Record/Replay via virtual machine snapshots

I King, Dunlap, and Chen, USENIX, 2005

Page 48: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Related Work: 4 previous approaches

(3) Checkpoint/Re-execute via live checkpoints

I Feldman and Brown, SIGPLAN Notices, 1989I Srinivasan, Kandula, Andrews, and Zhou, USENIX, 2004I Leroy, Doligez, Garrigue, Rémy, and Vouillon, OCaml 3.11, 2008I Boothe, PLDI, 2000

(4) Post-mortem debugging via logging of events to a database

I Pothier, Tanter, and Piquer, OOPSLA, 2007I Lefebvre, Cully, Feeley, Hutchinson, and Warfield, EuroSys, 2009

Page 49: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Related Work: 4 previous approaches

(3) Checkpoint/Re-execute via live checkpoints

I Feldman and Brown, SIGPLAN Notices, 1989I Srinivasan, Kandula, Andrews, and Zhou, USENIX, 2004I Leroy, Doligez, Garrigue, Rémy, and Vouillon, OCaml 3.11, 2008I Boothe, PLDI, 2000

(4) Post-mortem debugging via logging of events to a database

I Pothier, Tanter, and Piquer, OOPSLA, 2007I Lefebvre, Cully, Feeley, Hutchinson, and Warfield, EuroSys, 2009

Page 50: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Thank you!

Questions?

Page 51: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-nextwhile true do

if last command is continue or next/bkpt thenundo-command()if last command is next/bkpt and same() then breakelse if last command is next/bkpt and deeper() then

/* next/bkpt had exited a function */reverse-finish()break

else /* shallower() or last command is continue */do_step()while we are not at breakpoint do do_next()

else if last command is step or next thenundo-command()if same() or shallower() then breakelse if deeper() then /* next had exited a function */

reverse-finish()break

Page 52: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-nextwhile true do

if last command is continue or next/bkpt thenundo-command()if last command is next/bkpt and same() then breakelse if last command is next/bkpt and deeper() then

/* next/bkpt had exited a function */reverse-finish()break

else /* shallower() or last command is continue */do_step()while we are not at breakpoint do do_next()

else if last command is step or next thenundo-command()if same() or shallower() then breakelse if deeper() then /* next had exited a function */

reverse-finish()break

Page 53: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-nextwhile true do

if last command is continue or next/bkpt thenundo-command()if last command is next/bkpt and same() then breakelse if last command is next/bkpt and deeper() then

/* next/bkpt had exited a function */reverse-finish()break

else /* shallower() or last command is continue */do_step()while we are not at breakpoint do do_next()

else if last command is step or next thenundo-command()if same() or shallower() then breakelse if deeper() then /* next had exited a function */

reverse-finish()break

Page 54: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-nextwhile true do

if last command is continue or next/bkpt thenundo-command()if last command is next/bkpt and same() then breakelse if last command is next/bkpt and deeper() then

/* next/bkpt had exited a function */reverse-finish()break

else /* shallower() or last command is continue */do_step()while we are not at breakpoint do do_next()

else if last command is step or next thenundo-command()if same() or shallower() then breakelse if deeper() then /* next had exited a function */

reverse-finish()break

Page 55: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-nextwhile true do

if last command is continue or next/bkpt thenundo-command()if last command is next/bkpt and same() then breakelse if last command is next/bkpt and deeper() then

/* next/bkpt had exited a function */reverse-finish()break

else /* shallower() or last command is continue */do_step()while we are not at breakpoint do do_next()

else if last command is step or next thenundo-command()if same() or shallower() then breakelse if deeper() then /* next had exited a function */

reverse-finish()break

Page 56: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-continue

repeatundo-command()

until we are at a breakpoint

NoteAn optimization can scan the history and replay it until the lastbreakpoint before the current statement, wherereverse-continue() was issued.

Page 57: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-continue

repeatundo-command()

until we are at a breakpoint

NoteAn optimization can scan the history and replay it until the lastbreakpoint before the current statement, wherereverse-continue() was issued.

Page 58: URDB: A Universal Reversible Debugger Based on Decomposing ... fileIntroducing URDB URDBis a universal reversible debugger based on: I checkpoint I restart I re-execution of debugging

Reverse-finish

I The algorithm follows a logic similar in spirit to that ofreverse-next() and reverse-step().

I Implementation: execute a sequence of reverse-next()’s andchecking the stack depth after each reverse-next().