From cf73aadd70aac02ffa5cd4fd087e13b719cecc93 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Wed, 22 Aug 2007 20:35:40 +0000 Subject: [PATCH] Applied patch in bug 200829 --- .../core/model/CMemoryBlockExtension.java | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CMemoryBlockExtension.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CMemoryBlockExtension.java index 2fd4fbfb0bc..40e0402fe66 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CMemoryBlockExtension.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CMemoryBlockExtension.java @@ -67,6 +67,16 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock private HashSet fChanges = new HashSet(); + /** + * is fWordSize available? + */ + private boolean fHaveWordSize; + + /** + * The number of bytes per address. + */ + private int fWordSize; + /** * Constructor for CMemoryBlockExtension. @@ -85,6 +95,8 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock super( target ); fExpression = expression; 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() */ public int getAddressableSize() throws DebugException { - if (getCDIBlock() == null) { - try { - // create a CDI block of an arbitrary size so we can call into - // the backed to determine the memory's addressable size - setCDIBlock( createCDIBlock( fBaseAddress, 100 )); - } - catch( CDIException e ) { - targetRequestFailed( e.getMessage(), null ); + if (!fHaveWordSize) { + synchronized (this) { + if (!fHaveWordSize) { + ICDIMemoryBlock block= getCDIBlock(); + if (block == null) { + try { + // create a CDI block of an arbitrary size so we can call into + // 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)