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

Tweak to last change based on Mikhail's review.

This commit is contained in:
John Cortell 2007-01-18 13:45:30 +00:00
parent 4874e4d321
commit f02257b4dc

View file

@ -15,6 +15,7 @@ import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -152,13 +153,11 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
} }
// See if the expression is a simple numeric value; if it is, we can avoid some costly // See if the expression is a simple numeric value; if it is, we can avoid some costly
// processing (calling the backend to resolve the expression) // processing (avoid calling the backend to resolve the expression)
try { try {
if (expression.startsWith("0x") && expression.length() > 2) { IAddressFactory addrFactory = ((CDebugTarget)target).getAddressFactory();
return new CMemoryBlockExtension((CDebugTarget)target, expression, new BigInteger(expression.substring(2), 16)); String hexstr = addrFactory.createAddress(expression).toString(16);
} else if (Character.isDigit(expression.charAt(0))) { return new CMemoryBlockExtension((CDebugTarget)target, expression, new BigInteger(hexstr, 16));
return new CMemoryBlockExtension((CDebugTarget)target, expression, new BigInteger(expression));
}
} catch (NumberFormatException nfexc) { } catch (NumberFormatException nfexc) {
// OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression // OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression
} }