Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2008-03-28 15:27:31 +0000
committerAlain Magloire2008-03-28 15:27:31 +0000
commit02f51cf12a49c4b4052af11e1fc05347af7a6b39 (patch)
tree042c032fc33e2ce52b4e1a9f59e9f2dfddd76bae /debug/org.eclipse.cdt.debug.core
parentb8079d556d19e625478e89bc4a7338d452bea155 (diff)
downloadorg.eclipse.cdt-02f51cf12a49c4b4052af11e1fc05347af7a6b39.tar.gz
org.eclipse.cdt-02f51cf12a49c4b4052af11e1fc05347af7a6b39.tar.xz
org.eclipse.cdt-02f51cf12a49c4b4052af11e1fc05347af7a6b39.zip
* 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
Diffstat (limited to 'debug/org.eclipse.cdt.debug.core')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java
index 9bf6347f591..18a6ed8fe22 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java
@@ -239,7 +239,7 @@ public class CValue extends AbstractCValue {
else if ( cdiValue instanceof ICDIWCharValue )
return getWCharValueString( (ICDIWCharValue)cdiValue );
else
- return cdiValue.getValueString();
+ return getGenericValueString(cdiValue.getValueString());
}
return null;
}
@@ -423,6 +423,36 @@ public class CValue extends AbstractCValue {
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 {
float floatValue = value.floatValue();
if ( Float.isNaN(floatValue) )

Back to the top