mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
* org.eclipse.cdt.debug.internal.core.model/CValue.java
* org.eclipse.cdt.debug.mi.core.cdi/SourceManager.java 221944 nor P3 Wind cdt-debug-inbox@eclipse.org NEW Cannot display long long int as hex Patch from Elena
This commit is contained in:
parent
b8079d556d
commit
02f51cf12a
2 changed files with 36 additions and 3 deletions
|
@ -239,7 +239,7 @@ public class CValue extends AbstractCValue {
|
||||||
else if ( cdiValue instanceof ICDIWCharValue )
|
else if ( cdiValue instanceof ICDIWCharValue )
|
||||||
return getWCharValueString( (ICDIWCharValue)cdiValue );
|
return getWCharValueString( (ICDIWCharValue)cdiValue );
|
||||||
else
|
else
|
||||||
return cdiValue.getValueString();
|
return getGenericValueString(cdiValue.getValueString());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -423,6 +423,36 @@ public class CValue extends AbstractCValue {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getGenericValueString(String svalue) throws CDIException {
|
||||||
|
try {
|
||||||
|
BigInteger bigValue = new BigInteger(svalue);
|
||||||
|
CVariableFormat format = getParentVariable().getFormat();
|
||||||
|
if (CVariableFormat.NATURAL.equals(format)) {
|
||||||
|
format = CVariableFormat.DECIMAL;
|
||||||
|
}
|
||||||
|
if (CVariableFormat.DECIMAL.equals(format)) {
|
||||||
|
return svalue;
|
||||||
|
} else if (CVariableFormat.HEXADECIMAL.equals(format)) {
|
||||||
|
StringBuffer sb = new StringBuffer("0x"); //$NON-NLS-1$
|
||||||
|
if (isUnsigned()) {
|
||||||
|
sb.append(bigValue.toString(16));
|
||||||
|
} else
|
||||||
|
sb.append(Long.toHexString(bigValue.longValue()));
|
||||||
|
return sb.toString();
|
||||||
|
} else if (CVariableFormat.BINARY.equals(format)) {
|
||||||
|
StringBuffer sb = new StringBuffer("0b"); //$NON-NLS-1$
|
||||||
|
if (isUnsigned()) {
|
||||||
|
sb.append(bigValue.toString(2));
|
||||||
|
} else
|
||||||
|
sb.append(Long.toBinaryString(bigValue.longValue()));
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
return svalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getFloatValueString( ICDIFloatValue value ) throws CDIException {
|
private String getFloatValueString( ICDIFloatValue value ) throws CDIException {
|
||||||
float floatValue = value.floatValue();
|
float floatValue = value.floatValue();
|
||||||
if ( Float.isNaN(floatValue) )
|
if ( Float.isNaN(floatValue) )
|
||||||
|
|
|
@ -388,12 +388,15 @@ public class SourceManager extends Manager {
|
||||||
boolean isImaginery = (first.equals("_Imaginary") || second.equals("_Imaginary") || third.equals("_Imaginary")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
boolean isImaginery = (first.equals("_Imaginary") || second.equals("_Imaginary") || third.equals("_Imaginary")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
|
||||||
|
|
||||||
|
if (isSigned == false && unSigned==false) {
|
||||||
|
isSigned = true; // otherwise long long int would not work
|
||||||
|
}
|
||||||
if (isShort && isInt && (isSigned || unSigned)) {
|
if (isShort && isInt && (isSigned || unSigned)) {
|
||||||
return new ShortType(target, typename, unSigned);
|
return new ShortType(target, typename, unSigned);
|
||||||
} else if (isLong && isInt && (isSigned || unSigned)) {
|
|
||||||
return new LongType(target, typename, unSigned);
|
|
||||||
} else if (isLongLong && (isSigned || unSigned)) {
|
} else if (isLongLong && (isSigned || unSigned)) {
|
||||||
return new LongLongType(target, typename, unSigned);
|
return new LongLongType(target, typename, unSigned);
|
||||||
|
} else if (isLong && isInt && (isSigned || unSigned)) {
|
||||||
|
return new LongType(target, typename, unSigned);
|
||||||
} else if (isDouble && isLong && (isComplex || isImaginery)) {
|
} else if (isDouble && isLong && (isComplex || isImaginery)) {
|
||||||
return new DoubleType(target, typename, isComplex, isImaginery, isLong);
|
return new DoubleType(target, typename, isComplex, isImaginery, isLong);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue