diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseResumeHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseResumeHandler.java
new file mode 100644
index 00000000000..6dc50cdd3e3
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseResumeHandler.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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.debug.core.model;
+
+import org.eclipse.debug.core.commands.IDebugCommandHandler;
+
+/**
+ * Handler interface to perform a reverse Resume operation
+ * @since 6.1
+ */
+public interface IReverseResumeHandler extends IDebugCommandHandler {
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseStepIntoHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseStepIntoHandler.java
new file mode 100644
index 00000000000..f9ead996016
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseStepIntoHandler.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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.debug.core.model;
+
+import org.eclipse.debug.core.commands.IDebugCommandHandler;
+
+/**
+ * Handler interface to perform a reverse StepInto operation
+ * @since 6.1
+ */
+public interface IReverseStepIntoHandler extends IDebugCommandHandler {
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseStepOverHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseStepOverHandler.java
new file mode 100644
index 00000000000..4ce795e85b5
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseStepOverHandler.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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.debug.core.model;
+
+import org.eclipse.debug.core.commands.IDebugCommandHandler;
+
+/**
+ * Handler interface to perform a reverse StepOver operation
+ * @since 6.1
+ */
+public interface IReverseStepOverHandler extends IDebugCommandHandler {
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseToggleHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseToggleHandler.java
new file mode 100644
index 00000000000..dd2557510f7
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IReverseToggleHandler.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.debug.core.model;
+
+import org.eclipse.debug.core.commands.IDebugCommandHandler;
+
+/**
+ * Handler interface to toggle reverse debugging
+ * @since 6.1
+ */
+public interface IReverseToggleHandler extends IDebugCommandHandler {
+ /**
+ * Method to indicate if the IElementUpdate logic should be used
+ * to update the checked state of the corresponding command.
+ * {@link isReverseToggle} will only be used if this method returns true.
+ */
+ boolean toggleNeedsUpdating();
+
+ /**
+ * Method that returns if the toggle button should show as checked or not.
+ * Only used if {@link toggleNeedsUpdating} return true.
+ *
+ * @param context The currently selected context.
+ * @return if the reverse toggle button should show as checked or not.
+ */
+ boolean isReverseToggled(Object context);
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IUncallHandler.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IUncallHandler.java
new file mode 100644
index 00000000000..e67a727a8b4
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IUncallHandler.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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.debug.core.model;
+
+import org.eclipse.debug.core.commands.IDebugCommandHandler;
+
+/**
+ * Handler interface to perform an Uncall operation (reverse debugging)
+ * @since 6.1
+ */
+public interface IUncallHandler extends IDebugCommandHandler {
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index dc095be01ae..bd147530149 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -198,4 +198,22 @@ CApplicationShortcut.label=Local C/C++ Application
ContextualRunCApplication.description=Runs a local C/C++ application
ContextualDebugCApplication.description=Debugs a local C/C++ application
-
+# Reverse debugging
+ReverseActionSet.label = Reverse Debugging
+ReverseDebuggingCategory.name = Reverse Debugging Commands
+ReverseDebuggingCategory.description = Set of commands for Reverse Debugging
+ReverseToggle.name = Reverse Toggle
+ReverseToggle.description = Toggle Reverse Debugging
+ReverseToggle.label = Toggle Reverse Debugging
+ReverseResume.name = Reverse Resume
+ReverseResume.description = Perform Reverse Resume
+ReverseResume.label = Reverse Resume
+ReverseStepInto.name = Reverse StepInto
+ReverseStepInto.description = Perform Reverse StepInto
+ReverseStepInto.label = Reverse StepInto
+ReverseStepOver.name = Reverse StepOver
+ReverseStepOver.description = Perform Reverse StepOver
+ReverseStepOver.label = Reverse StepOver
+Uncall.name = Uncall
+Uncall.description = Perform Uncall
+Uncall.label = Uncall
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 8ce4755556e..e313695e81e 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -1908,5 +1908,365 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseResumeCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseResumeCommandHandler.java
new file mode 100644
index 00000000000..f733cfc803c
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseResumeCommandHandler.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.debug.internal.ui.commands;
+
+import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
+import org.eclipse.debug.ui.actions.DebugCommandHandler;
+
+/**
+ * Command handler to trigger a reverse resume operation
+ *
+ * @since 6.1
+ */
+public class ReverseResumeCommandHandler extends DebugCommandHandler {
+ @Override
+ protected Class> getCommandType() {
+ return IReverseResumeHandler.class;
+ }
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseStepIntoCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseStepIntoCommandHandler.java
new file mode 100644
index 00000000000..73078f614bc
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseStepIntoCommandHandler.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.debug.internal.ui.commands;
+
+import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
+import org.eclipse.debug.ui.actions.DebugCommandHandler;
+
+/**
+ * Command handler to trigger a reverse stepinto operation
+ *
+ * @since 6.1
+ */
+public class ReverseStepIntoCommandHandler extends DebugCommandHandler {
+ @Override
+ protected Class> getCommandType() {
+ return IReverseStepIntoHandler.class;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseStepOverCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseStepOverCommandHandler.java
new file mode 100644
index 00000000000..d839a6aecab
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseStepOverCommandHandler.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.debug.internal.ui.commands;
+
+import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
+import org.eclipse.debug.ui.actions.DebugCommandHandler;
+
+/**
+ * Command handler to trigger a reverse stepover operation
+ *
+ * @since 6.1
+ */
+public class ReverseStepOverCommandHandler extends DebugCommandHandler {
+ @Override
+ protected Class> getCommandType() {
+ return IReverseStepOverHandler.class;
+ }
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseToggleCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseToggleCommandHandler.java
new file mode 100644
index 00000000000..cb78bb62e64
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/ReverseToggleCommandHandler.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.debug.internal.ui.commands;
+
+import java.util.Map;
+
+import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.actions.DebugCommandHandler;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.menus.UIElement;
+
+/**
+ * Command handler to toggle reverse debugging mode
+ *
+ * @since 6.1
+ */
+public class ReverseToggleCommandHandler extends DebugCommandHandler implements IDebugContextListener, IElementUpdater {
+ @Override
+ protected Class> getCommandType() {
+ return IReverseToggleHandler.class;
+ }
+
+ //
+ // The below logic allows us to keep the checked state of the toggle button
+ // properly set. This is because in some case, the checked state may change
+ // without the user actually pressing the button. For instance, if we restart
+ // the inferior, the toggle may automatically turn off.
+ // To figure this out, whenever a debug context changes, we make sure we are
+ // showing the proper checked state.
+ //
+
+ // We must hard-code the command id so as to know it from the very start (bug 290699)
+ private static final String REVERSE_TOGGLE_COMMAND_ID = "org.eclipse.cdt.debug.ui.command.reverseToggle"; //$NON-NLS-1$
+
+ private Object fActiveContext = null;
+ private IReverseToggleHandler fTargetAdapter = null;
+ private IDebugContextService fContextService = null;
+
+ public ReverseToggleCommandHandler() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ fContextService = DebugUITools.getDebugContextManager().getContextService(window);
+ fContextService.addPostDebugContextListener(this);
+
+ // This constructor might be called after the launch, so we must refresh here too.
+ // This can happen if we activate the action set after the launch.
+ refresh(fContextService.getActiveContext());
+ }
+
+ @Override
+ public void dispose() {
+ // Must use the stored service. If we try to fetch the service
+ // again with the workbenchWindow, it may fail if the window is
+ // already closed.
+ fContextService.removePostDebugContextListener(this);
+ fTargetAdapter = null;
+ super.dispose();
+ }
+
+ public void debugContextChanged(DebugContextEvent event) {
+ refresh(event.getContext());
+ }
+
+ private void refresh(ISelection selection) {
+ fTargetAdapter = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ if (!ss.isEmpty()) {
+ fActiveContext = ss.getFirstElement();
+ if (fActiveContext instanceof IAdaptable) {
+ fTargetAdapter = getAdapter((IAdaptable) fActiveContext);
+ }
+ }
+ }
+
+ ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ if (commandService != null) {
+ commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null);
+ }
+ }
+
+ private IReverseToggleHandler getAdapter(IAdaptable adaptable) {
+ IReverseToggleHandler adapter = (IReverseToggleHandler)adaptable.getAdapter(IReverseToggleHandler.class);
+ if (adapter == null) {
+ IAdapterManager adapterManager = Platform.getAdapterManager();
+ if (adapterManager.hasAdapter(adaptable, getCommandType().getName())) {
+ adapter = (IReverseToggleHandler)adapterManager.loadAdapter(adaptable, IReverseToggleHandler.class.getName());
+ }
+ }
+ return adapter;
+ }
+
+ public void updateElement(UIElement element,
+ @SuppressWarnings("unchecked") Map parameters) {
+ // Make sure the toggle state reflects the actual state
+ // We must check this, in case we have multiple launches
+ // or if we re-launch (restart)
+ if (fTargetAdapter != null && fTargetAdapter.toggleNeedsUpdating()){
+ boolean toggled = fTargetAdapter.isReverseToggled(fActiveContext);
+ element.setChecked(toggled);
+ }
+ }
+}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/UncallCommandHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/UncallCommandHandler.java
new file mode 100644
index 00000000000..86c710c61ef
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/commands/UncallCommandHandler.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.debug.internal.ui.commands;
+
+import org.eclipse.cdt.debug.core.model.IUncallHandler;
+import org.eclipse.debug.ui.actions.DebugCommandHandler;
+
+/**
+ * Command handler to trigger an uncall operation
+ *
+ * @since 6.1
+ */
+public class UncallCommandHandler extends DebugCommandHandler {
+ @Override
+ protected Class> getCommandType() {
+ return IUncallHandler.class;
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.properties
index a442456f720..3ba2603d009 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.properties
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.properties
@@ -15,28 +15,6 @@ providerName=Eclipse CDT
action.connect.label = Connect...
action.connect.tooltip = Connect to a process
-actionSet.reverse.label = Reverse Debugging
-actionSet.reverse.description = Reverse Debugging
-
-command.reverseCategory.name = Reverse Debugging Commands
-command.reverseCategory.description = Set of commands for Reverse Debugging
-
-command.reverseToggle.name = Reverse Toggle
-command.reverseToggle.description = Toggle Reverse Debugging
-command.reverseToggle.label = Toggle Reverse Debugging
-command.reverseResume.name = Reverse Resume
-command.reverseResume.description = Perform Reverse Resume
-command.reverseResume.label = Reverse Resume
-command.reverseStepInto.name = Reverse StepInto
-command.reverseStepInto.description = Perform Reverse StepInto
-command.reverseStepInto.label = Reverse StepInto
-command.reverseStepOver.name = Reverse StepOver
-command.reverseStepOver.description = Perform Reverse StepOver
-command.reverseStepOver.label = Reverse StepOver
-command.uncall.name = Uncall
-command.uncall.description = Perform Uncall
-command.uncall.label = Uncall
-
gdbPreferencePage.name = GDB
launchTab.main.name=Main
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml
index 3319b18d3c2..b6145902b6b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/plugin.xml
@@ -266,325 +266,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java
index 2cecd16b112..e7da6be59fe 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java
@@ -16,7 +16,12 @@ import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.cdt.debug.core.model.IRestart;
+import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
+import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
+import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
+import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
+import org.eclipse.cdt.debug.core.model.IUncallHandler;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
import org.eclipse.cdt.dsf.debug.ui.actions.DsfResumeCommand;
@@ -31,21 +36,16 @@ import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.DefaultRefreshAllTarget;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.IRefreshAllTarget;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory;
import org.eclipse.cdt.dsf.gdb.actions.IConnect;
-import org.eclipse.cdt.dsf.gdb.actions.IReverseResumeHandler;
-import org.eclipse.cdt.dsf.gdb.actions.IReverseStepIntoHandler;
-import org.eclipse.cdt.dsf.gdb.actions.IReverseStepOverHandler;
-import org.eclipse.cdt.dsf.gdb.actions.IReverseToggleHandler;
-import org.eclipse.cdt.dsf.gdb.actions.IUncallHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.DsfTerminateCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbConnectCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbDisconnectCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand;
-import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseResumeCommand;
-import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseStepIntoCommand;
-import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseStepOverCommand;
-import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseToggleCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbSteppingModeTarget;
-import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbUncallCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseResumeCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepIntoCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepOverCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseToggleCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbUncallCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.GdbViewModelAdapter;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java
index 13ec0919d81..2b6e7c5edda 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseDebuggingPropertyTester.java
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
+import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
-import org.eclipse.cdt.dsf.gdb.actions.IReverseToggleHandler;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.debug.ui.DebugUITools;
@@ -54,15 +54,15 @@ public class ReverseDebuggingPropertyTester extends PropertyTester {
}
private boolean test(IDMVMContext context) {
+ boolean result = false;
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(context.getDMContext(), ICommandControlDMContext.class);
if (controlDmc != null) {
IReverseToggleHandler toggle = (IReverseToggleHandler)(controlDmc.getAdapter(IReverseToggleHandler.class));
if (toggle != null) {
- boolean t= toggle.isReverseToggled(controlDmc);
- return t;
+ result = toggle.isReverseToggled(controlDmc);
}
}
- return false;
+ return result;
}
private static Object getContextSelectionForPart(IWorkbenchPart part) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseResumeCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseResumeCommandHandler.java
deleted file mode 100644
index 3aada8a177b..00000000000
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseResumeCommandHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.gdb.internal.ui.actions;
-
-import org.eclipse.cdt.dsf.gdb.actions.IReverseResumeHandler;
-import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * Command handler to trigger a reverse resume operation
- *
- * @since 2.0
- */
-public class ReverseResumeCommandHandler extends RetargetDebugContextCommand {
-
- @Override
- protected boolean canPerformCommand(Object target, ISelection debugContext) {
- return ((IReverseResumeHandler)target).canReverseResume(debugContext);
- }
-
- @Override
- protected Class> getAdapterClass() {
- return IReverseResumeHandler.class;
- }
-
- @Override
- protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
- ((IReverseResumeHandler)target).reverseResume(debugContext);
- }
-}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseStepIntoCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseStepIntoCommandHandler.java
deleted file mode 100644
index 7cc35a48513..00000000000
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseStepIntoCommandHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.gdb.internal.ui.actions;
-
-import org.eclipse.cdt.dsf.gdb.actions.IReverseStepIntoHandler;
-import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * Command handler to trigger a reverse stepinto operation
- *
- * @since 2.0
- */
-public class ReverseStepIntoCommandHandler extends RetargetDebugContextCommand {
-
- @Override
- protected boolean canPerformCommand(Object target, ISelection debugContext) {
- return ((IReverseStepIntoHandler)target).canReverseStepInto(debugContext);
- }
-
- @Override
- protected Class> getAdapterClass() {
- return IReverseStepIntoHandler.class;
- }
-
- @Override
- protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
- ((IReverseStepIntoHandler)target).reverseStepInto(debugContext);
- }
-}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseStepOverCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseStepOverCommandHandler.java
deleted file mode 100644
index 2e799f143de..00000000000
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseStepOverCommandHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.gdb.internal.ui.actions;
-
-import org.eclipse.cdt.dsf.gdb.actions.IReverseStepOverHandler;
-import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * Command handler to trigger a reverse stepover operation
- *
- * @since 2.0
- */
-public class ReverseStepOverCommandHandler extends RetargetDebugContextCommand {
-
- @Override
- protected boolean canPerformCommand(Object target, ISelection debugContext) {
- return ((IReverseStepOverHandler)target).canReverseStepOver(debugContext);
- }
-
- @Override
- protected Class> getAdapterClass() {
- return IReverseStepOverHandler.class;
- }
-
- @Override
- protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
- ((IReverseStepOverHandler)target).reverseStepOver(debugContext);
- }
-}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseToggleCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseToggleCommandHandler.java
deleted file mode 100644
index 6c0d229d2c9..00000000000
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ReverseToggleCommandHandler.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.gdb.internal.ui.actions;
-
-import java.util.Map;
-
-import org.eclipse.cdt.dsf.gdb.actions.IReverseToggleHandler;
-import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.menus.UIElement;
-
-/**
- * Command handler to toggle reverse debugging mode
- *
- * @since 2.0
- */
-public class ReverseToggleCommandHandler extends RetargetDebugContextCommand implements IElementUpdater {
-
- @Override
- protected boolean canPerformCommand(Object target, ISelection debugContext) {
- return ((IReverseToggleHandler)target).canToggleReverse(debugContext);
- }
-
- @Override
- protected Class> getAdapterClass() {
- return IReverseToggleHandler.class;
- }
-
- @Override
- protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
- ((IReverseToggleHandler)target).toggleReverse(debugContext);
- }
-
- public void updateElement(UIElement element, Map parameters) {
- // Make sure the toggle state reflects the actual state
- // We must check this, in case we have multiple launches
- // or if we re-launch
- if (getTargetAdapter() == null) {
- element.setChecked(false);
- } else {
- boolean toggled = ((IReverseToggleHandler)getTargetAdapter()).isReverseToggled(getDebugContext());
- element.setChecked(toggled);
- }
- }
-}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/UncallCommandHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/UncallCommandHandler.java
deleted file mode 100644
index 6d0ae713b9e..00000000000
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/UncallCommandHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.gdb.internal.ui.actions;
-
-import org.eclipse.cdt.dsf.gdb.actions.IUncallHandler;
-import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * Command handler to trigger an uncall operation
- *
- * @since 2.0
- */
-public class UncallCommandHandler extends RetargetDebugContextCommand {
-
- @Override
- protected boolean canPerformCommand(Object target, ISelection debugContext) {
- return ((IUncallHandler)target).canUncall(debugContext);
- }
-
- @Override
- protected Class> getAdapterClass() {
- return IUncallHandler.class;
- }
-
- @Override
- protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
- ((IUncallHandler)target).uncall(debugContext);
- }
-}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbAbstractReverseStepCommand.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java
similarity index 55%
rename from dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbAbstractReverseStepCommand.java
rename to dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java
index 31d9c6f5567..002892facf0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbAbstractReverseStepCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbAbstractReverseStepCommand.java
@@ -8,7 +8,7 @@
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
+package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
import java.util.concurrent.ExecutionException;
@@ -27,14 +27,20 @@ import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.IRequest;
+import org.eclipse.debug.core.commands.AbstractDebugCommand;
+import org.eclipse.debug.core.commands.IDebugCommandRequest;
+import org.eclipse.debug.core.commands.IEnabledStateRequest;
-/**
- * @since 2.0
+/**
+ * Base class handling the work of a Reverse Step command.
+ *
+ * @since 2.1
*/
@Immutable
-public abstract class GdbAbstractReverseStepCommand {
+public abstract class GdbAbstractReverseStepCommand extends AbstractDebugCommand {
private final DsfExecutor fExecutor;
private final DsfServicesTracker fTracker;
@@ -52,12 +58,53 @@ public abstract class GdbAbstractReverseStepCommand {
fTracker.dispose();
}
- protected boolean canReverseStep(ISelection debugContext) {
- final IExecutionDMContext dmc = getContext(debugContext);
-
+ @Override
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
+ if (targets.length != 1) {
+ return;
+ }
+
+ final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
if (dmc == null) {
- return false;
+ return;
}
+
+ final StepType stepType = getStepType();
+ Query