Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorJohn Cortell2007-01-18 02:04:39 +0000
committerJohn Cortell2007-01-18 02:04:39 +0000
commit273a31b3651afcbab12d045fd6483126d043aab0 (patch)
treea306fa0164123795387c2454d117c371e8cf502a /debug
parenta89ed5cff7d4f049d80f6eddf73d71c73eedad6f (diff)
downloadorg.eclipse.cdt-273a31b3651afcbab12d045fd6483126d043aab0.tar.gz
org.eclipse.cdt-273a31b3651afcbab12d045fd6483126d043aab0.tar.xz
org.eclipse.cdt-273a31b3651afcbab12d045fd6483126d043aab0.zip
Opimization to getExtendedMemoryBlock(). Where the expression is an absolute address (decimal or hex value), we can sidestep a lot of processing--no need to get the backend to resolve the expression as there is really nothing to resolve.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java30
1 files changed, 22 insertions, 8 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java
index 35cb06ff0ce..e4b442dcc96 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java
@@ -146,6 +146,23 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
try {
if (selected instanceof IDebugElement) {
IDebugElement debugElement = (IDebugElement)selected;
+ IDebugTarget target = debugElement.getDebugTarget();
+ if (!(target instanceof CDebugTarget)) {
+ throw new DebugException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, msg, null ) );
+ }
+
+ // 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)
+ try {
+ if (expression.startsWith("0x") && expression.length() > 2) {
+ return new CMemoryBlockExtension((CDebugTarget)target, expression, new BigInteger(expression.substring(2), 16));
+ } else if (Character.isDigit(expression.charAt(0))) {
+ return new CMemoryBlockExtension((CDebugTarget)target, expression, new BigInteger(expression));
+ }
+ } catch (NumberFormatException nfexc) {
+ // OK, expression is not a simple, absolute numeric value; keep trucking and try to resolve as expression
+ }
+
CStackFrame frame = getStackFrame( debugElement );
if ( frame != null ) {
// We need to provide a better way for retrieving the address of expression
@@ -157,13 +174,10 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
if ( type != null && (type.isPointer() || type.isIntegralType()) ) {
address = value.getValueString();
exp.dispose();
- IDebugTarget target = debugElement.getDebugTarget();
- if ( target instanceof CDebugTarget ) {
- if ( address != null ) {
- // ???
- BigInteger a = ( address.startsWith( "0x" ) ) ? new BigInteger( address.substring( 2 ), 16 ) : new BigInteger( address ); //$NON-NLS-1$
- return new CMemoryBlockExtension( (CDebugTarget)target, expression, a );
- }
+ if ( address != null ) {
+ // ???
+ BigInteger a = ( address.startsWith( "0x" ) ) ? new BigInteger( address.substring( 2 ), 16 ) : new BigInteger( address ); //$NON-NLS-1$
+ return new CMemoryBlockExtension( (CDebugTarget)target, expression, a );
}
}
else {
@@ -291,4 +305,4 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
return new String[0];
}
-}
+} \ No newline at end of file

Back to the top