From a729d837b819017e66c8ab05dac9600f421e43af Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 13 Jan 2003 22:25:31 +0000 Subject: [PATCH] Added the 'IRunToAddress' interface to support the 'Run To Line' action in disassembly. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 6 ++++ .../cdt/debug/core/model/ICDebugTarget.java | 1 + .../cdt/debug/core/model/IRunToAddress.java | 31 +++++++++++++++++++ .../internal/core/model/CDebugTarget.java | 30 ++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.java diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index d8d2959c3f1..1c02bf93efa 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,9 @@ +2003-01-13 Mikhail Khodjaiants + Added the 'IRunToAddress' interface to support the 'Run To Line' action in disassembly. + * ICDebugTarget.java: extends IRunToAddress + * IRunToAddress.java: new interface + * CDebugTarget.java: implementation + 2003-01-13 Mikhail Khodjaiants Fix in the thread created event handler: do nothing if thread has already created. * CDebugTarget.java 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 5a5aebb2a61..114cf40b0fb 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 @@ -20,6 +20,7 @@ public interface ICDebugTarget extends IDebugTarget, IExecFileInfo, IRestart, IRunToLine, + IRunToAddress, IState, ISwitchToThread, ICBreakpointManager diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.java new file mode 100644 index 00000000000..04d1af7ba19 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IRunToAddress.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.debug.core.DebugException; + +/** + * + * Provides the ability to run a debug target to the given address. + * + * @since Jan 13, 2003 + */ +public interface IRunToAddress +{ + /** + * Returns whether this operation is currently available for this element. + * + * @return whether this operation is currently available + */ + public boolean canRunToAddress( long address ); + + /** + * Causes this element to run to specified address. + * + * @exception DebugException on failure. Reasons include: + */ + public void runToAddress( long address ) 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 1626dd34785..806bf152169 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 @@ -62,6 +62,7 @@ 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.IRunToAddress; import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.core.model.IState; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; @@ -861,6 +862,8 @@ public class CDebugTarget extends CDebugElement return this; if ( adapter.equals( IRunToLine.class ) ) return this; + if ( adapter.equals( IRunToAddress.class ) ) + return this; if ( adapter.equals( ICBreakpointManager.class ) ) return this; if ( adapter.equals( DisassemblyManager.class ) ) @@ -2107,4 +2110,31 @@ public class CDebugTarget extends CDebugElement } return 0; } + + /** + * @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long) + */ + public boolean canRunToAddress( long address ) + { + // for now + return canResume(); + } + + /** + * @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToLine(long) + */ + public void runToAddress( long address ) throws DebugException + { + if ( !canRunToAddress( address ) ) + return; + ICDILocation location = getCDISession().getBreakpointManager().createLocation( address ); + try + { + getCDITarget().runUntil( location ); + } + catch( CDIException e ) + { + targetRequestFailed( e.toString(), e ); + } + } }