mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[228062] - [run control][disassembly] Integrate DSF with CDT's toggle instruction step mode action.
This commit is contained in:
parent
23afc8c598
commit
05a1a3763b
6 changed files with 227 additions and 119 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Wind River Systems and others.
|
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -27,10 +27,12 @@ public class DsfStepIntoCommand implements IStepIntoHandler {
|
||||||
|
|
||||||
private final DsfExecutor fExecutor;
|
private final DsfExecutor fExecutor;
|
||||||
private final DsfServicesTracker fTracker;
|
private final DsfServicesTracker fTracker;
|
||||||
|
private final DsfSteppingModeTarget fSteppingMode;
|
||||||
|
|
||||||
public DsfStepIntoCommand(DsfSession session) {
|
public DsfStepIntoCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
|
||||||
fExecutor = session.getExecutor();
|
fExecutor = session.getExecutor();
|
||||||
fTracker = new DsfServicesTracker(DsfDebugUIPlugin.getBundleContext(), session.getId());
|
fTracker = new DsfServicesTracker(DsfDebugUIPlugin.getBundleContext(), session.getId());
|
||||||
|
fSteppingMode = steppingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -44,10 +46,11 @@ public class DsfStepIntoCommand implements IStepIntoHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final StepType stepType= getStepType();
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getStepQueueMgr().canEnqueueStep(
|
getStepQueueMgr().canEnqueueStep(
|
||||||
getContext(), StepType.STEP_INTO,
|
getContext(), stepType,
|
||||||
new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), null) {
|
new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), null) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
|
@ -65,11 +68,21 @@ public class DsfStepIntoCommand implements IStepIntoHandler {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final StepType stepType= getStepType();
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getStepQueueMgr().enqueueStep(getContext(), StepType.STEP_INTO);
|
getStepQueueMgr().enqueueStep(getContext(), stepType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the currently active step type
|
||||||
|
*/
|
||||||
|
protected final StepType getStepType() {
|
||||||
|
boolean instructionSteppingEnabled= fSteppingMode != null && fSteppingMode.isInstructionSteppingEnabled();
|
||||||
|
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_INTO : StepType.STEP_INTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Wind River Systems and others.
|
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -27,10 +27,12 @@ public class DsfStepOverCommand implements IStepOverHandler {
|
||||||
|
|
||||||
private final DsfExecutor fExecutor;
|
private final DsfExecutor fExecutor;
|
||||||
private final DsfServicesTracker fTracker;
|
private final DsfServicesTracker fTracker;
|
||||||
|
private final DsfSteppingModeTarget fSteppingMode;
|
||||||
|
|
||||||
public DsfStepOverCommand(DsfSession session) {
|
public DsfStepOverCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
|
||||||
fExecutor = session.getExecutor();
|
fExecutor = session.getExecutor();
|
||||||
fTracker = new DsfServicesTracker(DsfDebugUIPlugin.getBundleContext(), session.getId());
|
fTracker = new DsfServicesTracker(DsfDebugUIPlugin.getBundleContext(), session.getId());
|
||||||
|
fSteppingMode = steppingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -45,9 +47,10 @@ public class DsfStepOverCommand implements IStepOverHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
|
final StepType stepType= getStepType();
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getStepQueueMgr().canEnqueueStep(
|
getStepQueueMgr().canEnqueueStep(
|
||||||
getContext(), StepType.STEP_OVER,
|
getContext(), stepType,
|
||||||
new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), null) {
|
new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), null) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
|
@ -65,11 +68,21 @@ public class DsfStepOverCommand implements IStepOverHandler {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final StepType stepType= getStepType();
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getStepQueueMgr().enqueueStep(getContext(), StepType.STEP_OVER);
|
getStepQueueMgr().enqueueStep(getContext(), stepType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the currently active step type
|
||||||
|
*/
|
||||||
|
protected final StepType getStepType() {
|
||||||
|
boolean instructionSteppingEnabled= fSteppingMode != null && fSteppingMode.isInstructionSteppingEnabled();
|
||||||
|
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_OVER : StepType.STEP_OVER;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2008 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.dd.dsf.debug.ui.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
|
||||||
|
import org.eclipse.cdt.debug.core.model.ITargetProperties;
|
||||||
|
import org.eclipse.core.runtime.Preferences;
|
||||||
|
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public class DsfSteppingModeTarget implements ISteppingModeTarget, ITargetProperties {
|
||||||
|
|
||||||
|
private final Preferences fPreferences;
|
||||||
|
|
||||||
|
public DsfSteppingModeTarget() {
|
||||||
|
fPreferences= new Preferences();
|
||||||
|
fPreferences.setDefault(PREF_INSTRUCTION_STEPPING_MODE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#enableInstructionStepping(boolean)
|
||||||
|
*/
|
||||||
|
public void enableInstructionStepping(boolean enabled) {
|
||||||
|
fPreferences.setValue(PREF_INSTRUCTION_STEPPING_MODE, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#isInstructionSteppingEnabled()
|
||||||
|
*/
|
||||||
|
public boolean isInstructionSteppingEnabled() {
|
||||||
|
return fPreferences.getBoolean(PREF_INSTRUCTION_STEPPING_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#supportsInstructionStepping()
|
||||||
|
*/
|
||||||
|
public boolean supportsInstructionStepping() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.ITargetProperties#addPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
|
||||||
|
*/
|
||||||
|
public void addPropertyChangeListener(IPropertyChangeListener listener) {
|
||||||
|
fPreferences.addPropertyChangeListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.ITargetProperties#removePropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
|
||||||
|
*/
|
||||||
|
public void removePropertyChangeListener(IPropertyChangeListener listener) {
|
||||||
|
fPreferences.removePropertyChangeListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Wind River Systems and others.
|
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -95,8 +95,8 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
|
||||||
session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
|
session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
|
||||||
|
|
||||||
// Initialize retargetable command handler.
|
// Initialize retargetable command handler.
|
||||||
fStepIntoCommand = new DsfStepIntoCommand(session);
|
fStepIntoCommand = new DsfStepIntoCommand(session, null);
|
||||||
fStepOverCommand = new DsfStepOverCommand(session);
|
fStepOverCommand = new DsfStepOverCommand(session, null);
|
||||||
fStepReturnCommand = new DsfStepReturnCommand(session);
|
fStepReturnCommand = new DsfStepReturnCommand(session);
|
||||||
fSuspendCommand = new DsfSuspendCommand(session);
|
fSuspendCommand = new DsfSuspendCommand(session);
|
||||||
fResumeCommand = new DsfResumeCommand(session);
|
fResumeCommand = new DsfResumeCommand(session);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Wind River Systems and others.
|
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.IRestart;
|
import org.eclipse.cdt.debug.core.model.IRestart;
|
||||||
|
import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
import org.eclipse.core.runtime.IAdapterFactory;
|
||||||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||||
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
|
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
|
||||||
|
@ -22,6 +23,7 @@ import org.eclipse.dd.dsf.debug.ui.actions.DsfResumeCommand;
|
||||||
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepIntoCommand;
|
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepIntoCommand;
|
||||||
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepOverCommand;
|
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepOverCommand;
|
||||||
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepReturnCommand;
|
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepReturnCommand;
|
||||||
|
import org.eclipse.dd.dsf.debug.ui.actions.DsfSteppingModeTarget;
|
||||||
import org.eclipse.dd.dsf.debug.ui.actions.DsfSuspendCommand;
|
import org.eclipse.dd.dsf.debug.ui.actions.DsfSuspendCommand;
|
||||||
import org.eclipse.dd.dsf.debug.ui.contexts.DsfSuspendTrigger;
|
import org.eclipse.dd.dsf.debug.ui.contexts.DsfSuspendTrigger;
|
||||||
import org.eclipse.dd.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter;
|
import org.eclipse.dd.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter;
|
||||||
|
@ -73,6 +75,7 @@ public class GdbAdapterFactory
|
||||||
final DsfTerminateCommand fTerminateCommand;
|
final DsfTerminateCommand fTerminateCommand;
|
||||||
final IDebugModelProvider fDebugModelProvider;
|
final IDebugModelProvider fDebugModelProvider;
|
||||||
final DsfSuspendTrigger fSuspendTrigger;
|
final DsfSuspendTrigger fSuspendTrigger;
|
||||||
|
final DsfSteppingModeTarget fSteppingModeTarget;
|
||||||
|
|
||||||
SessionAdapterSet(GdbLaunch launch) {
|
SessionAdapterSet(GdbLaunch launch) {
|
||||||
fLaunch = launch;
|
fLaunch = launch;
|
||||||
|
@ -87,14 +90,16 @@ public class GdbAdapterFactory
|
||||||
}
|
}
|
||||||
session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
|
session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
|
||||||
|
|
||||||
fStepIntoCommand = new DsfStepIntoCommand(session);
|
fSteppingModeTarget= new DsfSteppingModeTarget();
|
||||||
fStepOverCommand = new DsfStepOverCommand(session);
|
fStepIntoCommand = new DsfStepIntoCommand(session, fSteppingModeTarget);
|
||||||
|
fStepOverCommand = new DsfStepOverCommand(session, fSteppingModeTarget);
|
||||||
fStepReturnCommand = new DsfStepReturnCommand(session);
|
fStepReturnCommand = new DsfStepReturnCommand(session);
|
||||||
fSuspendCommand = new DsfSuspendCommand(session);
|
fSuspendCommand = new DsfSuspendCommand(session);
|
||||||
fResumeCommand = new DsfResumeCommand(session);
|
fResumeCommand = new DsfResumeCommand(session);
|
||||||
fRestartCommand = new GdbRestartCommand(session, fLaunch);
|
fRestartCommand = new GdbRestartCommand(session, fLaunch);
|
||||||
fTerminateCommand = new DsfTerminateCommand(session);
|
fTerminateCommand = new DsfTerminateCommand(session);
|
||||||
fSuspendTrigger = new DsfSuspendTrigger(session, fLaunch);
|
fSuspendTrigger = new DsfSuspendTrigger(session, fLaunch);
|
||||||
|
session.registerModelAdapter(ISteppingModeTarget.class, fSteppingModeTarget);
|
||||||
session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
|
session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
|
||||||
session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand);
|
session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand);
|
||||||
session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand);
|
session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand);
|
||||||
|
@ -127,6 +132,7 @@ public class GdbAdapterFactory
|
||||||
session.unregisterModelAdapter(ISourceDisplay.class);
|
session.unregisterModelAdapter(ISourceDisplay.class);
|
||||||
if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose();
|
if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose();
|
||||||
|
|
||||||
|
session.unregisterModelAdapter(ISteppingModeTarget.class);
|
||||||
session.unregisterModelAdapter(IStepIntoHandler.class);
|
session.unregisterModelAdapter(IStepIntoHandler.class);
|
||||||
session.unregisterModelAdapter(IStepOverHandler.class);
|
session.unregisterModelAdapter(IStepOverHandler.class);
|
||||||
session.unregisterModelAdapter(IStepReturnHandler.class);
|
session.unregisterModelAdapter(IStepReturnHandler.class);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Wind River Systems and others.
|
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -33,7 +33,9 @@ import org.eclipse.dd.mi.service.command.commands.MIExecContinue;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecFinish;
|
import org.eclipse.dd.mi.service.command.commands.MIExecFinish;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecInterrupt;
|
import org.eclipse.dd.mi.service.command.commands.MIExecInterrupt;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecNext;
|
import org.eclipse.dd.mi.service.command.commands.MIExecNext;
|
||||||
|
import org.eclipse.dd.mi.service.command.commands.MIExecNextInstruction;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecStep;
|
import org.eclipse.dd.mi.service.command.commands.MIExecStep;
|
||||||
|
import org.eclipse.dd.mi.service.command.commands.MIExecStepInstruction;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIExecUntil;
|
import org.eclipse.dd.mi.service.command.commands.MIExecUntil;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIThreadListIds;
|
import org.eclipse.dd.mi.service.command.commands.MIThreadListIds;
|
||||||
import org.eclipse.dd.mi.service.command.events.MIBreakpointHitEvent;
|
import org.eclipse.dd.mi.service.command.events.MIBreakpointHitEvent;
|
||||||
|
@ -574,6 +576,16 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case INSTRUCTION_STEP_INTO:
|
||||||
|
fConnection.queueCommand(
|
||||||
|
new MIExecStepInstruction(dmc, 1), new DataRequestMonitor<MIInfo>(getExecutor(), rm) {}
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case INSTRUCTION_STEP_OVER:
|
||||||
|
fConnection.queueCommand(
|
||||||
|
new MIExecNextInstruction(dmc, 1), new DataRequestMonitor<MIInfo>(getExecutor(), rm) {}
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
|
|
Loading…
Add table
Reference in a new issue