1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

[249223] Make ResumeWithoutSignal retargettable. Add ResumeWithoutSignal action to DSF-GDB, but this is not complete because DSF-GDB does not handle the signal stuff yet.

This commit is contained in:
Marc Khouzam 2010-03-11 19:19:38 +00:00
parent 438a83dada
commit 6b01652bf6
10 changed files with 345 additions and 112 deletions

View file

@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright (c) 2010 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 resume without signal operation
*
* @since 7.0
*/
public interface IResumeWithoutSignalHandler extends IDebugCommandHandler {
}

View file

@ -84,8 +84,6 @@ LoadSymbolsForAllAction.tooltip=Load Symbols For All Modules
SignalAction.label=Resume With Signal
SignalAction.tooltip=Resume With Signal
SignalZeroAction.label=Resume Without Signal
SignalZeroAction.tooltip=Resume Ignoring Signal
SignalPropertiesAction.label=Signal Properties...
SignalPropertiesAction.tooltip=Open Signal Properties Dialog
@ -200,6 +198,14 @@ CApplicationShortcut.label=Local C/C++ Application
ContextualRunCApplication.description=Runs a local C/C++ application
ContextualDebugCApplication.description=Debugs a local C/C++ application
#Run Control commands
RunControlCategory.name=Run Control Commands
RunControlCategory.description=Set of commands for Run Control
ResumeWithoutSignal.name=Resume Without Signal
ResumeWithoutSignal.description=Resume Without Signal
ResumeWithoutSignal.label=Resume Without Signal
ResumeWithoutSignal.tooltip=Resume Ignoring Signal
# Reverse debugging
ReverseActionSet.label = Reverse Debugging
ReverseDebuggingCategory.name = Reverse Debugging Commands

View file

@ -263,16 +263,6 @@
helpContextId="move_to_line_action_context"
label="%GlobalMoveToLineAction.label"
menubarPath="org.eclipse.ui.run/stepGroup"/>
<action
id="org.eclipse.cdt.debug.internal.ui.actions.SignalZeroWorkbenchActionDelegate"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalZeroWorkbenchActionDelegate"
disabledIcon="icons/dlcl16/signal0_co.gif"
icon="icons/elcl16/signal0_co.gif"
helpContextId="resume_without_signal_action_context"
label="%SignalZeroAction.label"
menubarPath="org.eclipse.ui.run/stepGroup"
tooltip="%SignalZeroAction.tooltip">
</action>
<action
id="org.eclipse.cdt.debug.ui.internal.actions.RestartActionDelegate"
class="org.eclipse.cdt.debug.internal.ui.actions.RestartActionDelegate"
@ -284,6 +274,39 @@
</action>
</actionSet>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.run?endof=stepGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.resumeWithoutSignal"
disabledIcon="icons/dlcl16/signal0_co.gif"
helpContextId="resume_without_signal_action_context"
icon="icons/elcl16/signal0_co.gif"
label="%ResumeWithoutSignal.label"
style="push"
tooltip="%ResumeWithoutSignal.tooltip">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsDebugActionSetActive">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?after=threadGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.resumeWithoutSignal"
disabledIcon="icons/dlcl16/signal0_co.gif"
helpContextId="resume_without_signal_action_context"
icon="icons/elcl16/signal0_co.gif"
label="%ResumeWithoutSignal.label"
style="push"
tooltip="%ResumeWithoutSignal.tooltip">
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.menus">
@ -392,27 +415,6 @@
</pluginState>
</enablement>
</action>
<action
helpContextId="signal_zero_action_context"
enablesFor="1"
label="%SignalZeroAction.label"
tooltip="%SignalZeroAction.tooltip"
icon="icons/elcl16/signal0_co.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalZeroWorkbenchActionDelegate"
menubarPath="threadGroup"
id="org.eclipse.cdt.debug.internal.ui.actions.SignalZeroWorkbenchActionDelegate">
<enablement>
<and>
<pluginState
id="org.eclipse.cdt.debug.ui"
value="activated">
</pluginState>
<objectClass
name="org.eclipse.cdt.debug.core.model.IResumeWithoutSignal">
</objectClass>
</and>
</enablement>
</action>
</viewerContribution>
<viewerContribution
targetID="#CEditorRulerContext"
@ -606,10 +608,6 @@
</enablement>
</action>
</objectContribution>
<objectContribution
objectClass="org.eclipse.cdt.debug.core.model.IResumeWithoutSignal"
id="org.eclipse.cdt.debug.ui.DebugTargetActions">
</objectContribution>
<objectContribution
objectClass="org.eclipse.cdt.debug.core.model.ICastToType"
id="org.eclipse.cdt.debug.ui.VariableActions">
@ -1571,6 +1569,27 @@
type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
</adapter>
</factory>
<factory
adaptableType="org.eclipse.cdt.debug.core.model.ICStackFrame"
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory">
<adapter
type="org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler">
</adapter>
</factory>
<factory
adaptableType="org.eclipse.cdt.debug.core.model.ICThread"
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory">
<adapter
type="org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler">
</adapter>
</factory>
<factory
adaptableType="org.eclipse.cdt.debug.core.model.ICDebugTarget"
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory">
<adapter
type="org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler">
</adapter>
</factory>
</extension>
<extension
point="org.eclipse.ui.themes">
@ -2038,6 +2057,18 @@
id="org.eclipse.cdt.debug.ui.command.saveTraceData"
name="%SaveTraceData.name">
</command>
<category
description="%RunControlCategory.description"
id="org.eclipse.cdt.debug.ui.category.runControl"
name="%RunControlCategory.name">
</category>
<command
categoryId="org.eclipse.cdt.debug.ui.category.runControl"
description="%ResumeWithoutSignal.description"
helpContextId="resume_without_signal_action_context"
id="org.eclipse.cdt.debug.ui.command.resumeWithoutSignal"
name="%ResumeWithoutSignal.name">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
@ -2073,6 +2104,11 @@
class="org.eclipse.cdt.debug.internal.ui.commands.SaveTraceDataCommandHandler"
commandId="org.eclipse.cdt.debug.ui.command.saveTraceData">
</handler>
<handler
class="org.eclipse.cdt.debug.internal.ui.commands.ResumeWithoutSignalCommandHandler"
commandId="org.eclipse.cdt.debug.ui.command.resumeWithoutSignal"
helpContextId="resume_without_signal_action_context">
</handler>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
@ -2118,6 +2154,18 @@
</iterate>
</with>
</definition>
<definition
id="org.eclipse.cdt.debug.ui.testIsDebugActionSetActive">
<with
variable="activeContexts">
<iterate
operator="or">
<equals
value="org.eclipse.cdt.debug.ui.debugActionSet">
</equals>
</iterate>
</with>
</definition>
</extension>
<extension
point="org.eclipse.ui.bindings">

View file

@ -20,9 +20,6 @@ LoadSymbolsForAllActionDelegate.Error_1=Error
LoadSymbolsForAllActionDelegate.0=Operation failed.
LoadModuleSymbolsActionDelegate.0=Unable to load symbols.
LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols.
SignalZeroWorkbenchActionDelegate.0=Exceptions occurred attempting to resume without signal.
SignalZeroWorkbenchActionDelegate.1=Resume without signal failed.
SignalZeroWorkbenchActionDelegate.2=Resume Without Signal
SignalZeroObjectActionDelegate.0=Unable to resume ignoring the signal.
SignalZeroObjectActionDelegate.1=Operation failed.
RunToLineActionDelegate.Error_1=Error

View file

@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler;
import org.eclipse.cdt.debug.internal.ui.commands.ResumeWithoutSignalCommand;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.ui.actions.IRunToLineTarget;
@ -32,6 +34,9 @@ public class RetargettableActionAdapterFactory implements IAdapterFactory {
}
if ( adapterType == IMoveToLineTarget.class ) {
return new MoveToLineAdapter();
}
if ( adapterType == IResumeWithoutSignalHandler.class ) {
return new ResumeWithoutSignalCommand();
}
return null;
}
@ -40,6 +45,9 @@ public class RetargettableActionAdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
public Class[] getAdapterList() {
return new Class[]{ IRunToLineTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class };
return new Class[]{ IRunToLineTarget.class,
IResumeAtLineTarget.class,
IMoveToLineTarget.class,
IResumeWithoutSignalHandler.class };
}
}

View file

@ -1,71 +0,0 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 QNX Software Systems 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:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.debug.core.DebugException;
/**
* The workbench delegate of the "Resume Without Signal" action.
*/
public class SignalZeroWorkbenchActionDelegate extends AbstractListenerActionDelegate {
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(java.lang.Object)
*/
protected void doAction( Object element ) throws DebugException {
if ( element instanceof IResumeWithoutSignal ) {
((IResumeWithoutSignal)element).resumeWithoutSignal();
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(java.lang.Object)
*/
protected boolean isEnabledFor( Object element ) {
if ( element instanceof IResumeWithoutSignal ) {
return ((IResumeWithoutSignal)element).canResumeWithoutSignal();
}
return false;
}
/**
* @see AbstractDebugActionDelegate#getStatusMessage()
*/
protected String getStatusMessage() {
return ActionMessages.getString( "SignalZeroWorkbenchActionDelegate.0" ); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
*/
protected String getErrorDialogMessage() {
return ActionMessages.getString( "SignalZeroWorkbenchActionDelegate.1" ); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogTitle()
*/
protected String getErrorDialogTitle() {
return ActionMessages.getString( "SignalZeroWorkbenchActionDelegate.2" ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isRunInBackground()
*/
protected boolean isRunInBackground() {
return true;
}
}

View file

@ -0,0 +1,53 @@
/*******************************************************************************
* Copyright (c) 2010 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.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.core.commands.AbstractDebugCommand;
import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* The handler for the "Resume Without Signal" command.
*
* @since 7.0
*/
public class ResumeWithoutSignalCommand extends AbstractDebugCommand implements IResumeWithoutSignalHandler {
@Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
if (targets.length != 1) {
return;
}
IResumeWithoutSignal target = (IResumeWithoutSignal)targets[0];
target.resumeWithoutSignal();
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request) throws CoreException {
if (targets.length != 1) {
return false;
}
IResumeWithoutSignal target = (IResumeWithoutSignal)targets[0];
return target.canResumeWithoutSignal();
}
@Override
protected Object getTarget(Object element) {
return DebugPlugin.getAdapter(element, IResumeWithoutSignal.class);
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2010 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.IResumeWithoutSignalHandler;
import org.eclipse.debug.ui.actions.DebugCommandHandler;
/**
* Command handler to trigger a resume without signal operation
*
* @since 7.0
*/
public class ResumeWithoutSignalCommandHandler extends DebugCommandHandler {
@Override
protected Class<?> getCommandType() {
return IResumeWithoutSignalHandler.class;
}
}

View file

@ -17,6 +17,7 @@ import java.util.WeakHashMap;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler;
import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
@ -44,6 +45,7 @@ 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.GdbSteppingModeTarget;
import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbResumeWithoutSignalCommand;
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;
@ -101,6 +103,7 @@ public class GdbAdapterFactory
final DsfSuspendCommand fSuspendCommand;
final DsfResumeCommand fResumeCommand;
final GdbReverseResumeCommand fReverseResumeCommand;
final GdbResumeWithoutSignalCommand fResumeWithoutSignalCommand;
final GdbRestartCommand fRestartCommand;
final DsfTerminateCommand fTerminateCommand;
final GdbConnectCommand fConnectCommand;
@ -144,6 +147,7 @@ public class GdbAdapterFactory
fSuspendCommand = new DsfSuspendCommand(session);
fResumeCommand = new DsfResumeCommand(session);
fReverseResumeCommand = new GdbReverseResumeCommand(session);
fResumeWithoutSignalCommand = new GdbResumeWithoutSignalCommand(session);
fRestartCommand = new GdbRestartCommand(session, fLaunch);
fTerminateCommand = new DsfTerminateCommand(session);
fConnectCommand = new GdbConnectCommand(session);
@ -166,6 +170,7 @@ public class GdbAdapterFactory
session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand);
session.registerModelAdapter(IResumeHandler.class, fResumeCommand);
session.registerModelAdapter(IReverseResumeHandler.class, fReverseResumeCommand);
session.registerModelAdapter(IResumeWithoutSignalHandler.class, fResumeWithoutSignalCommand);
session.registerModelAdapter(IRestart.class, fRestartCommand);
session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand);
session.registerModelAdapter(IConnect.class, fConnectCommand);
@ -214,6 +219,7 @@ public class GdbAdapterFactory
session.unregisterModelAdapter(ISuspendHandler.class);
session.unregisterModelAdapter(IResumeHandler.class);
session.unregisterModelAdapter(IReverseResumeHandler.class);
session.unregisterModelAdapter(IResumeWithoutSignalHandler.class);
session.unregisterModelAdapter(IRestart.class);
session.unregisterModelAdapter(ITerminateHandler.class);
session.unregisterModelAdapter(IConnect.class);
@ -235,6 +241,7 @@ public class GdbAdapterFactory
fSuspendCommand.dispose();
fResumeCommand.dispose();
fReverseResumeCommand.dispose();
fResumeWithoutSignalCommand.dispose();
fRestartCommand.dispose();
fTerminateCommand.dispose();
fConnectCommand.dispose();

View file

@ -0,0 +1,138 @@
/*******************************************************************************
* Copyright (c) 2010 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.commands;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
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.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;
/**
* Command performing a resume without signal.
*
* @since 2.1
*/
public class GdbResumeWithoutSignalCommand extends AbstractDebugCommand implements IResumeWithoutSignalHandler {
private final DsfExecutor fExecutor;
private final DsfServicesTracker fTracker;
public GdbResumeWithoutSignalCommand(DsfSession session) {
fExecutor = session.getExecutor();
fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId());
}
public void dispose() {
fTracker.dispose();
}
@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;
}
Query<Object> query = new Query<Object>() {
@Override
public void execute(DataRequestMonitor<Object> rm) {
IRunControl runControl = fTracker.getService(IRunControl.class);
if (runControl != null) {
runControl.resume(dmc, rm);
} else {
rm.done();
}
}
};
try {
fExecutor.execute(query);
query.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
throws CoreException
{
if (targets.length != 1) {
return false;
}
final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
if (dmc == null) {
return false;
}
// Currently, we don't properly support the handling of signal in DSF-GDB, so we cannot
// really enable this command
// Query<Boolean> query = new Query<Boolean>() {
// @Override
// public void execute(DataRequestMonitor<Boolean> rm) {
// IRunControl runControl = fTracker.getService(IRunControl.class);
//
// if (runControl != null) {
// runControl.canResume(dmc, rm);
// } else {
// rm.setData(false);
// rm.done();
// }
// }
// };
// try {
// fExecutor.execute(query);
// return query.get();
// } catch (InterruptedException e) {
// } catch (ExecutionException e) {
// } catch (RejectedExecutionException e) {
// // Can be thrown if the session is shutdown
// }
return false;
}
@Override
protected Object getTarget(Object element) {
if (element instanceof IDMVMContext) {
return element;
}
return null;
}
@Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return false;
}
}