1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 88558: run-to-line not thread oriented. The IRunTo* and IJumpTo* interfaces moved to ICStackFrame.

This commit is contained in:
Mikhail Khodjaiants 2005-05-24 21:38:42 +00:00
parent 502930fde5
commit 014dc6df44
6 changed files with 172 additions and 162 deletions

View file

@ -1,3 +1,12 @@
2005-05-24 Mikhail Khodjaiants
Bug 88558: run-to-line not thread oriented.
The IRunTo* and IJumpTo* interfaces moved to ICStackFrame.
* ICDebugTarget.java
* ICStackFrame.java
* CDebugTarget.java
* CStackFrame.java
* CThread.java
2005-05-20 Mikhail Khodjaiants
Bug 94139: User-defined register groups.
Added API and group serialization.

View file

@ -20,10 +20,6 @@ import org.eclipse.debug.core.model.IRegisterGroup;
public interface ICDebugTarget extends IDebugTarget,
IExecFileInfo,
IRestart,
IRunToLine,
IRunToAddress,
IJumpToLine,
IJumpToAddress,
IResumeWithoutSignal,
ICDebugElement,
IBreakpointTarget,

View file

@ -18,7 +18,7 @@ import org.eclipse.debug.core.model.IValue;
/**
* C/C++ specific extension of <code>IStackFrame</code>.
*/
public interface ICStackFrame extends IStackFrame, ICDebugElement {
public interface ICStackFrame extends IRunToLine, IRunToAddress, IJumpToLine, IJumpToAddress, IStackFrame, ICDebugElement {
/**
* Returns the address of this stack frame.

View file

@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@ -73,11 +72,7 @@ import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport;
import org.eclipse.cdt.debug.core.model.IDisassembly;
import org.eclipse.cdt.debug.core.model.IExecFileInfo;
import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
import org.eclipse.cdt.debug.core.model.IJumpToLine;
import org.eclipse.cdt.debug.core.model.IRegisterDescriptor;
import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.sourcelookup.CDirectorySourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceLookupChangeListener;
@ -813,14 +808,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return this;
if ( adapter.equals( IExecFileInfo.class ) )
return this;
if ( adapter.equals( IRunToLine.class ) )
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( IBreakpointTarget.class ) )
return this;
if ( adapter.equals( CBreakpointManager.class ) )
@ -1303,52 +1290,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(java.lang.String, int)
*/
public boolean canRunToLine( String fileName, int lineNumber ) {
// check if supports run to line
return canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(java.lang.String, int, boolean)
*/
public void runToLine( String fileName, int lineNumber, boolean skipBreakpoints ) throws DebugException {
if ( !canRunToLine( fileName, lineNumber ) )
return;
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( true );
}
ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber );
try {
getCDITarget().stepUntil( location );
}
catch( CDIException e ) {
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( false );
}
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(org.eclipse.core.resources.IFile, int)
*/
public boolean canRunToLine( IFile file, int lineNumber ) {
// check if supports run to line
return canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(org.eclipse.core.resources.IFile, int, boolean)
*/
public void runToLine( IFile file, int lineNumber, boolean skipBreakpoints ) throws DebugException {
if ( !canRunToLine( file, lineNumber ) )
return;
runToLine( file.getLocation().lastSegment(), lineNumber, skipBreakpoints );
}
protected IThread getCurrentThread() throws DebugException {
IThread[] threads = getThreads();
for( int i = 0; i < threads.length; ++i ) {
@ -1465,35 +1406,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
fGlobalVariableManager.dispose();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(org.eclipse.cdt.core.IAddress)
*/
public boolean canRunToAddress( IAddress address ) {
// for now
return canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToAddress(org.eclipse.cdt.core.IAddress, boolean)
*/
public void runToAddress( IAddress address, boolean skipBreakpoints ) throws DebugException {
if ( !canRunToAddress( address ) )
return;
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( true );
}
ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) );
try {
getCDITarget().stepUntil( location );
}
catch( CDIException e ) {
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( false );
}
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal()
*/
@ -1518,69 +1430,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#canJumpToLine(org.eclipse.core.resources.IFile, int)
*/
public boolean canJumpToLine( IFile file, int lineNumber ) {
// check if supports jump to line
return canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#jumpToLine(org.eclipse.core.resources.IFile, int)
*/
public void jumpToLine( IFile file, int lineNumber ) throws DebugException {
if ( !canJumpToLine( file, lineNumber ) )
return;
jumpToLine( file.getLocation().lastSegment(), lineNumber );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#canJumpToLine(java.lang.String, int)
*/
public boolean canJumpToLine( String fileName, int lineNumber ) {
// check if supports jump to line
return canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#jumpToLine(java.lang.String, int)
*/
public void jumpToLine( String fileName, int lineNumber ) throws DebugException {
if ( !canJumpToLine( fileName, lineNumber ) )
return;
ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber );
try {
getCDITarget().resume( location );
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToAddress#canJumpToAddress(org.eclipse.cdt.core.IAddress)
*/
public boolean canJumpToAddress( IAddress address ) {
// check if supports jump to address
return canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToAddress#jumpToAddress(org.eclipse.cdt.core.IAddress)
*/
public void jumpToAddress( IAddress address ) throws DebugException {
if ( !canJumpToAddress( address ) )
return;
ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) );
try {
getCDITarget().resume( location );
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e );
}
}
public CRegisterManager getRegisterManager() {
return fRegisterManager;
}
@ -1897,4 +1746,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public void removeRegisterGroups( IRegisterGroup[] groups ) {
getRegisterManager().removeRegisterGroups( groups );
}
protected void skipBreakpoints( boolean enabled ) {
getBreakpointManager().skipBreakpoints( enabled );
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
import java.math.BigInteger;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
@ -20,11 +21,13 @@ import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.ICDILocator;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
@ -36,6 +39,7 @@ import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
@ -460,16 +464,16 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
*/
public Object getAdapter( Class adapter ) {
if ( adapter == IRunToLine.class ) {
return getDebugTarget().getAdapter( adapter );
return this;
}
if ( adapter == IRunToAddress.class ) {
return getDebugTarget().getAdapter( adapter );
return this;
}
if ( adapter == IJumpToLine.class ) {
return getDebugTarget().getAdapter( adapter );
return this;
}
if ( adapter == IJumpToAddress.class ) {
return getDebugTarget().getAdapter( adapter );
return this;
}
if ( adapter == CStackFrame.class ) {
return this;
@ -767,4 +771,140 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
private synchronized void setDisposed( boolean isDisposed ) {
fIsDisposed = isDisposed;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(org.eclipse.core.resources.IFile, int)
*/
public boolean canRunToLine( IFile file, int lineNumber ) {
return getThread().canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(org.eclipse.core.resources.IFile, int, boolean)
*/
public void runToLine( IFile file, int lineNumber, boolean skipBreakpoints ) throws DebugException {
if ( !canRunToLine( file, lineNumber ) )
return;
runToLine( file.getLocation().lastSegment(), lineNumber, skipBreakpoints );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#canRunToLine(java.lang.String, int)
*/
public boolean canRunToLine( String fileName, int lineNumber ) {
return getThread().canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToLine#runToLine(java.lang.String, int, boolean)
*/
public void runToLine( String fileName, int lineNumber, boolean skipBreakpoints ) throws DebugException {
if ( !canRunToLine( fileName, lineNumber ) )
return;
if ( skipBreakpoints ) {
((CDebugTarget)getDebugTarget()).skipBreakpoints( true );
}
ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber );
try {
getCDIThread().stepUntil( location );
}
catch( CDIException e ) {
if ( skipBreakpoints ) {
((CDebugTarget)getDebugTarget()).skipBreakpoints( false );
}
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(org.eclipse.cdt.core.IAddress)
*/
public boolean canRunToAddress( IAddress address ) {
return getThread().canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToAddress(org.eclipse.cdt.core.IAddress, boolean)
*/
public void runToAddress( IAddress address, boolean skipBreakpoints ) throws DebugException {
if ( !canRunToAddress( address ) )
return;
if ( skipBreakpoints ) {
((CDebugTarget)getDebugTarget()).skipBreakpoints( true );
}
ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) );
try {
getCDIThread().stepUntil( location );
}
catch( CDIException e ) {
if ( skipBreakpoints ) {
((CDebugTarget)getDebugTarget()).skipBreakpoints( false );
}
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#canJumpToLine(org.eclipse.core.resources.IFile, int)
*/
public boolean canJumpToLine( IFile file, int lineNumber ) {
return getThread().canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#jumpToLine(org.eclipse.core.resources.IFile, int)
*/
public void jumpToLine( IFile file, int lineNumber ) throws DebugException {
if ( !canJumpToLine( file, lineNumber ) )
return;
jumpToLine( file.getLocation().lastSegment(), lineNumber );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#canJumpToLine(java.lang.String, int)
*/
public boolean canJumpToLine( String fileName, int lineNumber ) {
return getThread().canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToLine#jumpToLine(java.lang.String, int)
*/
public void jumpToLine( String fileName, int lineNumber ) throws DebugException {
if ( !canJumpToLine( fileName, lineNumber ) )
return;
ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber );
try {
getCDIThread().resume( location );
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToAddress#canJumpToAddress(org.eclipse.cdt.core.IAddress)
*/
public boolean canJumpToAddress( IAddress address ) {
return getThread().canResume();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToAddress#jumpToAddress(org.eclipse.cdt.core.IAddress)
*/
public void jumpToAddress( IAddress address ) throws DebugException {
if ( !canJumpToAddress( address ) )
return;
ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) );
try {
getCDIThread().resume( location );
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e );
}
}
private ICDIThread getCDIThread() {
return ((CThread)getThread()).getCDIThread();
}
}

View file

@ -38,8 +38,11 @@ import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICThread;
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
import org.eclipse.cdt.debug.core.model.IJumpToLine;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugEvent;
@ -779,8 +782,17 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter( Class adapter ) {
if ( adapter.equals( IRunToLine.class ) )
return this;
if ( adapter.equals( IRunToLine.class ) ||
adapter.equals( IRunToAddress.class ) ||
adapter.equals( IJumpToLine.class ) ||
adapter.equals( IJumpToAddress.class ) ) {
try {
return (ICStackFrame)getTopStackFrame();
}
catch( DebugException e ) {
// do nothing
}
}
if ( adapter.equals( CDebugElementState.class ) )
return this;
if ( adapter == ICStackFrame.class ) {