Skip to main content
summaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorAlena Laskavaia2008-07-09 17:23:09 -0400
committerAlena Laskavaia2008-07-09 17:23:09 -0400
commit2df6d04ad92e0420a828e904b18156fec7df0613 (patch)
treeb62e64acdbca45759bbbf6e81bd7dd0bf45fe203 /debug
parent83e86bd881995520eab2b518247abcf87fc5e8c8 (diff)
downloadorg.eclipse.cdt-2df6d04ad92e0420a828e904b18156fec7df0613.tar.gz
org.eclipse.cdt-2df6d04ad92e0420a828e904b18156fec7df0613.tar.xz
org.eclipse.cdt-2df6d04ad92e0420a828e904b18156fec7df0613.zip
[240238] - fixed adding expressions which has "char *" type for example
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CMemoryBlockRetrievalExtension.java23
1 files changed, 18 insertions, 5 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 cb56447806..46c1c301eb 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
@@ -265,12 +265,25 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
ICType type = ((ICValue)value).getType();
if ( type != null ) {
// get the address for the expression, allow all types
- address = frame.evaluateExpressionToString(exp.getExpressionString());
- 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 );
+ String rawExpr = exp.getExpressionString();
+ String voidExpr = "(void *)(" + rawExpr + ")";
+ String attempts[] = { rawExpr, voidExpr };
+ for (int i = 0; i < attempts.length; i++) {
+ String expr = attempts[i];
+ address = frame.evaluateExpressionToString(expr);
+ if (address != null) {
+ try {
+ BigInteger a = (address.startsWith("0x")) ? new BigInteger(address.substring(2), 16) : new BigInteger(address); //$NON-NLS-1$
+ return new CMemoryBlockExtension((CDebugTarget) target, expression, a);
+ } catch (NumberFormatException e) {
+ // not pointer? lets cast it to void*
+ if (i == 0)
+ continue;
+ throw e;
+ }
+ }
}
+
}
else {
msg = MessageFormat.format( InternalDebugCoreMessages.getString( "CMemoryBlockRetrievalExtension.1" ), (Object[])new String[] { expression } ); //$NON-NLS-1$

Back to the top