From f6516e47373b1ed34c371343eb35cf8eb5d2596c Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Wed, 4 Jun 2003 17:44:46 +0000 Subject: [PATCH] Added the processing of reference values. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 4 ++++ .../cdt/debug/internal/core/model/CValue.java | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index bed010e60cf..59273f6af01 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,7 @@ +2003-06-04 Mikhail Khodjaiants + Added the processing of reference values. + * CValue.java + 2003-06-04 Mikhail Khodjaiants Implementing the core support of UI features for types and internal formating (instead of using the format features provided by gdb). 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 5362fe09037..9290f8711f9 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 @@ -25,6 +25,7 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongValue; import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongValue; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue; +import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortValue; import org.eclipse.cdt.debug.core.model.ICValue; import org.eclipse.debug.core.DebugException; @@ -296,6 +297,8 @@ public class CValue extends CDebugElement implements ICValue return getDoubleValueString( (ICDIDoubleValue)cdiValue ); else if ( cdiValue instanceof ICDIPointerValue ) return getPointerValueString( (ICDIPointerValue)cdiValue ); + else if ( cdiValue instanceof ICDIReferenceValue ) + return getReferenceValueString( (ICDIReferenceValue)cdiValue ); else return cdiValue.getValueString(); } @@ -476,6 +479,25 @@ public class CValue extends CDebugElement implements ICValue return null; } + private String getReferenceValueString( ICDIReferenceValue value ) throws CDIException + { + long longValue = value.referenceValue(); + switch( getParentVariable().getFormat() ) + { + case ICDIFormat.DECIMAL: + return Long.toString( longValue ); + case ICDIFormat.NATURAL: + case ICDIFormat.HEXADECIMAL: + { + StringBuffer sb = new StringBuffer( "0x" ); + String stringValue = Long.toHexString( longValue ); + sb.append( ( stringValue.length() > 8 ) ? stringValue.substring( stringValue.length() - 8 ) : stringValue ); + return sb.toString(); + } + } + return null; + } + private boolean isUnsigned() { boolean result = false;