mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Changed the vizualization of arrays and structures.
This commit is contained in:
parent
a295e9b86c
commit
00d81cd9ef
2 changed files with 27 additions and 72 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-05-29 Mikhail Khodjaiants
|
||||
Changed the vizualization of arrays and structures.
|
||||
* CDTDebugModelPresentation.java
|
||||
|
||||
2003-05-14 Mikhail Khodjaiants
|
||||
Created preference for the maximum number of disassembly instructions.
|
||||
* CDebugPreferencePage.java
|
||||
|
|
|
@ -33,7 +33,6 @@ 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;
|
||||
|
@ -538,29 +537,40 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
|
||||
protected String getVariableText( IVariable var ) throws DebugException
|
||||
{
|
||||
String label = new String();
|
||||
if ( var != null )
|
||||
StringBuffer label = new StringBuffer();
|
||||
if ( var instanceof ICVariable )
|
||||
{
|
||||
if ( isShowVariableTypeNames() )
|
||||
{
|
||||
String type = getVariableTypeName( var );
|
||||
if ( type != null && type.length() > 0 )
|
||||
label += type + " ";
|
||||
{
|
||||
label.append( type );
|
||||
label.append( ' ' );
|
||||
}
|
||||
}
|
||||
label += var.getName();
|
||||
label.append( var.getName() );
|
||||
IValue value = var.getValue();
|
||||
if ( value != null )
|
||||
{
|
||||
if ( value instanceof CValue && ((CValue)value).isCharacter() )
|
||||
label += getCharacterValue( (CValue)value );
|
||||
else if ( value instanceof CValue && ((CValue)value).isCharPointer() )
|
||||
label += "= " + ((CValue)value).getUnderlyingValueString();
|
||||
else if ( value.getValueString() != null && value.getValueString().trim().length() > 0 )
|
||||
label += getVariableValue( value.getValueString().trim() );
|
||||
// label += "= " + value.getValueString();
|
||||
if ( ((ICVariable)var).isArray() )
|
||||
{
|
||||
int[] dims = ((ICVariable)var).getArrayDimensions();
|
||||
for ( int i = 0; i < dims.length; ++i )
|
||||
{
|
||||
label.append( '[' );
|
||||
label.append( dims[i] );
|
||||
label.append( ']' );
|
||||
}
|
||||
}
|
||||
else if ( !((ICVariable)var).isStructure() && value.getValueString() != null && value.getValueString().trim().length() > 0 )
|
||||
{
|
||||
label.append( "= " );
|
||||
label.append( value.getValueString().trim() );
|
||||
}
|
||||
}
|
||||
}
|
||||
return label;
|
||||
return label.toString();
|
||||
}
|
||||
|
||||
protected String getSharedLibraryText( ICSharedLibrary library, boolean qualified ) throws DebugException
|
||||
|
@ -903,65 +913,6 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
return null;
|
||||
}
|
||||
|
||||
private String getVariableValue( String value )
|
||||
{
|
||||
if ( value.startsWith( "[" ) )
|
||||
return value;
|
||||
if ( value.startsWith( "{" ) )
|
||||
return "";
|
||||
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;
|
||||
}
|
||||
|
||||
private String getVariableTypeName( IVariable variable )
|
||||
{
|
||||
String type = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue