diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF index 18fbc8b6002..9344ede217b 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.1.0.qualifier Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java index e02e42f89e0..2006ebbf442 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java @@ -38,10 +38,11 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIFileExecAndSymbols; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetArgs; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetAutoSolib; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination; import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetAsync; import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelect; import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectCore; -import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.core.runtime.CoreException; @@ -221,12 +222,12 @@ public class FinalLaunchSequence extends Sequence { if (isNonStop) { // The raw commands should not be necessary in the official GDB release fCommandControl.queueCommand( - new RawCommand(fCommandControl.getContext(), "set target-async on"), //$NON-NLS-1$ + new MIGDBSetTargetAsync(fCommandControl.getContext(), true), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleSuccess() { fCommandControl.queueCommand( - new RawCommand(fCommandControl.getContext(), "set pagination off"), //$NON-NLS-1$ + new MIGDBSetPagination(fCommandControl.getContext(), false), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleSuccess() { 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 bb6d526dd8c..a6ba893f2a1 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 @@ -34,6 +34,7 @@ import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.IMIRunControl; import org.eclipse.cdt.dsf.mi.service.MIRunControl; import org.eclipse.cdt.dsf.mi.service.MIStack; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIRecord; import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete; import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; @@ -44,7 +45,6 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseNextInstruct import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStep; import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStepInstruction; import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecUncall; -import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand; import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIInferiorExitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent; @@ -424,27 +424,15 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro return; } - if (enable) { - getConnection().queueCommand( - new RawCommand(context, "record"), //$NON-NLS-1$ - new DataRequestMonitor(getExecutor(), rm) { - @Override - public void handleSuccess() { - setReverseModeEnabled(true); - rm.done(); - } - }); - } else { - getConnection().queueCommand( - new RawCommand(context, "record stop"), //$NON-NLS-1$ - new DataRequestMonitor(getExecutor(), rm) { - @Override - public void handleSuccess() { - setReverseModeEnabled(false); - rm.done(); - } - }); - } + getConnection().queueCommand( + new CLIRecord(context, enable), + new DataRequestMonitor(getExecutor(), rm) { + @Override + public void handleSuccess() { + setReverseModeEnabled(enable); + rm.done(); + } + }); } /** @since 2.0 */ diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java index 6adcaa4cb28..d0bb8be90b5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java @@ -44,6 +44,7 @@ import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackSelectFrame; import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadSelect; +import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand; import org.eclipse.cdt.dsf.mi.service.command.output.MIConst; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIList; @@ -319,7 +320,12 @@ public abstract class AbstractMIControl extends AbstractDsfService } } - handle.generateTokenId(); + if (!(handle.getCommand() instanceof RawCommand)) { + // Only generate a token id if the command is not a RawCommand + // RawCommands are sent to GDB without an answer expected, so we don't + // need a token id. In fact, GDB will fail if we send one in this case. + handle.generateTokenId(); + } fTxCommands.add(handle); } } @@ -530,7 +536,10 @@ public abstract class AbstractMIControl extends AbstractDsfService /* * We note that this is an outstanding request at this point. */ - fRxCommands.put(commandHandle.getTokenId(), commandHandle); + if (!(commandHandle.getCommand() instanceof RawCommand)) { + // RawCommands will not get an answer, so we cannot put them in the receive queue. + fRxCommands.put(commandHandle.getTokenId(), commandHandle); + } } /* @@ -542,6 +551,9 @@ public abstract class AbstractMIControl extends AbstractDsfService if (fUseThreadAndFrameOptions && commandHandle.getCommand().supportsThreadAndFrameOptions()) { str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getThreadId(), commandHandle.getStackFrameId()); + } else if (commandHandle.getCommand() instanceof RawCommand) { + // RawCommands CANNOT have a token id: GDB would read it as part of the RawCommand! + str = commandHandle.getCommand().constructCommand(); } else { str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java new file mode 100644 index 00000000000..cac4859b98b --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIRecord.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2009 Ericsson and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Ericsson - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; + +/** + * This command turns on on off the recording of "Process Record and Replay". + * + * @since 2.1 + */ +public class CLIRecord extends CLICommand { + public CLIRecord(ICommandControlDMContext ctx, boolean enable) { + super(ctx, enable ? "record" : "record stop"); //$NON-NLS-1$ //$NON-NLS-2$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java index 38ad3f67c19..6386100af03 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecContinue.java @@ -37,7 +37,7 @@ public class MIExecContinue extends MICommand } /** - * @since 2.0 + * @since 2.1 */ public MIExecContinue(IExecutionDMContext dmc, String groupId) { this(dmc, false, groupId); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java index 68db1d3d75f..74766792449 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecInterrupt.java @@ -42,7 +42,7 @@ public class MIExecInterrupt extends MICommand } /** - * @since 2.0 + * @since 2.1 */ public MIExecInterrupt(IExecutionDMContext dmc, String groupId) { this(dmc, false, groupId); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java new file mode 100644 index 00000000000..003e4ed9dbf --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPagination.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2009 Ericsson and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Ericsson - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set pagination [on | off] + * + * @since 2.1 + */ +public class MIGDBSetPagination extends MIGDBSet +{ + public MIGDBSetPagination(ICommandControlDMContext ctx, boolean isSet) { + super(ctx, new String[] {"pagination", isSet ? "on" : "off"});//$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/MIGDBSetTargetAsync.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java new file mode 100644 index 00000000000..1502f0c26aa --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetAsync.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2009 Ericsson and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Ericsson - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set target-async [on | off] + * + * @since 2.1 + */ +public class MIGDBSetTargetAsync extends MIGDBSet +{ + public MIGDBSetTargetAsync(ICommandControlDMContext ctx, boolean isSet) { + super(ctx, new String[] {"target-async", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + } +}