1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added the processing of reference values.

This commit is contained in:
Mikhail Khodjaiants 2003-06-04 17:44:46 +00:00
parent bf46520cf1
commit f6516e4737
2 changed files with 26 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2003-06-04 Mikhail Khodjaiants
Added the processing of reference values.
* CValue.java
2003-06-04 Mikhail Khodjaiants 2003-06-04 Mikhail Khodjaiants
Implementing the core support of UI features for types and internal formating Implementing the core support of UI features for types and internal formating
(instead of using the format features provided by gdb). (instead of using the format features provided by gdb).

View file

@ -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.ICDILongLongValue;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongValue; 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.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.cdi.model.type.ICDIShortValue;
import org.eclipse.cdt.debug.core.model.ICValue; import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -296,6 +297,8 @@ public class CValue extends CDebugElement implements ICValue
return getDoubleValueString( (ICDIDoubleValue)cdiValue ); return getDoubleValueString( (ICDIDoubleValue)cdiValue );
else if ( cdiValue instanceof ICDIPointerValue ) else if ( cdiValue instanceof ICDIPointerValue )
return getPointerValueString( (ICDIPointerValue)cdiValue ); return getPointerValueString( (ICDIPointerValue)cdiValue );
else if ( cdiValue instanceof ICDIReferenceValue )
return getReferenceValueString( (ICDIReferenceValue)cdiValue );
else else
return cdiValue.getValueString(); return cdiValue.getValueString();
} }
@ -476,6 +479,25 @@ public class CValue extends CDebugElement implements ICValue
return null; 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() private boolean isUnsigned()
{ {
boolean result = false; boolean result = false;