From 051764ec65302e9f3bcd0d2b3e7315b0a6e4d3bb Mon Sep 17 00:00:00 2001 From: eutarass Date: Wed, 24 Nov 2010 21:10:24 +0000 Subject: TCF Debugger: implemented UI contributions for reverse execution control --- .../org.eclipse.tm.tcf.debug.ui/plugin.properties | 32 +++- plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml | 194 +++++++++++++++++++-- .../ui/commands/AbstractDebugActionDelegate.java | 123 +++++++++++++ .../debug/ui/commands/BackIntoActionDelegate.java | 18 ++ .../debug/ui/commands/BackOverActionDelegate.java | 18 ++ .../ui/commands/BackResumeActionDelegate.java | 18 ++ .../tcf/debug/ui/commands/BackResumeCommand.java | 125 ++++--------- .../ui/commands/BackReturnActionDelegate.java | 18 ++ .../tcf/debug/ui/commands/ResumeCommand.java | 152 +++------------- .../tcf/debug/ui/commands/StepCommand.java | 9 +- 10 files changed, 459 insertions(+), 248 deletions(-) create mode 100644 plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/AbstractDebugActionDelegate.java create mode 100644 plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java create mode 100644 plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java create mode 100644 plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java create mode 100644 plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties index d635b2bd3..3aafd31e7 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties +++ b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties @@ -16,12 +16,28 @@ debugCallStack = Debug Call Stack DebuggerActionSet.label = TCF Debugger -SignalsCommand.label = Signals... -MemoryMapCommand.label = Memory Map... +Signals.label = Signals... +MemoryMap.label = Memory Map... -CastToTypeAction.label=Cast To Type... -CastToTypeAction.tooltip=Cast Expression To Type -RestoreDefaultTypeAction.label=Restore Original Type -RestoreDefaultTypeAction.tooltip=Restore Original Type Of Expression -CastToArrayAction.label=Display As Array... -CastToArrayAction.tooltip=Display Expression As Array +CastToType.label=Cast To Type... +CastToType.tooltip=Cast Expression To Type +RestoreDefaultType.label=Restore Original Type +RestoreDefaultType.tooltip=Restore Original Type Of Expression +CastToArray.label=Display As Array... +CastToArray.tooltip=Display Expression As Array + +ReverseExecutionCategory.name=Reverse execution +ReverseExecutionCategory.description=Reverse execution control commands + +BackInto.label=Back Into +BackInto.tooltip=Back Into +BackInto.description=Step back into +BackOver.label=Back Over +BackOver.tooltip=Back Over +BackOver.description=Step back over +BackReturn.label=Back Return +BackReturn.tooltip=Back Return +BackReturn.description=Run backwards until return +BackResume.label=Run Backwards +BackResume.tooltip=Run Backwards +BackResume.description=Run backwards diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml index 01beb9d2b..6c5a39225 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml +++ b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml @@ -205,9 +205,9 @@ objectClass="org.eclipse.tm.internal.tcf.debug.model.TCFLaunch"> @@ -218,16 +218,16 @@ objectClass="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode"> @@ -237,10 +237,10 @@ id="org.eclipse.tm.tcf.debug.ui.CastToType" objectClass="org.eclipse.tm.internal.tcf.debug.ui.model.ICastToType"> @@ -252,11 +252,11 @@ @@ -268,11 +268,11 @@ @@ -284,8 +284,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cmd_class; + + protected AbstractDebugActionDelegate(Class cmd_class) { + this.cmd_class = cmd_class; + } + + @Override + protected void selectionChanged() { + TCFNode n = getSelectedNode(); + if (n == null) { + getAction().setEnabled(false); + return; + } + IDebugCommandHandler cmd = (IDebugCommandHandler)n.getAdapter(cmd_class); + if (cmd == null) { + getAction().setEnabled(false); + return; + } + final Object[] selection = new Object[]{ n }; + cmd.canExecute(new IEnabledStateRequest() { + + IStatus status; + boolean enabled = false; + + public void setStatus(IStatus status) { + this.status = status; + } + + public boolean isCanceled() { + return false; + } + + public IStatus getStatus() { + return status; + } + + public void done() { + getAction().setEnabled(enabled); + } + + public void cancel() { + } + + public Object[] getElements() { + return selection; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + }); + } + + @Override + protected void run() { + TCFNode n = getSelectedNode(); + if (n == null) return; + IDebugCommandHandler cmd = (IDebugCommandHandler)n.getAdapter(cmd_class); + if (cmd == null) return; + final Object[] selection = new Object[]{ n }; + cmd.execute(new IDebugCommandRequest() { + + IStatus status; + + public void setStatus(IStatus status) { + this.status = status; + } + + public IStatus getStatus() { + return status; + } + + public void done() { + if (status != null && !status.isOK()) { + final Shell shell = getWindow().getShell(); + shell.getDisplay().asyncExec(new Runnable() { + public void run() { + MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); + mb.setText("Cannot execute debugger command"); + mb.setMessage(TCFModel.getErrorMessage(status.getException(), true)); + mb.open(); + } + }); + } + } + + public void cancel() { + } + + public boolean isCanceled() { + return false; + } + + public Object[] getElements() { + return selection; + } + }); + } +} diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java new file mode 100644 index 000000000..1e3fe9451 --- /dev/null +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.internal.tcf.debug.ui.commands; + +public class BackIntoActionDelegate extends AbstractDebugActionDelegate { + + public BackIntoActionDelegate() { + super(BackIntoCommand.class); + } +} diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java new file mode 100644 index 000000000..0e42892a9 --- /dev/null +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.internal.tcf.debug.ui.commands; + +public class BackOverActionDelegate extends AbstractDebugActionDelegate { + + public BackOverActionDelegate() { + super(BackOverCommand.class); + } +} diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java new file mode 100644 index 000000000..0bc7bcc3f --- /dev/null +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.internal.tcf.debug.ui.commands; + +public class BackResumeActionDelegate extends AbstractDebugActionDelegate{ + + public BackResumeActionDelegate() { + super(BackResumeCommand.class); + } +} diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java index 1257bb8b2..14c397fe9 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java @@ -1,115 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ package org.eclipse.tm.internal.tcf.debug.ui.commands; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.commands.IDebugCommandRequest; -import org.eclipse.debug.core.commands.IEnabledStateRequest; -import org.eclipse.tm.internal.tcf.debug.model.TCFContextState; import org.eclipse.tm.internal.tcf.debug.ui.Activator; import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel; -import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode; -import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext; -import org.eclipse.tm.internal.tcf.debug.ui.model.TCFRunnable; import org.eclipse.tm.tcf.protocol.IChannel; +import org.eclipse.tm.tcf.protocol.IErrorReport; import org.eclipse.tm.tcf.protocol.IToken; import org.eclipse.tm.tcf.services.IRunControl; -import org.eclipse.tm.tcf.util.TCFDataCache; - -public class BackResumeCommand { - private final TCFModel model; +public class BackResumeCommand extends StepCommand { public BackResumeCommand(TCFModel model) { - this.model = model; + super(model); } - public void canExecute(final IEnabledStateRequest monitor) { - new TCFRunnable(monitor) { - public void run() { - if (done) return; - Object[] elements = monitor.getElements(); - boolean res = false; - for (int i = 0; i < elements.length; i++) { - TCFNode node = null; - if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i]; - else node = model.getRootNode(); - while (node != null && !node.isDisposed()) { - IRunControl.RunControlContext ctx = null; - if (node instanceof TCFNodeExecContext) { - TCFDataCache cache = ((TCFNodeExecContext)node).getRunContext(); - if (!cache.validate(this)) return; - ctx = cache.getData(); - } - if (ctx == null) { - node = node.getParent(); - } - else if (ctx.isContainer()) { - if (ctx.canResume(IRunControl.RM_REVERSE_RESUME)) res = true; - break; - } - else { - TCFDataCache state_cache = ((TCFNodeExecContext)node).getState(); - if (!state_cache.validate(this)) return; - TCFContextState state_data = state_cache.getData(); - if (state_data != null && state_data.is_suspended && ctx.canResume(IRunControl.RM_REVERSE_RESUME)) res = true; - break; - } - } - } - monitor.setEnabled(res); - monitor.setStatus(Status.OK_STATUS); - done(); - } - }; + @Override + protected boolean canExecute(IRunControl.RunControlContext ctx) { + if (ctx == null) return false; + if (ctx.canResume(IRunControl.RM_REVERSE_RESUME)) return true; + return false; } - public boolean execute(final IDebugCommandRequest monitor) { - new TCFRunnable(monitor) { - public void run() { - if (done) return; - Object[] elements = monitor.getElements(); - Set set = new HashSet(); - for (int i = 0; i < elements.length; i++) { - TCFNode node = null; - if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i]; - else node = model.getRootNode(); - while (node != null && !node.isDisposed()) { - IRunControl.RunControlContext ctx = null; - if (node instanceof TCFNodeExecContext) { - TCFDataCache cache = ((TCFNodeExecContext)node).getRunContext(); - if (!cache.validate(this)) return; - ctx = cache.getData(); - } - if (ctx == null) { - node = node.getParent(); - } - else { - set.add(ctx); - break; + @Override + protected void execute(final IDebugCommandRequest monitor, + IRunControl.RunControlContext ctx, boolean src_step, final Runnable done) { + ctx.resume(IRunControl.RM_REVERSE_RESUME, 1, new IRunControl.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) { + if (error instanceof IErrorReport) { + IErrorReport r = (IErrorReport)error; + if (r.getErrorCode() == IErrorReport.TCF_ERROR_ALREADY_RUNNING) { + done.run(); + return; } } + monitor.setStatus(new Status(IStatus.ERROR, + Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error)); } - final Set cmds = new HashSet(); - for (Iterator i = set.iterator(); i.hasNext();) { - IRunControl.RunControlContext ctx = i.next(); - cmds.add(ctx.resume(IRunControl.RM_REVERSE_RESUME, 1, new IRunControl.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - assert cmds.contains(token); - cmds.remove(token); - if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) { - monitor.setStatus(new Status(IStatus.ERROR, - Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error)); - } - if (cmds.isEmpty()) done(); - } - })); - } + done.run(); } - }; - return true; + }); } } diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java new file mode 100644 index 000000000..834cfe529 --- /dev/null +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.internal.tcf.debug.ui.commands; + +public class BackReturnActionDelegate extends AbstractDebugActionDelegate { + + public BackReturnActionDelegate() { + super(BackReturnCommand.class); + } +} diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java index 93ad2d6c8..c4bfaf791 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java @@ -10,155 +10,49 @@ *******************************************************************************/ package org.eclipse.tm.internal.tcf.debug.ui.commands; -import java.util.HashSet; -import java.util.Set; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.commands.IDebugCommandRequest; -import org.eclipse.debug.core.commands.IEnabledStateRequest; import org.eclipse.debug.core.commands.IResumeHandler; -import org.eclipse.tm.internal.tcf.debug.actions.TCFAction; -import org.eclipse.tm.internal.tcf.debug.model.TCFContextState; import org.eclipse.tm.internal.tcf.debug.ui.Activator; import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel; -import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode; -import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext; -import org.eclipse.tm.internal.tcf.debug.ui.model.TCFRunnable; import org.eclipse.tm.tcf.protocol.IChannel; +import org.eclipse.tm.tcf.protocol.IErrorReport; import org.eclipse.tm.tcf.protocol.IToken; import org.eclipse.tm.tcf.services.IRunControl; -import org.eclipse.tm.tcf.util.TCFDataCache; - - -public class ResumeCommand implements IResumeHandler { - private static final int MAX_ACTION_CNT = 4; - private final TCFModel model; +public class ResumeCommand extends StepCommand implements IResumeHandler { public ResumeCommand(TCFModel model) { - this.model = model; + super(model); } - public void canExecute(final IEnabledStateRequest monitor) { - new TCFRunnable(monitor) { - public void run() { - if (done) return; - Object[] elements = monitor.getElements(); - boolean res = false; - if (model.getLaunch().getContextActionsCount() < MAX_ACTION_CNT) { - for (int i = 0; i < elements.length; i++) { - TCFNode node = null; - if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i]; - else node = model.getRootNode(); - while (node != null && !node.isDisposed()) { - IRunControl.RunControlContext ctx = null; - if (node instanceof TCFNodeExecContext) { - TCFDataCache cache = ((TCFNodeExecContext)node).getRunContext(); - if (!cache.validate(this)) return; - ctx = cache.getData(); - } - if (ctx == null) { - node = node.getParent(); - } - else if (ctx.isContainer()) { - if (ctx.canResume(IRunControl.RM_RESUME)) res = true; - break; - } - else { - TCFDataCache state_cache = ((TCFNodeExecContext)node).getState(); - if (!state_cache.validate(this)) return; - TCFContextState state_data = state_cache.getData(); - if (state_data != null && state_data.is_suspended && ctx.canResume(IRunControl.RM_RESUME)) res = true; - break; - } - } - } - } - monitor.setEnabled(res); - monitor.setStatus(Status.OK_STATUS); - done(); - } - }; + @Override + protected boolean canExecute(IRunControl.RunControlContext ctx) { + if (ctx == null) return false; + if (ctx.canResume(IRunControl.RM_RESUME)) return true; + return false; } - public boolean execute(final IDebugCommandRequest monitor) { - new TCFRunnable(monitor) { - public void run() { - if (done) return; - Object[] elements = monitor.getElements(); - Set set = new HashSet(); - if (model.getLaunch().getContextActionsCount() < MAX_ACTION_CNT) { - for (int i = 0; i < elements.length; i++) { - TCFNode node = null; - if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i]; - else node = model.getRootNode(); - while (node != null && !node.isDisposed()) { - IRunControl.RunControlContext ctx = null; - if (node instanceof TCFNodeExecContext) { - TCFDataCache cache = ((TCFNodeExecContext)node).getRunContext(); - if (!cache.validate(this)) return; - ctx = cache.getData(); - } - if (ctx == null) { - node = node.getParent(); - } - else { - set.add(ctx); - break; - } + @Override + protected void execute(final IDebugCommandRequest monitor, + IRunControl.RunControlContext ctx, boolean src_step, final Runnable done) { + ctx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() { + public void doneCommand(IToken token, Exception error) { + if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) { + if (error instanceof IErrorReport) { + IErrorReport r = (IErrorReport)error; + if (r.getErrorCode() == IErrorReport.TCF_ERROR_ALREADY_RUNNING) { + done.run(); + return; } } + monitor.setStatus(new Status(IStatus.ERROR, + Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error)); } - if (set.size() == 0) { - monitor.setStatus(Status.OK_STATUS); - monitor.done(); - } - else { - final Set wait_list = new HashSet(); - for (final IRunControl.RunControlContext ctx : set) { - TCFAction done = new TCFAction(model.getLaunch()) { - public void run() { - TCFNodeExecContext node = (TCFNodeExecContext)model.getNode(ctx.getID()); - if (node == null || node.isDisposed()) { - done(); - return; - } - TCFDataCache state = node.getState(); - if (!state.validate(this)) return; - if (state.getData() == null || !state.getData().is_suspended) { - Throwable error = state.getError(); - if (error != null) { - monitor.setStatus(new Status(IStatus.ERROR, - Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error)); - } - done(); - return; - } - final TCFAction done = this; - ctx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() { - public void doneCommand(IToken token, Exception error) { - if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) { - monitor.setStatus(new Status(IStatus.ERROR, - Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error)); - } - done.done(); - } - }); - } - @Override - public void done() { - super.done(); - wait_list.remove(this); - if (wait_list.isEmpty()) monitor.done(); - } - }; - wait_list.add(done); - } - } + done.run(); } - }; - return true; + }); } } diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java index ce3f62064..a64cd086e 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java @@ -28,7 +28,7 @@ import org.eclipse.tm.tcf.util.TCFDataCache; // TODO: implement Instruction Stepping Mode user action abstract class StepCommand implements IDebugCommandHandler { - private static final int MAX_ACTION_CNT = 8; + private static final int MAX_ACTION_CNT = 4; protected final TCFModel model; @@ -42,6 +42,8 @@ abstract class StepCommand implements IDebugCommandHandler { IRunControl.RunControlContext ctx, boolean src_step, Runnable done); private boolean getContextSet(Object[] elements, Set set, Runnable done) { + int action_cnt = model.getLaunch().getContextActionsCount(); + if (action_cnt >= MAX_ACTION_CNT) return true; for (int i = 0; i < elements.length; i++) { TCFNode node = null; if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i]; @@ -57,14 +59,13 @@ abstract class StepCommand implements IDebugCommandHandler { node = node.getParent(); } else { - int cnt = model.getLaunch().getContextActionsCount(); - if (cnt == 0) { + if (action_cnt == 0) { TCFDataCache state_cache = ((TCFNodeExecContext)node).getState(); if (!state_cache.validate(done)) return false; TCFContextState state_data = state_cache.getData(); if (state_data != null && state_data.is_suspended) set.add(ctx); } - else if (cnt < MAX_ACTION_CNT) { + else { set.add(ctx); } break; -- cgit v1.2.3