1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Implementation of the 'Resume Without Signal' action.

This commit is contained in:
Mikhail Khodjaiants 2003-02-04 23:47:54 +00:00
parent 54f777824b
commit a8bb45b275
15 changed files with 265 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2003-02-04 Mikhail Khodjaiants
Support of the 'Resume Without Signal' action.
* IResumeWithoutSignal.java: new
* ICDebugTarget.java
* CDebugTarget.java
* CThread.java
* CStackFrame.java
* CSignal.java
2003-02-03 Alain Magloire
* src/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java:

View file

@ -21,6 +21,7 @@ public interface ICDebugTarget extends IDebugTarget,
IRestart,
IRunToLine,
IRunToAddress,
IResumeWithoutSignal,
IState,
ISwitchToThread,
ICBreakpointManager

View file

@ -0,0 +1,33 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.DebugException;
/**
* Provides the ability to resume execution without giving a signal.
* This is useful when the program stopped on account of a signal and would
* ordinary see the signal when resumed.
*
* @since: Feb 4, 2003
*/
public interface IResumeWithoutSignal
{
/**
* Causes this element to resume its execution ignoring a signal.
* Has no effect on an element that is not suspended because of a signal.
*
* @exception DebugException on failure. Reasons include:
*/
public void resumeWithoutSignal() throws DebugException;
/**
* Returns whether this element can currently be resumed without signal.
*
* @return whether this element can currently be resumed without signal
*/
boolean canResumeWithoutSignal();
}

View file

@ -2443,4 +2443,28 @@ public class CDebugTarget extends CDebugElement
{
fSetBreakpoints = retry;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal()
*/
public boolean canResumeWithoutSignal()
{
// Check if the configuration supports this!!!
return ( isSuspended() && getCurrentStateInfo() instanceof ICDISignalReceived );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal()
*/
public void resumeWithoutSignal() throws DebugException
{
try
{
getCDITarget().signal();
}
catch( CDIException e )
{
targetRequestFailed( e.toString(), e );
}
}
}

View file

@ -102,7 +102,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
{
try
{
getCDISignal().signal();
getCDITarget().signal( getCDISignal() );
}
catch( CDIException e )
{

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.core.runtime.IAdaptable;
@ -39,7 +40,8 @@ import org.eclipse.debug.core.model.IVariable;
public class CStackFrame extends CDebugElement
implements IStackFrame,
IStackFrameInfo,
IRestart,
IRestart,
IResumeWithoutSignal,
ICDIEventListener
{
/**
@ -752,4 +754,24 @@ public class CStackFrame extends CDebugElement
{
return fRefreshVariables;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal()
*/
public boolean canResumeWithoutSignal()
{
return ( getDebugTarget() instanceof IResumeWithoutSignal &&
((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal()
*/
public void resumeWithoutSignal() throws DebugException
{
if ( canResumeWithoutSignal() )
{
((IResumeWithoutSignal)getDebugTarget()).resumeWithoutSignal();
}
}
}

View file

@ -32,6 +32,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
import org.eclipse.cdt.debug.core.model.IInstructionStep;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.core.model.ISwitchToFrame;
@ -61,6 +62,7 @@ public class CThread extends CDebugElement
IRestart,
IRunToLine,
IInstructionStep,
IResumeWithoutSignal,
ISwitchToFrame,
ICDIEventListener
{
@ -1158,4 +1160,24 @@ public class CThread extends CDebugElement
{
return fDisposed;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal()
*/
public boolean canResumeWithoutSignal()
{
return ( getDebugTarget() instanceof IResumeWithoutSignal &&
((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal()
*/
public void resumeWithoutSignal() throws DebugException
{
if ( canResumeWithoutSignal() )
{
((IResumeWithoutSignal)getDebugTarget()).resumeWithoutSignal();
}
}
}

View file

@ -1,3 +1,12 @@
2003-02-04 Mikhail Khodjaiants
Implementation of the 'Resume Without Signal' action.
* SignalZeroActionDelegate.java
* plugin.properties
* plugin.xml
icons/full/clcl16/signal0_co.gif
icons/full/dlcl16/signal0_co.gif
icons/full/elcl16/signal0_co.gif
2003-02-04 Mikhail Khodjaiants
'DebugException' handling in the 'Signals' view.
* SignalsView.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

View file

@ -56,4 +56,5 @@ DisassemblyEditor.name=Disassembly Editor
LoadSymbolsAction.label=Load Symbols
SignalAction.label=Deliver Signal
SignalZeroAction.label=Resume Without Signal

View file

@ -698,6 +698,25 @@
</enablement>
</action>
</objectContribution>
<objectContribution
objectClass="org.eclipse.cdt.debug.core.model.IResumeWithoutSignal"
id="org.eclipse.cdt.debug.ui.DebugTargetActions">
<action
label="%SignalZeroAction.label"
icon="icons/full/clcl16/signal0_co.gif"
helpContextId="signal_zero_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalZeroActionDelegate"
menubarPath="threadGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.SignalZeroActionDelegate">
<enablement>
<pluginState
id="org.eclipse.cdt.debug.ui"
value="activated">
</pluginState>
</enablement>
</action>
</objectContribution>
</extension>
<extension
point="org.eclipse.ui.viewActions">

View file

@ -81,7 +81,6 @@ public class SignalActionDelegate implements IObjectActionDelegate
CDebugUIPlugin.log( ms );
}
}
}
}

View file

@ -0,0 +1,123 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.debug.core.DebugException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
/**
* Enter type comment.
*
* @since: Feb 4, 2003
*/
public class SignalZeroActionDelegate implements IObjectActionDelegate
{
private IResumeWithoutSignal fTarget = null;
/**
* Constructor for SignalZeroActionDelegate.
*/
public SignalZeroActionDelegate()
{
super();
}
/* (non-Javadoc)
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run( IAction action )
{
if ( getTarget() != null )
{
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
DebugException.REQUEST_FAILED,
"Unable to resume ignoring signal.",
null );
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{
public void run()
{
try
{
doAction( getTarget() );
}
catch( DebugException e )
{
ms.merge( e.getStatus() );
}
}
} );
if ( !ms.isOK() )
{
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( "Operation failed.", ms );
}
else
{
CDebugUIPlugin.log( ms );
}
}
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( selection instanceof IStructuredSelection )
{
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element instanceof IResumeWithoutSignal )
{
boolean enabled = ((IResumeWithoutSignal)element).canResumeWithoutSignal();
action.setEnabled( enabled );
if ( enabled )
{
setTarget( (IResumeWithoutSignal)element );
return;
}
}
}
action.setEnabled( false );
setTarget( null );
}
protected void doAction( IResumeWithoutSignal target ) throws DebugException
{
target.resumeWithoutSignal();
}
protected IResumeWithoutSignal getTarget()
{
return fTarget;
}
protected void setTarget( IResumeWithoutSignal target )
{
fTarget = target;
}
}