diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 19af93a9b1d..d40586f2b0d 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,10 @@ +2003-02-05 Mikhail Khodjaiants + Support of the 'Resume At C/C++ Line' action. + * IJumpToLine.java: new + * IJumpToAddress.java: new + * ICDebugTarget.java + * CDebugTarget.java + 2003-02-04 Mikhail Khodjaiants Support of the 'Resume Without Signal' action. * IResumeWithoutSignal.java: new diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java index e94a9c35c00..ba63b674684 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICDebugTarget.java @@ -21,6 +21,8 @@ public interface ICDebugTarget extends IDebugTarget, IRestart, IRunToLine, IRunToAddress, + IJumpToLine, + IJumpToAddress, IResumeWithoutSignal, IState, ISwitchToThread, diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IJumpToAddress.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IJumpToAddress.java new file mode 100644 index 00000000000..44393704a47 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IJumpToAddress.java @@ -0,0 +1,30 @@ +/* + *(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 a debug target at the given address. + * + * @since: Feb 5, 2003 + */ +public interface IJumpToAddress +{ + /** + * Returns whether this operation is currently available for this element. + * + * @return whether this operation is currently available + */ + public boolean canJumpToAddress( long address ); + + /** + * Causes this element to resume the execution at the specified address. + * + * @exception DebugException on failure. Reasons include: + */ + public void jumpToAddress( long address ) throws DebugException; +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IJumpToLine.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IJumpToLine.java new file mode 100644 index 00000000000..7324fce0d6e --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IJumpToLine.java @@ -0,0 +1,31 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.core.model; + +import org.eclipse.core.resources.IResource; +import org.eclipse.debug.core.DebugException; + +/** + * Provides the ability to resume a debug target at the given line. + * + * @since: Feb 5, 2003 + */ +public interface IJumpToLine +{ + /** + * Returns whether this operation is currently available for this element. + * + * @return whether this operation is currently available + */ + public boolean canJumpToLine( IResource resource, int lineNumber ); + + /** + * Causes this element to resume the execution at the specified line. + * + * @exception DebugException on failure. Reasons include: + */ + public void jumpToLine( IResource resource, int lineNumber ) throws DebugException; +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index 51d8e60acf8..b2e0a38b8f5 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -66,6 +66,8 @@ import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport; import org.eclipse.cdt.debug.core.model.IExecFileInfo; import org.eclipse.cdt.debug.core.model.IGlobalVariable; +import org.eclipse.cdt.debug.core.model.IJumpToAddress; +import org.eclipse.cdt.debug.core.model.IJumpToLine; import org.eclipse.cdt.debug.core.model.IRunToAddress; import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.core.model.IState; @@ -907,6 +909,10 @@ public class CDebugTarget extends CDebugElement return this; if ( adapter.equals( IRunToAddress.class ) ) return this; + if ( adapter.equals( IJumpToLine.class ) ) + return this; + if ( adapter.equals( IJumpToAddress.class ) ) + return this; if ( adapter.equals( ICBreakpointManager.class ) ) return this; if ( adapter.equals( DisassemblyManager.class ) ) @@ -2467,4 +2473,60 @@ public class CDebugTarget extends CDebugElement targetRequestFailed( e.toString(), e ); } } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.IJumpToLine#canJumpToLine(IResource, int) + */ + public boolean canJumpToLine( IResource resource, int lineNumber ) + { + // check if supports jump to line + return canResume(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.IJumpToLine#jumpToLine(IResource, int) + */ + public void jumpToLine( IResource resource, int lineNumber ) throws DebugException + { + if ( !canJumpToLine( resource, lineNumber ) ) + return; + setBreakpoints(); + ICDILocation location = getCDISession().getBreakpointManager().createLocation( resource.getLocation().lastSegment(), null, lineNumber ); + try + { + getCDITarget().jump( location ); + } + catch( CDIException e ) + { + targetRequestFailed( e.toString(), e ); + } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#canJumpToAddress(long) + */ + public boolean canJumpToAddress( long address ) + { + // check if supports jump to address + return canResume(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#jumpToAddress(long) + */ + public void jumpToAddress( long address ) throws DebugException + { + if ( !canJumpToAddress( address ) ) + return; + setBreakpoints(); + ICDILocation location = getCDISession().getBreakpointManager().createLocation( address ); + try + { + getCDITarget().jump( location ); + } + catch( CDIException e ) + { + targetRequestFailed( e.toString(), e ); + } + } } diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 217c1805014..98801fbcf21 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,13 @@ +2003-02-05 Mikhail Khodjaiants + Implementation of the 'Resume At C/C++ Line' action. + * RunToLineActionDelegate.java + * JumpToLineActionDelegate.java + * plugin.properties + * plugin.xml + icons/full/clcl16/jump_co.gif + icons/full/dlcl16/jump_co.gif + icons/full/elcl16/jump_co.gif + 2003-02-04 Mikhail Khodjaiants Implementation of the 'Resume Without Signal' action. * SignalZeroActionDelegate.java diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/jump_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/jump_co.gif new file mode 100644 index 00000000000..7de2134e81d Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/jump_co.gif differ diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/jump_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/jump_co.gif new file mode 100644 index 00000000000..0107e2ecc6c Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/jump_co.gif differ diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/jump_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/jump_co.gif new file mode 100644 index 00000000000..5239257a8b4 Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/jump_co.gif differ diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index 5d49b9ccab5..e0d31abdb37 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -37,6 +37,7 @@ ManageWatchpointAction.label=Add C/C++ &Watchpoint... AddExpressionAction.label=Add C/C++ &Expression... AddAddressBreakpointAction.label=Add &Address Breakpoint... RunToLineAction.label=Run To C/C++ &Line +JumpToLineAction.label=Resume At C/C++ Li&ne ShowFullPathsAction.label=Show Full Paths ShowFullPathsAction.tooltip=Show Full Paths diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 7547fa2d1b8..597d30500b0 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -135,14 +135,14 @@ + + + + + + + + + + + + + + + + + + + + + + + + + value="activated" + id="org.eclipse.cdt.debug.ui"> @@ -965,6 +1027,21 @@ + + + + + + + + + + 0 ) + jumpToAddress( address ); + } + } + catch( CoreException e ) + { + } + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractEditorActionDelegate#initializeDebugTarget() + */ + protected void initializeDebugTarget() + { + setDebugTarget( null ); + IAdaptable context = DebugUITools.getDebugContext(); + if ( context != null && context instanceof IDebugElement ) + { + IDebugTarget target = ((IDebugElement)context).getDebugTarget(); + if ( target != null && + ( target instanceof IJumpToLine || target instanceof IJumpToAddress ) ) + { + setDebugTarget( target ); + } + } + } + + protected void jumpToLine( IResource resource, int lineNumber ) + { + IJumpToLine target = (IJumpToLine)getDebugTarget().getAdapter( IJumpToLine.class ); + if ( target != null ) + { + if ( !target.canJumpToLine( resource, lineNumber ) ) + { + getTargetPart().getSite().getShell().getDisplay().beep(); + return; + } + try + { + target.jumpToLine( resource, lineNumber ); + } + catch( DebugException e ) + { + CDebugUIPlugin.errorDialog( e.getMessage(), e ); + } + } + } + + protected void jumpToAddress( long address ) + { + IJumpToAddress target = (IJumpToAddress)getDebugTarget().getAdapter( IJumpToAddress.class ); + if ( target != null ) + { + if ( !target.canJumpToAddress( address ) ) + { + getTargetPart().getSite().getShell().getDisplay().beep(); + return; + } + try + { + target.jumpToAddress( address ); + } + catch( DebugException e ) + { + CDebugUIPlugin.errorDialog( e.getMessage(), e ); + } + } + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineActionDelegate.java index 013ac4aa315..e73b2569582 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineActionDelegate.java @@ -94,7 +94,8 @@ public class RunToLineActionDelegate extends AbstractEditorActionDelegate if ( context != null && context instanceof IDebugElement ) { IDebugTarget target = ((IDebugElement)context).getDebugTarget(); - if ( target != null && target instanceof IRunToLine ) + if ( target != null && + ( target instanceof IRunToLine || target instanceof IRunToAddress ) ) { setDebugTarget( target ); } @@ -115,7 +116,8 @@ public class RunToLineActionDelegate extends AbstractEditorActionDelegate if ( element != null && element instanceof IDebugElement ) { IDebugTarget target1 = ((IDebugElement)element).getDebugTarget(); - if ( target1 != null && target1 instanceof IRunToLine ) + if ( target1 != null && + ( target1 instanceof IRunToLine || target1 instanceof IRunToAddress ) ) { target = target1; }