1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 22:05:44 +02:00

[258284] Added @since 2.0. And added getter/setter method to MIRunControl

This commit is contained in:
Marc Khouzam 2009-01-23 21:00:49 +00:00
parent 35a7e9d02b
commit f5bd8af097
26 changed files with 98 additions and 14 deletions

View file

@ -30,6 +30,9 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
/**
* @since 2.0
*/
@Immutable @Immutable
public abstract class GdbAbstractReverseStepCommand { public abstract class GdbAbstractReverseStepCommand {

View file

@ -28,6 +28,9 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
/**
* @since 2.0
*/
@Immutable @Immutable
public class GdbReverseResumeCommand implements IReverseResumeHandler { public class GdbReverseResumeCommand implements IReverseResumeHandler {

View file

@ -17,6 +17,9 @@ import org.eclipse.cdt.dsf.gdb.actions.IReverseStepIntoHandler;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
@Immutable @Immutable
public class GdbReverseStepIntoCommand extends GdbAbstractReverseStepCommand implements IReverseStepIntoHandler { public class GdbReverseStepIntoCommand extends GdbAbstractReverseStepCommand implements IReverseStepIntoHandler {

View file

@ -17,6 +17,9 @@ import org.eclipse.cdt.dsf.gdb.actions.IReverseStepOverHandler;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
@Immutable @Immutable
public class GdbReverseStepOverCommand extends GdbAbstractReverseStepCommand implements IReverseStepOverHandler { public class GdbReverseStepOverCommand extends GdbAbstractReverseStepCommand implements IReverseStepOverHandler {

View file

@ -28,6 +28,9 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
/**
* @since 2.0
*/
@Immutable @Immutable
public class GdbReverseToggleCommand implements IReverseToggleHandler { public class GdbReverseToggleCommand implements IReverseToggleHandler {

View file

@ -17,6 +17,9 @@ import org.eclipse.cdt.dsf.gdb.actions.IUncallHandler;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
@Immutable @Immutable
public class GdbUncallCommand extends GdbAbstractReverseStepCommand implements IUncallHandler { public class GdbUncallCommand extends GdbAbstractReverseStepCommand implements IUncallHandler {

View file

@ -17,6 +17,8 @@ import org.eclipse.jface.viewers.ISelection;
/** /**
* Command handler to trigger a reverse resume operation * Command handler to trigger a reverse resume operation
*
* @since 2.0
*/ */
public class ReverseResumeCommandHandler extends RetargetDebugContextCommand { public class ReverseResumeCommandHandler extends RetargetDebugContextCommand {

View file

@ -17,6 +17,8 @@ import org.eclipse.jface.viewers.ISelection;
/** /**
* Command handler to trigger a reverse stepinto operation * Command handler to trigger a reverse stepinto operation
*
* @since 2.0
*/ */
public class ReverseStepIntoCommandHandler extends RetargetDebugContextCommand { public class ReverseStepIntoCommandHandler extends RetargetDebugContextCommand {

View file

@ -17,6 +17,8 @@ import org.eclipse.jface.viewers.ISelection;
/** /**
* Command handler to trigger a reverse stepover operation * Command handler to trigger a reverse stepover operation
*
* @since 2.0
*/ */
public class ReverseStepOverCommandHandler extends RetargetDebugContextCommand { public class ReverseStepOverCommandHandler extends RetargetDebugContextCommand {

View file

@ -18,6 +18,8 @@ import org.eclipse.jface.viewers.ISelection;
/** /**
* Command handler to toggle reverse debugging mode * Command handler to toggle reverse debugging mode
*
* @since 2.0
*/ */
public class ReverseToggleCommandHandler extends RetargetDebugContextCommand { public class ReverseToggleCommandHandler extends RetargetDebugContextCommand {

View file

@ -17,6 +17,8 @@ import org.eclipse.jface.viewers.ISelection;
/** /**
* Command handler to trigger an uncall operation * Command handler to trigger an uncall operation
*
* @since 2.0
*/ */
public class UncallCommandHandler extends RetargetDebugContextCommand { public class UncallCommandHandler extends RetargetDebugContextCommand {

View file

@ -34,6 +34,8 @@ import org.eclipse.ui.PlatformUI;
/** /**
* Base class for actions which delegate functionality to an adapter retrieved * Base class for actions which delegate functionality to an adapter retrieved
* from the current debug context. * from the current debug context.
*
* @since 2.0
*/ */
abstract public class RetargetDebugContextCommand extends AbstractHandler implements IDebugContextListener { abstract public class RetargetDebugContextCommand extends AbstractHandler implements IDebugContextListener {

View file

@ -12,6 +12,9 @@ package org.eclipse.cdt.dsf.gdb.actions;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
public interface IReverseResumeHandler { public interface IReverseResumeHandler {
public boolean canReverseResume(ISelection debugContext); public boolean canReverseResume(ISelection debugContext);
public void reverseResume(ISelection debugContext); public void reverseResume(ISelection debugContext);

View file

@ -12,6 +12,9 @@ package org.eclipse.cdt.dsf.gdb.actions;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
public interface IReverseStepIntoHandler { public interface IReverseStepIntoHandler {
public boolean canReverseStepInto(ISelection debugContext); public boolean canReverseStepInto(ISelection debugContext);
public void reverseStepInto(ISelection debugContext); public void reverseStepInto(ISelection debugContext);

View file

@ -12,6 +12,9 @@ package org.eclipse.cdt.dsf.gdb.actions;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
public interface IReverseStepOverHandler { public interface IReverseStepOverHandler {
public boolean canReverseStepOver(ISelection debugContext); public boolean canReverseStepOver(ISelection debugContext);
public void reverseStepOver(ISelection debugContext); public void reverseStepOver(ISelection debugContext);

View file

@ -13,6 +13,9 @@ package org.eclipse.cdt.dsf.gdb.actions;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
public interface IReverseToggleHandler { public interface IReverseToggleHandler {
public boolean canToggleReverse(ISelection debugContext); public boolean canToggleReverse(ISelection debugContext);
public void toggleReverse(ISelection debugContext); public void toggleReverse(ISelection debugContext);

View file

@ -12,6 +12,9 @@ package org.eclipse.cdt.dsf.gdb.actions;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
*/
public interface IUncallHandler { public interface IUncallHandler {
public boolean canUncall(ISelection debugContext); public boolean canUncall(ISelection debugContext);
public void uncall(ISelection debugContext); public void uncall(ISelection debugContext);

View file

@ -131,11 +131,13 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
}); });
} }
/** @since 2.0 */
public void canReverseResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) { public void canReverseResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseModeEnabled && doCanResume(context)); rm.setData(fReverseModeEnabled && doCanResume(context));
rm.done(); rm.done();
} }
/** @since 2.0 */
public void canReverseStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) { public void canReverseStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) {
if (context instanceof IContainerDMContext) { if (context instanceof IContainerDMContext) {
rm.setData(false); rm.setData(false);
@ -146,13 +148,15 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
canReverseResume(context, rm); canReverseResume(context, rm);
} }
/** @since 2.0 */
public boolean isReverseStepping(IExecutionDMContext context) { public boolean isReverseStepping(IExecutionDMContext context) {
return !fTerminated && fReverseStepping; return !isTerminated() && fReverseStepping;
} }
/** @since 2.0 */
public void reverseResume(IExecutionDMContext context, final RequestMonitor rm) { public void reverseResume(IExecutionDMContext context, final RequestMonitor rm) {
if (fReverseModeEnabled && doCanResume(context)) { if (fReverseModeEnabled && doCanResume(context)) {
fResumePending = true; setResumePending(true);
// Cygwin GDB will accept commands and execute them after the step // Cygwin GDB will accept commands and execute them after the step
// which is not what we want, so mark the target as unavailable // which is not what we want, so mark the target as unavailable
// as soon as we send a resume command. // as soon as we send a resume command.
@ -196,6 +200,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
} }
/** @since 2.0 */
public void reverseStep(IExecutionDMContext context, StepType stepType, final RequestMonitor rm) { public void reverseStep(IExecutionDMContext context, StepType stepType, final RequestMonitor rm) {
assert context != null; assert context != null;
@ -212,7 +217,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
return; return;
} }
fResumePending = true; setResumePending(true);
fReverseStepping = true; fReverseStepping = true;
getCache().setContextAvailable(context, false); getCache().setContextAvailable(context, false);
MICommand<MIInfo> cmd = null; MICommand<MIInfo> cmd = null;
@ -272,16 +277,19 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
// end temporary // end temporary
} }
/** @since 2.0 */
public void canEnableReverseMode(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) { public void canEnableReverseMode(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseSupported); rm.setData(fReverseSupported);
rm.done(); rm.done();
} }
/** @since 2.0 */
public void isReverseModeEnabled(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) { public void isReverseModeEnabled(ICommandControlDMContext context, DataRequestMonitor<Boolean> rm) {
rm.setData(fReverseModeEnabled); rm.setData(fReverseModeEnabled);
rm.done(); rm.done();
} }
/** @since 2.0 */
public void enableReverseMode(ICommandControlDMContext context, final boolean enable, final RequestMonitor rm) { public void enableReverseMode(ICommandControlDMContext context, final boolean enable, final RequestMonitor rm) {
if (!fReverseSupported) { if (!fReverseSupported) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Reverse mode is not supported.", null)); //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Reverse mode is not supported.", null)); //$NON-NLS-1$
@ -317,8 +325,8 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
} }
} }
/** @since 2.0 */
public void setReverseModeEnabled(boolean enabled) { public void setReverseModeEnabled(boolean enabled) {
fReverseModeEnabled = enabled; fReverseModeEnabled = enabled;
System.setProperty("debug.reverse.enabled", Boolean.toString(enabled));
} }
} }

View file

@ -17,7 +17,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
/** /**
* @since 1.1 * @since 2.0
*/ */
public interface IReverseRunControl { public interface IReverseRunControl {

View file

@ -265,9 +265,9 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
// State flags // State flags
private boolean fSuspended = true; private boolean fSuspended = true;
protected boolean fResumePending = false; private boolean fResumePending = false;
private boolean fStepping = false; private boolean fStepping = false;
protected boolean fTerminated = false; private boolean fTerminated = false;
private StateChangeReason fStateChangeReason; private StateChangeReason fStateChangeReason;
private IExecutionDMContext fStateChangeTriggeringContext; private IExecutionDMContext fStateChangeTriggeringContext;
@ -305,6 +305,15 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
public boolean isValid() { return true; } public boolean isValid() { return true; }
/** @since 2.0 */
protected boolean isResumePending() { return fResumePending; }
/** @since 2.0 */
protected void setResumePending(boolean pending) { fResumePending = pending; }
/** @since 2.0 */
protected boolean isTerminated() { return fTerminated; }
/** @since 2.0 */
protected void setTerminated(boolean terminated) { fTerminated = terminated; }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) { public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) {
if (dmc instanceof IExecutionDMContext) { if (dmc instanceof IExecutionDMContext) {
@ -316,7 +325,8 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
} }
public CommandCache getCache() { return fMICommandCache; } public CommandCache getCache() { return fMICommandCache; }
public ICommandControlService getConnection() { return fConnection; } /** @since 2.0 */
protected ICommandControlService getConnection() { return fConnection; }
public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, int threadId) { public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, int threadId) {
return new MIExecutionDMC(getSession().getId(), container, threadId); return new MIExecutionDMC(getSession().getId(), container, threadId);
@ -474,6 +484,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
rm.done(); rm.done();
} }
/** @since 2.0 */
protected boolean doCanResume(IExecutionDMContext context) { protected boolean doCanResume(IExecutionDMContext context) {
return !fTerminated && isSuspended(context) && !fResumePending; return !fTerminated && isSuspended(context) && !fResumePending;
} }

View file

@ -13,7 +13,11 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/** Resume backwards. */ /**
* Resume backwards.
*
* @since 2.0
*/
public class MIExecReverseContinue extends MICommand<MIInfo> { public class MIExecReverseContinue extends MICommand<MIInfo> {
public MIExecReverseContinue(IExecutionDMContext dmc) { public MIExecReverseContinue(IExecutionDMContext dmc) {

View file

@ -13,7 +13,10 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/** Steps backward one source code line, not entering function calls. /**
* Steps backward one source code line, not entering function calls.
*
* @since 2.0
*/ */
public class MIExecReverseNext extends MICommand<MIInfo> { public class MIExecReverseNext extends MICommand<MIInfo> {

View file

@ -13,7 +13,10 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/** Steps backward one machine instruction, not entering function calls. /**
* Steps backward one machine instruction, not entering function calls.
*
* @since 2.0
*/ */
public class MIExecReverseNextInstruction extends MICommand<MIInfo> { public class MIExecReverseNextInstruction extends MICommand<MIInfo> {

View file

@ -13,7 +13,10 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/** Step backwards i source lines, entering function calls. /**
* Step backwards i source lines, entering function calls.
*
* @since 2.0
*/ */
public class MIExecReverseStep extends MICommand<MIInfo> { public class MIExecReverseStep extends MICommand<MIInfo> {

View file

@ -13,7 +13,10 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/** Step backwards i instructions, entering function calls. /**
* Step backwards i instructions, entering function calls.
*
* @since 2.0
*/ */
public class MIExecReverseStepInstruction extends MICommand<MIInfo> { public class MIExecReverseStepInstruction extends MICommand<MIInfo> {

View file

@ -13,7 +13,11 @@ package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/** Steps backward one source code line, not entering function calls. /**
* Steps backward until the line where the current method
* was originally called.
*
* @since 2.0
*/ */
public class MIExecUncall extends MICommand<MIInfo> { public class MIExecUncall extends MICommand<MIInfo> {