mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
[240238] - fixed adding expressions which has "char *" type for example
This commit is contained in:
parent
2d3a12da43
commit
170bb6ea07
1 changed files with 18 additions and 5 deletions
|
@ -265,13 +265,26 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
|
||||||
ICType type = ((ICValue)value).getType();
|
ICType type = ((ICValue)value).getType();
|
||||||
if ( type != null ) {
|
if ( type != null ) {
|
||||||
// get the address for the expression, allow all types
|
// get the address for the expression, allow all types
|
||||||
address = frame.evaluateExpressionToString(exp.getExpressionString());
|
String rawExpr = exp.getExpressionString();
|
||||||
if ( address != null ) {
|
String voidExpr = "(void *)(" + rawExpr + ")";
|
||||||
// ???
|
String attempts[] = { rawExpr, voidExpr };
|
||||||
BigInteger a = ( address.startsWith( "0x" ) ) ? new BigInteger( address.substring( 2 ), 16 ) : new BigInteger( address ); //$NON-NLS-1$
|
for (int i = 0; i < attempts.length; i++) {
|
||||||
return new CMemoryBlockExtension( (CDebugTarget)target, expression, a );
|
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 {
|
else {
|
||||||
msg = MessageFormat.format( InternalDebugCoreMessages.getString( "CMemoryBlockRetrievalExtension.1" ), (Object[])new String[] { expression } ); //$NON-NLS-1$
|
msg = MessageFormat.format( InternalDebugCoreMessages.getString( "CMemoryBlockRetrievalExtension.1" ), (Object[])new String[] { expression } ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue