mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Temporary fix for character values.
This commit is contained in:
parent
c63d89c8c8
commit
595aeddd55
4 changed files with 90 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003-04-21 Mikhail Khodjaiants
|
||||||
|
Temporary fix for character values.
|
||||||
|
* CValue.java
|
||||||
|
|
||||||
2003-04-20 Alain Magloire
|
2003-04-20 Alain Magloire
|
||||||
|
|
||||||
* CValue.java:
|
* CValue.java:
|
||||||
|
|
|
@ -87,7 +87,8 @@ public class CValue extends CDebugElement implements ICValue
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fValueString = processCDIValue( getUnderlyingValue().getValueString() );
|
// fValueString = processCDIValue( getUnderlyingValue().getValueString() );
|
||||||
|
fValueString = getUnderlyingValue().getValueString();
|
||||||
}
|
}
|
||||||
catch( CDIException e )
|
catch( CDIException e )
|
||||||
{
|
{
|
||||||
|
@ -95,7 +96,7 @@ public class CValue extends CDebugElement implements ICValue
|
||||||
fValueString = e.getMessage();
|
fValueString = e.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fValueString;
|
return ( fValueString != null ) ? processCDIValue( fValueString ) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -223,12 +224,18 @@ public class CValue extends CDebugElement implements ICValue
|
||||||
end = result.length();
|
end = result.length();
|
||||||
result = result.substring( 0, end );
|
result = result.substring( 0, end );
|
||||||
}
|
}
|
||||||
else if ( result.endsWith("'"))
|
else if ( result.endsWith( "\'" ) )
|
||||||
{
|
{
|
||||||
int start = result.indexOf( '\'' );
|
int start = result.indexOf( '\'' );
|
||||||
if ( start != -1 )
|
if ( start != -1 && result.length() - start == 3 )
|
||||||
|
{
|
||||||
result = result.substring( start );
|
result = result.substring( start );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -262,28 +269,38 @@ public class CValue extends CDebugElement implements ICValue
|
||||||
|
|
||||||
public String getUnderlyingValueString()
|
public String getUnderlyingValueString()
|
||||||
{
|
{
|
||||||
ICDIValue cdiValue = getUnderlyingValue();
|
if ( fValueString == null && getUnderlyingValue() != null )
|
||||||
String value = null;
|
|
||||||
if ( cdiValue != null )
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
value = cdiValue.getValueString();
|
fValueString = getUnderlyingValue().getValueString();
|
||||||
}
|
}
|
||||||
catch( CDIException e )
|
catch( CDIException e )
|
||||||
{
|
{
|
||||||
|
logError( e );
|
||||||
|
fValueString = e.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return fValueString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCharPointer()
|
public boolean isCharPointer()
|
||||||
{
|
{
|
||||||
String value = getUnderlyingValueString();
|
String value = getUnderlyingValueString().trim();
|
||||||
if ( value != null )
|
if ( value != null )
|
||||||
{
|
{
|
||||||
return ( value.startsWith( "0x" ) && value.indexOf( ' ' ) != -1 );
|
return ( value.startsWith( "0x" ) && value.indexOf( ' ' ) != -1 );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCharacter()
|
||||||
|
{
|
||||||
|
String value = getUnderlyingValueString().trim();
|
||||||
|
if ( value != null )
|
||||||
|
{
|
||||||
|
return ( value.endsWith( "\'" ) );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2003-04-21 Mikhail Khodjaiants
|
||||||
|
Temporary fix for character values.
|
||||||
|
* CDTDebugModelPresentation.java
|
||||||
|
|
||||||
2003-04-16 Mikhail Khodjaiants
|
2003-04-16 Mikhail Khodjaiants
|
||||||
Quick fix for variable values.
|
Quick fix for variable values.
|
||||||
* CDTDebugModelPresentation.java
|
* CDTDebugModelPresentation.java
|
||||||
|
|
|
@ -489,11 +489,13 @@ public class CDTDebugModelPresentation extends LabelProvider
|
||||||
}
|
}
|
||||||
label += var.getName();
|
label += var.getName();
|
||||||
IValue value = var.getValue();
|
IValue value = var.getValue();
|
||||||
if ( value != null && value.getValueString() != null && value.getValueString().trim().length() > 0 )
|
if ( value != null )
|
||||||
{
|
{
|
||||||
if ( value instanceof CValue && ((CValue)value).isCharPointer() )
|
if ( value instanceof CValue && ((CValue)value).isCharacter() )
|
||||||
|
label += getCharacterValue( (CValue)value );
|
||||||
|
else if ( value instanceof CValue && ((CValue)value).isCharPointer() )
|
||||||
label += "= " + ((CValue)value).getUnderlyingValueString();
|
label += "= " + ((CValue)value).getUnderlyingValueString();
|
||||||
else
|
else if ( value.getValueString() != null && value.getValueString().trim().length() > 0 )
|
||||||
label += getVariableValue( value.getValueString().trim() );
|
label += getVariableValue( value.getValueString().trim() );
|
||||||
// label += "= " + value.getValueString();
|
// label += "= " + value.getValueString();
|
||||||
}
|
}
|
||||||
|
@ -879,4 +881,54 @@ public class CDTDebugModelPresentation extends LabelProvider
|
||||||
return "";
|
return "";
|
||||||
return "=" + value;
|
return "=" + value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getCharacterValue( CValue value )
|
||||||
|
{
|
||||||
|
String result = null;
|
||||||
|
String uv = value.getUnderlyingValueString();
|
||||||
|
int index = uv.indexOf( '\\' );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( index == -1 && value.getValueString() != null )
|
||||||
|
return "=" + value.getValueString();
|
||||||
|
char ch = '.';
|
||||||
|
if ( uv.length() > index + 1 )
|
||||||
|
{
|
||||||
|
switch( uv.charAt( index + 1 ) )
|
||||||
|
{
|
||||||
|
case 'b':
|
||||||
|
ch = '\b';
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
ch = '\f';
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
ch = '\n';
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
ch = '\t';
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
ch = '\r';
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
ch = '\'';
|
||||||
|
break;
|
||||||
|
case '\"':
|
||||||
|
ch = '\"';
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
ch = '\\';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "=" + new String( new char[] { ch } );
|
||||||
|
}
|
||||||
|
result = "='" + new String( new char[] { ch } ) + '\'';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( DebugException e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue