1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

[276929] Support for scripting in the gdb console. Also updated some @since tags.

This commit is contained in:
Marc Khouzam 2009-07-21 01:50:16 +00:00
parent af2ec51c4d
commit 66af382c33
9 changed files with 108 additions and 30 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true 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-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,

View file

@ -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.MIGDBSetArgs;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetAutoSolib; 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.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.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.MITargetSelect;
import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectCore; 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.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -221,12 +222,12 @@ public class FinalLaunchSequence extends Sequence {
if (isNonStop) { if (isNonStop) {
// The raw commands should not be necessary in the official GDB release // The raw commands should not be necessary in the official GDB release
fCommandControl.queueCommand( fCommandControl.queueCommand(
new RawCommand(fCommandControl.getContext(), "set target-async on"), //$NON-NLS-1$ new MIGDBSetTargetAsync(fCommandControl.getContext(), true),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
fCommandControl.queueCommand( fCommandControl.queueCommand(
new RawCommand(fCommandControl.getContext(), "set pagination off"), //$NON-NLS-1$ new MIGDBSetPagination(fCommandControl.getContext(), false),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {

View file

@ -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.IMIRunControl;
import org.eclipse.cdt.dsf.mi.service.MIRunControl; import org.eclipse.cdt.dsf.mi.service.MIRunControl;
import org.eclipse.cdt.dsf.mi.service.MIStack; 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.MIBreakDelete;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert;
import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; 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.MIExecReverseStep;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStepInstruction; 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.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.MIBreakpointHitEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIInferiorExitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIInferiorExitEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
@ -424,27 +424,15 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
return; return;
} }
if (enable) {
getConnection().queueCommand( getConnection().queueCommand(
new RawCommand(context, "record"), //$NON-NLS-1$ new CLIRecord(context, enable),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) { new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override @Override
public void handleSuccess() { public void handleSuccess() {
setReverseModeEnabled(true); setReverseModeEnabled(enable);
rm.done(); rm.done();
} }
}); });
} else {
getConnection().queueCommand(
new RawCommand(context, "record stop"), //$NON-NLS-1$
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
public void handleSuccess() {
setReverseModeEnabled(false);
rm.done();
}
});
}
} }
/** @since 2.0 */ /** @since 2.0 */

View file

@ -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.MICommand;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackSelectFrame; 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.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.MIConst;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIList; import org.eclipse.cdt.dsf.mi.service.command.output.MIList;
@ -319,7 +320,12 @@ public abstract class AbstractMIControl extends AbstractDsfService
} }
} }
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(); handle.generateTokenId();
}
fTxCommands.add(handle); fTxCommands.add(handle);
} }
} }
@ -530,8 +536,11 @@ public abstract class AbstractMIControl extends AbstractDsfService
/* /*
* We note that this is an outstanding request at this point. * We note that this is an outstanding request at this point.
*/ */
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); fRxCommands.put(commandHandle.getTokenId(), commandHandle);
} }
}
/* /*
* Construct the new command and push this command out the pipeline. * Construct the new command and push this command out the pipeline.
@ -542,6 +551,9 @@ public abstract class AbstractMIControl extends AbstractDsfService
if (fUseThreadAndFrameOptions && commandHandle.getCommand().supportsThreadAndFrameOptions()) { if (fUseThreadAndFrameOptions && commandHandle.getCommand().supportsThreadAndFrameOptions()) {
str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getThreadId(), str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(commandHandle.getThreadId(),
commandHandle.getStackFrameId()); 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 { } else {
str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand(); str = commandHandle.getTokenId() + commandHandle.getCommand().constructCommand();
} }

View file

@ -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<MIInfo> {
public CLIRecord(ICommandControlDMContext ctx, boolean enable) {
super(ctx, enable ? "record" : "record stop"); //$NON-NLS-1$ //$NON-NLS-2$
}
}

View file

@ -37,7 +37,7 @@ public class MIExecContinue extends MICommand<MIInfo>
} }
/** /**
* @since 2.0 * @since 2.1
*/ */
public MIExecContinue(IExecutionDMContext dmc, String groupId) { public MIExecContinue(IExecutionDMContext dmc, String groupId) {
this(dmc, false, groupId); this(dmc, false, groupId);

View file

@ -42,7 +42,7 @@ public class MIExecInterrupt extends MICommand<MIInfo>
} }
/** /**
* @since 2.0 * @since 2.1
*/ */
public MIExecInterrupt(IExecutionDMContext dmc, String groupId) { public MIExecInterrupt(IExecutionDMContext dmc, String groupId) {
this(dmc, false, groupId); this(dmc, false, groupId);

View file

@ -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$
}
}

View file

@ -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$
}
}