From e080fa522101b3efe47c8c2f88872fe55d0de8a6 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Mon, 13 Apr 2009 13:48:20 +0000 Subject: [PATCH] [258284] With the latest fixed to GDB, we can use the CLI commands for reverse debugging. The MI commands are not yet available in GDB. --- .../dsf/gdb/service/GDBRunControl_7_0.java | 63 +++++-------------- .../commands/MIExecReverseContinue.java | 2 +- .../command/commands/MIExecReverseNext.java | 2 +- .../MIExecReverseNextInstruction.java | 2 +- .../command/commands/MIExecReverseStep.java | 2 +- .../MIExecReverseStepInstruction.java | 2 +- .../command/commands/MIExecUncall.java | 4 +- 7 files changed, 22 insertions(+), 55 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java index 79d36bd614d..362b433da1f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java @@ -270,30 +270,13 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro // as soon as we send a resume command. getCache().setContextAvailable(context, false); - // temporary - final MIExecReverseContinue finalcmd = cmd; - final IExecutionDMContext finaldmc = context; - getConnection().queueCommand( - new RawCommand(finaldmc, "set exec-direction reverse"), //$NON-NLS-1$ - new DataRequestMonitor(getExecutor(), rm) { - @Override - public void handleSuccess() { - getConnection().queueCommand(finalcmd, new DataRequestMonitor(getExecutor(), rm) { - @Override - public void handleCompleted() { - if (!isSuccess()) { - setResumePending(false); - getCache().setContextAvailable(context, true); - } - - getConnection().queueCommand( - new RawCommand(finaldmc, "set exec-direction forward"), //$NON-NLS-1$ - new DataRequestMonitor(getExecutor(), rm)); - } - }); - } - }); - // end temporary + getConnection().queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm) { + @Override + public void handleFailure() { + setResumePending(false); + getCache().setContextAvailable(context, true); + } + }); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Given context: " + context + ", is already running or reverse not enabled.", null)); //$NON-NLS-1$ //$NON-NLS-2$ rm.done(); @@ -359,30 +342,14 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro fReverseStepping = true; getCache().setContextAvailable(context, false); - // temporary - final MICommand finalcmd = cmd; - final IExecutionDMContext finaldmc = context; - getConnection().queueCommand( - new RawCommand(finaldmc, "set exec-direction reverse"), //$NON-NLS-1$ - new DataRequestMonitor(getExecutor(), rm) { - @Override - public void handleSuccess() { - getConnection().queueCommand(finalcmd, new DataRequestMonitor(getExecutor(), rm) { - @Override - public void handleCompleted() { - if (!isSuccess()) { - setResumePending(false); - fReverseStepping = false; - getCache().setContextAvailable(context, true); - } - getConnection().queueCommand( - new RawCommand(finaldmc, "set exec-direction forward"), //$NON-NLS-1$ - new DataRequestMonitor(getExecutor(), rm)); - } - }); - } - }); - // end temporary + getConnection().queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm) { + @Override + public void handleFailure() { + setResumePending(false); + fReverseStepping = false; + getCache().setContextAvailable(context, true); + } + }); } /** @since 2.0 */ diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java index 866e077518a..c9c89dec8e4 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseContinue.java @@ -21,6 +21,6 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; public class MIExecReverseContinue extends MICommand { public MIExecReverseContinue(IExecutionDMContext dmc) { - super(dmc, "-exec-continue"); //$NON-NLS-1$ + super(dmc, "-interpreter-exec", new String[] {"console", "reverse-continue"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java index f3e86e8fd53..937471a1895 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNext.java @@ -25,6 +25,6 @@ public class MIExecReverseNext extends MICommand { } public MIExecReverseNext(IExecutionDMContext dmc, int count) { - super(dmc, "-exec-next", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + super(dmc, "-interpreter-exec", new String[] {"console", "reverse-next " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java index 1dc9b663330..2087332f767 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseNextInstruction.java @@ -25,6 +25,6 @@ public class MIExecReverseNextInstruction extends MICommand { } public MIExecReverseNextInstruction(IExecutionDMContext dmc, int count) { - super(dmc, "-exec-nexti", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + super(dmc, "-interpreter-exec", new String[] {"console", "reverse-nexti " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java index 83e54f3a86a..11e26ddee44 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStep.java @@ -24,6 +24,6 @@ public class MIExecReverseStep extends MICommand { this(dmc, 1); } public MIExecReverseStep(IExecutionDMContext dmc, int count) { - super(dmc, "-exec-step", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + super(dmc, "-interpreter-exec", new String[] {"console", "reverse-step " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java index e8d21a3c2f4..c604f53e174 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecReverseStepInstruction.java @@ -24,6 +24,6 @@ public class MIExecReverseStepInstruction extends MICommand { this(dmc, 1); } public MIExecReverseStepInstruction(IExecutionDMContext dmc, int count) { - super(dmc, "-exec-stepi", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + super(dmc, "-interpreter-exec", new String[] {"console", "reverse-stepi " + Integer.toString(count) }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java index d8fab14f459..d1134b67a9f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecUncall.java @@ -17,11 +17,11 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; * Steps backward until the line where the current method * was originally called. * - * @since 2.0 + * @since 2.0 */ public class MIExecUncall extends MICommand { public MIExecUncall(IFrameDMContext dmc) { - super(dmc, "-exec-finish"); //$NON-NLS-1$ + super(dmc, "-interpreter-exec", new String[] {"console", "reverse-finish"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }