1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fixed 187308. Expect and gracefully handle a NumberFormatException when creating a memory block from an expression.

This commit is contained in:
John Cortell 2007-05-16 16:43:08 +00:00
parent b6e3d64778
commit fddd30f6bc

View file

@ -136,13 +136,17 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
private void createMemoryBlocks( String[] expressions, String[] memorySpaceIDs ) { private void createMemoryBlocks( String[] expressions, String[] memorySpaceIDs ) {
ArrayList list = new ArrayList( expressions.length ); ArrayList list = new ArrayList( expressions.length );
for ( int i = 0; i < expressions.length; ++i ) { for ( int i = 0; i < expressions.length; ++i ) {
IAddress address = getDebugTarget().getAddressFactory().createAddress( expressions[i] ); try {
if ( address != null ) { IAddress address = getDebugTarget().getAddressFactory().createAddress( expressions[i] );
if (memorySpaceIDs[i] == null) { if ( address != null ) {
list.add( new CMemoryBlockExtension( getDebugTarget(), address.toHexAddressString(), address.getValue() ) ); if (memorySpaceIDs[i] == null) {
} else { list.add( new CMemoryBlockExtension( getDebugTarget(), address.toHexAddressString(), address.getValue() ) );
list.add( new CMemoryBlockExtension( getDebugTarget(), address.getValue(), memorySpaceIDs[i] ) ); } else {
list.add( new CMemoryBlockExtension( getDebugTarget(), address.getValue(), memorySpaceIDs[i] ) );
}
} }
} catch (NumberFormatException exc) {
CDebugCorePlugin.log(exc);
} }
} }
DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks( (IMemoryBlock[])list.toArray( new IMemoryBlock[list.size()] ) ); DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks( (IMemoryBlock[])list.toArray( new IMemoryBlock[list.size()] ) );