1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 99217: NPE thrown when fetching deffered children.

This commit is contained in:
Mikhail Khodjaiants 2005-06-17 21:28:31 +00:00
parent b53dbe706e
commit 22f8c9984c
6 changed files with 89 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2005-06-17 Mikhail Khodjaiants
Bug 99217: NPE thrown when fetching deffered children.
* CExpression.java
* CValueFactory.java
* CVariable.java
2005-06-17 Mikhail Khodjaiants 2005-06-17 Mikhail Khodjaiants
Bug 100261: Memory veiw: Renderings content disappears when click on Vairable/Module... view. Bug 100261: Memory veiw: Renderings content disappears when click on Vairable/Module... view.
* CDebugElement.java * CDebugElement.java

View file

@ -39,7 +39,7 @@ public class CExpression extends CVariable implements IExpression {
private CStackFrame fStackFrame; private CStackFrame fStackFrame;
private IValue fValue; private IValue fValue = CValueFactory.NULL_VALUE;
private ICType fType; private ICType fType;
@ -116,7 +116,7 @@ public class CExpression extends CVariable implements IExpression {
} }
protected synchronized IValue getValue( CStackFrame context ) throws DebugException { protected synchronized IValue getValue( CStackFrame context ) throws DebugException {
if ( fValue == null ) { if ( fValue.equals( CValueFactory.NULL_VALUE ) ) {
if ( context.isSuspended() ) { if ( context.isSuspended() ) {
try { try {
ICDIValue value = fCDIExpression.getValue( context.getCDIStackFrame() ); ICDIValue value = fCDIExpression.getValue( context.getCDIStackFrame() );
@ -156,7 +156,7 @@ public class CExpression extends CVariable implements IExpression {
if ( fValue instanceof AbstractCValue ) { if ( fValue instanceof AbstractCValue ) {
((AbstractCValue)fValue).reset(); ((AbstractCValue)fValue).reset();
} }
fValue = null; fValue = CValueFactory.NULL_VALUE;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -180,7 +180,7 @@ public class CExpression extends CVariable implements IExpression {
} }
if ( fValue instanceof AbstractCValue ) { if ( fValue instanceof AbstractCValue ) {
((AbstractCValue)fValue).dispose(); ((AbstractCValue)fValue).dispose();
fValue = null; fValue = CValueFactory.NULL_VALUE;
} }
internalDispose( true ); internalDispose( true );
} }
@ -190,11 +190,9 @@ public class CExpression extends CVariable implements IExpression {
*/ */
public ICType getType() throws DebugException { public ICType getType() throws DebugException {
if ( fType == null ) { if ( fType == null ) {
if ( fValue != null ) { synchronized( this ) {
synchronized( this ) { if ( fType == null ) {
if ( fType == null ) { fType = ((AbstractCValue)fValue).getType();
fType = ((AbstractCValue)fValue).getType();
}
} }
} }
} }

View file

@ -10,16 +10,80 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue;
import org.eclipse.cdt.debug.core.model.CDebugElementState;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
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.ILaunch;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IVariable;
/** /**
* The value factory for variable and expressions. * The value factory for variable and expressions.
*/ */
public class CValueFactory { public class CValueFactory {
static public final ICValue NULL_VALUE = new ICValue() {
public String getReferenceTypeName() throws DebugException {
return ""; //$NON-NLS-1$
}
public String getValueString() throws DebugException {
return ""; //$NON-NLS-1$
}
public boolean isAllocated() throws DebugException {
return true;
}
public IVariable[] getVariables() throws DebugException {
return new IVariable[0];
}
public boolean hasVariables() throws DebugException {
return false;
}
public String getModelIdentifier() {
return CDebugCorePlugin.getUniqueIdentifier();
}
public IDebugTarget getDebugTarget() {
return null;
}
public ILaunch getLaunch() {
return null;
}
public Object getAdapter( Class adapter ) {
return null;
}
public ICType getType() throws DebugException {
return null;
}
public String evaluateAsExpression( ICStackFrame frame ) {
return ""; //$NON-NLS-1$
}
public CDebugElementState getState() {
return CDebugElementState.UNDEFINED;
}
public Object getCurrentStateInfo() {
return null;
}
};
static public CValue createValue( CVariable parent, ICDIValue cdiValue ) { static public CValue createValue( CVariable parent, ICDIValue cdiValue ) {
if ( cdiValue instanceof ICDIFloatingPointValue ) { if ( cdiValue instanceof ICDIFloatingPointValue ) {
return new CFloatingPointValue( parent, cdiValue ); return new CFloatingPointValue( parent, cdiValue );

View file

@ -74,7 +74,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
/** /**
* The cache of the current value. * The cache of the current value.
*/ */
private ICValue fValue; private ICValue fValue = CValueFactory.NULL_VALUE;
/** /**
* The change flag. * The change flag.
@ -224,7 +224,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
} }
synchronized ICValue getValue() throws DebugException { synchronized ICValue getValue() throws DebugException {
if ( fValue == null ) { if ( fValue.equals( CValueFactory.NULL_VALUE ) ) {
ICDIVariable var = getCDIVariable(); ICDIVariable var = getCDIVariable();
if ( var != null ) { if ( var != null ) {
try { try {
@ -255,7 +255,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
void invalidateValue() { void invalidateValue() {
if ( fValue instanceof AbstractCValue ) { if ( fValue instanceof AbstractCValue ) {
((AbstractCValue)fValue).dispose(); ((AbstractCValue)fValue).dispose();
fValue = null; fValue = CValueFactory.NULL_VALUE;
} }
} }
@ -433,7 +433,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
} }
} }
} }
return null; return CValueFactory.NULL_VALUE;
} }
/* /*

View file

@ -1,3 +1,7 @@
2005-06-17 Mikhail Khodjaiants
Bug 99217: NPE thrown when fetching deffered children.
* CDebugModelPresentation.java
2005-06-12 Mikhail Khodjaiants 2005-06-12 Mikhail Khodjaiants
Bug 100447: NPE generated when Run To Line in Disassembly view. Bug 100447: NPE generated when Run To Line in Disassembly view.
* ResumeAtLineAdapter.java * ResumeAtLineAdapter.java

View file

@ -659,13 +659,10 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
String name = var.getName(); String name = var.getName();
if ( name != null ) if ( name != null )
label.append( name.trim() ); label.append( name.trim() );
IValue value = var.getValue(); String valueString = getValueText( var.getValue() );
if ( value != null ) { if ( !isEmpty( valueString ) ) {
String valueString = getValueText( value ); label.append( " = " ); //$NON-NLS-1$
if ( !isEmpty( valueString ) ) { label.append( valueString );
label.append( " = " ); //$NON-NLS-1$
label.append( valueString );
}
} }
} }
return label.toString(); return label.toString();