summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Kunter2012-02-23 06:25:49 (EST)
committerMarc Khouzam2012-03-06 09:23:36 (EST)
commitcd1de04157460d7ab7f97b13f83c5d3266114897 (patch)
treee7533b94900b376a97fd3c927539ed003fe6b7cd
parent49c5be791f23eb89f6db1ac86d8519fec0183f42 (diff)
downloadorg.eclipse.cdt-cd1de04157460d7ab7f97b13f83c5d3266114897.zip
org.eclipse.cdt-cd1de04157460d7ab7f97b13f83c5d3266114897.tar.gz
org.eclipse.cdt-cd1de04157460d7ab7f97b13f83c5d3266114897.tar.bz2
Bug 370462: Improving the debug preferences. Better handling of octal addresses.
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java17
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java17
2 files changed, 28 insertions, 6 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java
index fb8c794..f04ae20 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CIndexedValue.java
@@ -24,6 +24,8 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.cdt.debug.core.model.ICType;
+import org.eclipse.cdt.utils.Addr32;
+import org.eclipse.cdt.utils.Addr64;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IIndexedValue;
import org.eclipse.debug.core.model.IVariable;
@@ -165,9 +167,18 @@ public class CIndexedValue extends AbstractCValue implements IIndexedValue {
return address.toHexAddressString();
else if ( CVariableFormat.DECIMAL.equals( format ) )
return address.toString();
- else if ( CVariableFormat.OCTAL.equals( format ) )
- return address.toHexAddressString();
- else if ( CVariableFormat.BINARY.equals( format ) )
+ else if ( CVariableFormat.OCTAL.equals( format ) ) {
+ // Using the instanceof operator here to avoid API change
+ // Add IAddress.toOctalAddressString() in a future CDT release
+ if (address instanceof Addr32) {
+ return ((Addr32)address).toOctalAddressString();
+ } else if (address instanceof Addr64) {
+ return ((Addr64)address).toOctalAddressString();
+ } else {
+ // Fall back to hexadecimal address format
+ return address.toHexAddressString();
+ }
+ } else if ( CVariableFormat.BINARY.equals( format ) )
return address.toBinaryAddressString();
return null;
} catch (CDIException e) {
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 de653ee..ffa0299 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
@@ -46,6 +46,8 @@ import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
+import org.eclipse.cdt.utils.Addr32;
+import org.eclipse.cdt.utils.Addr64;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IVariable;
@@ -632,9 +634,18 @@ public class CValue extends AbstractCValue {
return address.toHexAddressString();
else if ( CVariableFormat.DECIMAL.equals( format ) )
return address.toString();
- else if ( CVariableFormat.OCTAL.equals( format ) )
- return address.toHexAddressString();
- else if ( CVariableFormat.BINARY.equals( format ) )
+ else if ( CVariableFormat.OCTAL.equals( format ) ) {
+ // Using the instanceof operator here to avoid API change
+ // Add IAddress.toOctalAddressString() in a future CDT release
+ if (address instanceof Addr32) {
+ return ((Addr32)address).toOctalAddressString();
+ } else if (address instanceof Addr64) {
+ return ((Addr64)address).toOctalAddressString();
+ } else {
+ // Fall back to hexadecimal address format
+ return address.toHexAddressString();
+ }
+ } else if ( CVariableFormat.BINARY.equals( format ) )
return address.toBinaryAddressString();
return null;
}