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

Applied patch in bug 200829

This commit is contained in:
John Cortell 2007-08-22 20:35:40 +00:00
parent 8c03d14f4c
commit cf73aadd70

View file

@ -67,6 +67,16 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
private HashSet fChanges = new HashSet(); private HashSet fChanges = new HashSet();
/**
* is fWordSize available?
*/
private boolean fHaveWordSize;
/**
* The number of bytes per address.
*/
private int fWordSize;
/** /**
* Constructor for CMemoryBlockExtension. * Constructor for CMemoryBlockExtension.
@ -85,6 +95,8 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
super( target ); super( target );
fExpression = expression; fExpression = expression;
fBaseAddress = baseAddress; fBaseAddress = baseAddress;
fWordSize= wordSize;
fHaveWordSize= true;
} }
/** /**
@ -129,17 +141,26 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
* @see org.eclipse.debug.core.model.IMemoryBlockExtension#getAddressableSize() * @see org.eclipse.debug.core.model.IMemoryBlockExtension#getAddressableSize()
*/ */
public int getAddressableSize() throws DebugException { public int getAddressableSize() throws DebugException {
if (getCDIBlock() == null) { if (!fHaveWordSize) {
try { synchronized (this) {
// create a CDI block of an arbitrary size so we can call into if (!fHaveWordSize) {
// the backed to determine the memory's addressable size ICDIMemoryBlock block= getCDIBlock();
setCDIBlock( createCDIBlock( fBaseAddress, 100 )); if (block == null) {
} try {
catch( CDIException e ) { // create a CDI block of an arbitrary size so we can call into
targetRequestFailed( e.getMessage(), null ); // the backend to determine the memory's addressable size
setCDIBlock( block= createCDIBlock( fBaseAddress, 100 ));
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), null );
}
}
fWordSize= block.getWordSize();
fHaveWordSize= true;
}
} }
} }
return getCDIBlock().getWordSize(); return fWordSize;
} }
/* (non-Javadoc) /* (non-Javadoc)