diff options
author | Mathias Kunter | 2012-02-23 11:25:49 +0000 |
---|---|---|
committer | Marc Khouzam | 2012-03-06 14:23:36 +0000 |
commit | cd1de04157460d7ab7f97b13f83c5d3266114897 (patch) | |
tree | e7533b94900b376a97fd3c927539ed003fe6b7cd /debug | |
parent | 49c5be791f23eb89f6db1ac86d8519fec0183f42 (diff) | |
download | org.eclipse.cdt-cd1de04157460d7ab7f97b13f83c5d3266114897.tar.gz org.eclipse.cdt-cd1de04157460d7ab7f97b13f83c5d3266114897.tar.xz org.eclipse.cdt-cd1de04157460d7ab7f97b13f83c5d3266114897.zip |
Bug 370462: Improving the debug preferences. Better handling of octal addresses.
Diffstat (limited to 'debug')
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 fb8c794528c..f04ae203fb1 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 de653eeb2b8..ffa02991cec 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; } |