mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Switch to the new memory view interfaces (Eclipse 3.1).
This commit is contained in:
parent
7166ea11d2
commit
4a8b57d0ab
5 changed files with 84 additions and 45 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-12-21 Mikhail Khodjaiants
|
||||||
|
Switch to the new memory view interfaces (Eclipse 3.1).
|
||||||
|
* InternalDebugCoreMessages.properties
|
||||||
|
* CMemoryBlockExtensionRetrieval.java: new
|
||||||
|
* CExtendedMemoryBlockRetrieval.java: deleted
|
||||||
|
* CDebugTarget.java
|
||||||
|
* CMemoryBlockExtension.java: new
|
||||||
|
* CExtendedMemoryBlock.java: deleted
|
||||||
|
|
||||||
2004-12-20 Mikhail Khodjaiants
|
2004-12-20 Mikhail Khodjaiants
|
||||||
Fix for bug 81698: NumberFormatException in CValue.
|
Fix for bug 81698: NumberFormatException in CValue.
|
||||||
* CValue.java
|
* CValue.java
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.math.BigInteger;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||||
import org.eclipse.cdt.debug.internal.core.model.CExtendedMemoryBlock;
|
import org.eclipse.cdt.debug.internal.core.model.CMemoryBlockExtension;
|
||||||
import org.eclipse.cdt.debug.internal.core.model.CStackFrame;
|
import org.eclipse.cdt.debug.internal.core.model.CStackFrame;
|
||||||
import org.eclipse.cdt.debug.internal.core.model.CThread;
|
import org.eclipse.cdt.debug.internal.core.model.CThread;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -23,25 +23,25 @@ import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IDebugElement;
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
import org.eclipse.debug.core.model.IDebugTarget;
|
import org.eclipse.debug.core.model.IDebugTarget;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtensionRetrieval;
|
||||||
import org.eclipse.debug.core.model.IStackFrame;
|
import org.eclipse.debug.core.model.IStackFrame;
|
||||||
import org.eclipse.debug.internal.core.memory.IExtendedMemoryBlock;
|
|
||||||
import org.eclipse.debug.internal.core.memory.IExtendedMemoryBlockRetrieval;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the memory retrieval features based on the CDI model.
|
* Implements the memory retrieval features based on the CDI model.
|
||||||
*/
|
*/
|
||||||
public class CExtendedMemoryBlockRetrieval implements IExtendedMemoryBlockRetrieval {
|
public class CMemoryBlockExtensionRetrieval implements IMemoryBlockExtensionRetrieval {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CExtendedMemoryBlockRetrieval.
|
* Constructor for CMemoryBlockExtensionRetrieval.
|
||||||
*/
|
*/
|
||||||
public CExtendedMemoryBlockRetrieval() {
|
public CMemoryBlockExtensionRetrieval() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.internal.core.memory.IExtendedMemoryBlockRetrieval#getExtendedMemoryBlock(java.lang.String, org.eclipse.debug.core.model.IDebugElement)
|
* @see org.eclipse.debug.core.model.IMemoryBlockExtensionRetrieval#getExtendedMemoryBlock(java.lang.String, org.eclipse.debug.core.model.IDebugElement)
|
||||||
*/
|
*/
|
||||||
public IExtendedMemoryBlock getExtendedMemoryBlock( String expression, IDebugElement selected ) throws DebugException {
|
public IMemoryBlockExtension getExtendedMemoryBlock( String expression, IDebugElement selected ) throws DebugException {
|
||||||
String address = null;
|
String address = null;
|
||||||
if ( selected instanceof CStackFrame ) {
|
if ( selected instanceof CStackFrame ) {
|
||||||
address = ((CStackFrame)selected).evaluateExpressionToString( expression );
|
address = ((CStackFrame)selected).evaluateExpressionToString( expression );
|
||||||
|
@ -57,10 +57,10 @@ public class CExtendedMemoryBlockRetrieval implements IExtendedMemoryBlockRetrie
|
||||||
if ( address != null ) {
|
if ( address != null ) {
|
||||||
try {
|
try {
|
||||||
BigInteger a = ( address.startsWith( "0x" ) ) ? new BigInteger( address.substring( 2 ), 16 ) : new BigInteger( address ); //$NON-NLS-1$
|
BigInteger a = ( address.startsWith( "0x" ) ) ? new BigInteger( address.substring( 2 ), 16 ) : new BigInteger( address ); //$NON-NLS-1$
|
||||||
return new CExtendedMemoryBlock( (CDebugTarget)target, expression, a );
|
return new CMemoryBlockExtension( (CDebugTarget)target, expression, a );
|
||||||
}
|
}
|
||||||
catch( NumberFormatException e ) {
|
catch( NumberFormatException e ) {
|
||||||
throw new DebugException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, MessageFormat.format( InternalDebugCoreMessages.getString( "CExtendedMemoryBlockRetrieval.0" ), new String[] { expression, address } ), null ) ); //$NON-NLS-1$
|
throw new DebugException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, MessageFormat.format( InternalDebugCoreMessages.getString( "CMemoryBlockExtensionRetrieval.0" ), new String[] { expression, address } ), null ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ CBreakpointManager.1=Set breakpoint failed. Reason: {0}.
|
||||||
CBreakpointManager.2=Set breakpoint failed. Reason: {0}.
|
CBreakpointManager.2=Set breakpoint failed. Reason: {0}.
|
||||||
CBreakpointManager.4=Change breakpoint properties failed. Reason: {0}.
|
CBreakpointManager.4=Change breakpoint properties failed. Reason: {0}.
|
||||||
CGlobalVariableManager.0=Invalid global variables data.
|
CGlobalVariableManager.0=Invalid global variables data.
|
||||||
CExtendedMemoryBlockRetrieval.0=Expression ''{0}'' evaluated to invalid address value: {1}.
|
CMemoryBlockExtensionRetrieval.0=Expression ''{0}'' evaluated to invalid address value: {1}.
|
||||||
DebugConfiguration.0=This debugger no longer supports this operation
|
DebugConfiguration.0=This debugger no longer supports this operation
|
||||||
CDebugAdapter.0=This debugger does not support debugging external files
|
CDebugAdapter.0=This debugger does not support debugging external files
|
||||||
CDebugAdapter.1=Debugger Process
|
CDebugAdapter.1=Debugger Process
|
|
@ -16,7 +16,6 @@ import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.core.IAddressFactory;
|
import org.eclipse.cdt.core.IAddressFactory;
|
||||||
|
@ -81,7 +80,7 @@ import org.eclipse.cdt.debug.core.model.IRunToAddress;
|
||||||
import org.eclipse.cdt.debug.core.model.IRunToLine;
|
import org.eclipse.cdt.debug.core.model.IRunToLine;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
import org.eclipse.cdt.debug.internal.core.CBreakpointManager;
|
import org.eclipse.cdt.debug.internal.core.CBreakpointManager;
|
||||||
import org.eclipse.cdt.debug.internal.core.CExtendedMemoryBlockRetrieval;
|
import org.eclipse.cdt.debug.internal.core.CMemoryBlockExtensionRetrieval;
|
||||||
import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager;
|
import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager;
|
||||||
import org.eclipse.cdt.debug.internal.core.CMemoryManager;
|
import org.eclipse.cdt.debug.internal.core.CMemoryManager;
|
||||||
import org.eclipse.cdt.debug.internal.core.CRegisterManager;
|
import org.eclipse.cdt.debug.internal.core.CRegisterManager;
|
||||||
|
@ -112,12 +111,12 @@ import org.eclipse.debug.core.model.IBreakpoint;
|
||||||
import org.eclipse.debug.core.model.IDebugTarget;
|
import org.eclipse.debug.core.model.IDebugTarget;
|
||||||
import org.eclipse.debug.core.model.IExpression;
|
import org.eclipse.debug.core.model.IExpression;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtensionRetrieval;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
|
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
|
||||||
import org.eclipse.debug.core.model.IProcess;
|
import org.eclipse.debug.core.model.IProcess;
|
||||||
import org.eclipse.debug.core.model.IRegisterGroup;
|
import org.eclipse.debug.core.model.IRegisterGroup;
|
||||||
import org.eclipse.debug.core.model.ISourceLocator;
|
import org.eclipse.debug.core.model.ISourceLocator;
|
||||||
import org.eclipse.debug.core.model.IThread;
|
import org.eclipse.debug.core.model.IThread;
|
||||||
import org.eclipse.debug.internal.core.memory.IExtendedMemoryBlockRetrieval;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug target for C/C++ debug model.
|
* Debug target for C/C++ debug model.
|
||||||
|
@ -216,7 +215,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
*/
|
*/
|
||||||
private IAddressFactory fAddressFactory;
|
private IAddressFactory fAddressFactory;
|
||||||
|
|
||||||
private CExtendedMemoryBlockRetrieval fMemoryBlockRetrieval;
|
private CMemoryBlockExtensionRetrieval fMemoryBlockRetrieval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CDebugTarget.
|
* Constructor for CDebugTarget.
|
||||||
|
@ -240,7 +239,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
setRegisterManager( new CRegisterManager( this ) );
|
setRegisterManager( new CRegisterManager( this ) );
|
||||||
setBreakpointManager( new CBreakpointManager( this ) );
|
setBreakpointManager( new CBreakpointManager( this ) );
|
||||||
setGlobalVariableManager( new CGlobalVariableManager( this ) );
|
setGlobalVariableManager( new CGlobalVariableManager( this ) );
|
||||||
setMemoryBlockRetrieval( new CExtendedMemoryBlockRetrieval() );
|
setMemoryBlockRetrieval( new CMemoryBlockExtensionRetrieval() );
|
||||||
initialize();
|
initialize();
|
||||||
DebugPlugin.getDefault().getLaunchManager().addLaunchListener( this );
|
DebugPlugin.getDefault().getLaunchManager().addLaunchListener( this );
|
||||||
DebugPlugin.getDefault().getExpressionManager().addExpressionListener( this );
|
DebugPlugin.getDefault().getExpressionManager().addExpressionListener( this );
|
||||||
|
@ -860,7 +859,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
return getGlobalVariableManager();
|
return getGlobalVariableManager();
|
||||||
if ( adapter.equals( ICDISession.class ) )
|
if ( adapter.equals( ICDISession.class ) )
|
||||||
return getCDISession();
|
return getCDISession();
|
||||||
if ( adapter.equals( IExtendedMemoryBlockRetrieval.class ) )
|
if ( adapter.equals( IMemoryBlockExtensionRetrieval.class ) )
|
||||||
return getMemoryBlockRetrieval();
|
return getMemoryBlockRetrieval();
|
||||||
if ( adapter.equals( IMemoryBlockRetrieval.class ) )
|
if ( adapter.equals( IMemoryBlockRetrieval.class ) )
|
||||||
return getMemoryBlockRetrieval();
|
return getMemoryBlockRetrieval();
|
||||||
|
@ -1837,11 +1836,11 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
return fAddressFactory;
|
return fAddressFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CExtendedMemoryBlockRetrieval getMemoryBlockRetrieval() {
|
private CMemoryBlockExtensionRetrieval getMemoryBlockRetrieval() {
|
||||||
return fMemoryBlockRetrieval;
|
return fMemoryBlockRetrieval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMemoryBlockRetrieval( CExtendedMemoryBlockRetrieval memoryBlockRetrieval ) {
|
private void setMemoryBlockRetrieval( CMemoryBlockExtensionRetrieval memoryBlockRetrieval ) {
|
||||||
fMemoryBlockRetrieval = memoryBlockRetrieval;
|
fMemoryBlockRetrieval = memoryBlockRetrieval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,31 +26,14 @@ import org.eclipse.cdt.debug.core.model.IExecFileInfo;
|
||||||
import org.eclipse.debug.core.DebugEvent;
|
import org.eclipse.debug.core.DebugEvent;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
|
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
|
||||||
import org.eclipse.debug.internal.core.memory.IExtendedMemoryBlock;
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
import org.eclipse.debug.internal.core.memory.MemoryByte;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a memory block in the CDI model.
|
* Represents a memory block in the CDI model.
|
||||||
*/
|
*/
|
||||||
public class CExtendedMemoryBlock extends CDebugElement implements IExtendedMemoryBlock, ICDIEventListener {
|
public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlockExtension, ICDIEventListener {
|
||||||
|
|
||||||
private class CMemoryByte extends MemoryByte {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for CMemoryByte.
|
|
||||||
*/
|
|
||||||
public CMemoryByte( byte v, byte f ) {
|
|
||||||
this.value = v;
|
|
||||||
this.flags = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for CMemoryByte.
|
|
||||||
*/
|
|
||||||
public CMemoryByte() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The address expression this memory block is based on.
|
* The address expression this memory block is based on.
|
||||||
|
@ -75,9 +58,9 @@ public class CExtendedMemoryBlock extends CDebugElement implements IExtendedMemo
|
||||||
private HashSet fChanges = new HashSet();
|
private HashSet fChanges = new HashSet();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CExtendedMemoryBlock.
|
* Constructor for CMemoryBlockExtension.
|
||||||
*/
|
*/
|
||||||
public CExtendedMemoryBlock( CDebugTarget target, String expression, BigInteger baseAddress ) {
|
public CMemoryBlockExtension( CDebugTarget target, String expression, BigInteger baseAddress ) {
|
||||||
super( target );
|
super( target );
|
||||||
fExpression = expression;
|
fExpression = expression;
|
||||||
fBaseAddress = baseAddress;
|
fBaseAddress = baseAddress;
|
||||||
|
@ -164,7 +147,7 @@ public class CExtendedMemoryBlock extends CDebugElement implements IExtendedMemo
|
||||||
byte flags = MemoryByte.VALID;
|
byte flags = MemoryByte.VALID;
|
||||||
if ( hasChanged( getRealBlockAddress().add( BigInteger.valueOf( i ) ) ) )
|
if ( hasChanged( getRealBlockAddress().add( BigInteger.valueOf( i ) ) ) )
|
||||||
flags |= MemoryByte.CHANGED;
|
flags |= MemoryByte.CHANGED;
|
||||||
fBytes[i] = new CMemoryByte( bytes[i], flags );
|
fBytes[i] = new MemoryByte( bytes[i], flags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,8 +357,8 @@ public class CExtendedMemoryBlock extends CDebugElement implements IExtendedMemo
|
||||||
if ( addresses[i].compareTo( start ) >= 0 && addresses[i].compareTo( start.add( BigInteger.valueOf( length ) ) ) < 0 ) {
|
if ( addresses[i].compareTo( start ) >= 0 && addresses[i].compareTo( start.add( BigInteger.valueOf( length ) ) ) < 0 ) {
|
||||||
int index = addresses[i].subtract( start ).intValue();
|
int index = addresses[i].subtract( start ).intValue();
|
||||||
if ( index >= 0 && index < memBytes.length && index < newBytes.length ) {
|
if ( index >= 0 && index < memBytes.length && index < newBytes.length ) {
|
||||||
memBytes[index].flags |= MemoryByte.CHANGED;
|
memBytes[index].setChanged( true );
|
||||||
memBytes[index].value = newBytes[index];
|
memBytes[index].setValue( newBytes[index] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,7 +387,7 @@ public class CExtendedMemoryBlock extends CDebugElement implements IExtendedMemo
|
||||||
if ( real.compareTo( changes[i] ) <= 0 && real.add( BigInteger.valueOf( getBlockSize() ) ).compareTo( changes[i] ) > 0 ) {
|
if ( real.compareTo( changes[i] ) <= 0 && real.add( BigInteger.valueOf( getBlockSize() ) ).compareTo( changes[i] ) > 0 ) {
|
||||||
int index = changes[i].subtract( real ).intValue();
|
int index = changes[i].subtract( real ).intValue();
|
||||||
if ( index >= 0 && index < fBytes.length ) {
|
if ( index >= 0 && index < fBytes.length ) {
|
||||||
fBytes[index].flags &= ~MemoryByte.CHANGED;
|
fBytes[index].setChanged( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,4 +395,52 @@ public class CExtendedMemoryBlock extends CDebugElement implements IExtendedMemo
|
||||||
fChanges.clear();
|
fChanges.clear();
|
||||||
fireChangeEvent( DebugEvent.CONTENT );
|
fireChangeEvent( DebugEvent.CONTENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.core.model.IMemoryBlockExtension#supportsChangeManagement()
|
||||||
|
*/
|
||||||
|
public boolean supportsChangeManagement() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.core.model.IMemoryBlockExtension#connect(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void connect( Object object ) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.core.model.IMemoryBlockExtension#disconnect(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void disconnect( Object object ) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.core.model.IMemoryBlockExtension#getConnected()
|
||||||
|
*/
|
||||||
|
public Object[] getConnected() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.core.model.IMemoryBlockExtension#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.core.model.IMemoryBlockExtension#getAddressibleSize()
|
||||||
|
*/
|
||||||
|
public int getAddressibleSize() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue