mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-31 20:23:26 +02:00
Quick fix for variable values.
This commit is contained in:
parent
1c8f7f5637
commit
cd0179f1f5
4 changed files with 70 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-04-16 Mikhail Khodjaiants
|
||||
Quick fix for variable values.
|
||||
* CValue.java
|
||||
|
||||
2003-04-14 Alain Magloire
|
||||
|
||||
StringBuffer.indexOf() is 1.4.x only
|
||||
|
|
|
@ -209,6 +209,26 @@ public class CValue extends CDebugElement implements ICValue
|
|||
if ( cdiValue != null )
|
||||
{
|
||||
result = cdiValue.trim();
|
||||
if ( result.startsWith( "@" ) ) // Reference
|
||||
{
|
||||
int end = result.indexOf( ':' );
|
||||
if ( end == -1 )
|
||||
end = result.length();
|
||||
result = result.substring( 1, end );
|
||||
}
|
||||
else if ( result.startsWith( "0x" ) )
|
||||
{
|
||||
int end = result.indexOf( ' ' );
|
||||
if ( end == -1 )
|
||||
end = result.length();
|
||||
result = result.substring( 0, end );
|
||||
}
|
||||
else if ( result.charAt( result.length() - 1 ) == '\'' )
|
||||
{
|
||||
int start = result.indexOf( '\'' );
|
||||
if ( start != -1 )
|
||||
result = result.substring( start );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -239,4 +259,31 @@ public class CValue extends CDebugElement implements ICValue
|
|||
{
|
||||
return fParent;
|
||||
}
|
||||
|
||||
public String getUnderlyingValueString()
|
||||
{
|
||||
ICDIValue cdiValue = getUnderlyingValue();
|
||||
String value = null;
|
||||
if ( cdiValue != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
value = cdiValue.getValueString();
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean isCharPointer()
|
||||
{
|
||||
String value = getUnderlyingValueString();
|
||||
if ( value != null )
|
||||
{
|
||||
return ( value.startsWith( "0x" ) && value.indexOf( ' ' ) != -1 );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-04-16 Mikhail Khodjaiants
|
||||
Quick fix for variable values.
|
||||
* CDTDebugModelPresentation.java
|
||||
|
||||
2003-04-14 Mikhail Khodjaiants
|
||||
Added icon to the 'Add/Remove Breakpoint' action for functions and methods.
|
||||
* plugin.xml
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
|
|||
import org.eclipse.cdt.debug.core.model.IState;
|
||||
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
|
||||
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CValue;
|
||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
|
||||
import org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor;
|
||||
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput;
|
||||
|
@ -490,7 +491,11 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
IValue value = var.getValue();
|
||||
if ( value != null && value.getValueString() != null && value.getValueString().trim().length() > 0 )
|
||||
{
|
||||
label += "= " + value.getValueString();
|
||||
if ( value instanceof CValue && ((CValue)value).isCharPointer() )
|
||||
label += "= " + ((CValue)value).getUnderlyingValueString();
|
||||
else
|
||||
label += getVariableValue( value.getValueString().trim() );
|
||||
// label += "= " + value.getValueString();
|
||||
}
|
||||
}
|
||||
return label;
|
||||
|
@ -865,4 +870,13 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getVariableValue( String value )
|
||||
{
|
||||
if ( value.startsWith( "[" ) )
|
||||
return value;
|
||||
if ( value.startsWith( "{" ) )
|
||||
return "";
|
||||
return "=" + value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue