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:
parent
b53dbe706e
commit
22f8c9984c
6 changed files with 89 additions and 20 deletions
|
@ -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
|
||||
Bug 100261: Memory veiw: Renderings content disappears when click on Vairable/Module... view.
|
||||
* CDebugElement.java
|
||||
|
|
|
@ -39,7 +39,7 @@ public class CExpression extends CVariable implements IExpression {
|
|||
|
||||
private CStackFrame fStackFrame;
|
||||
|
||||
private IValue fValue;
|
||||
private IValue fValue = CValueFactory.NULL_VALUE;
|
||||
|
||||
private ICType fType;
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class CExpression extends CVariable implements IExpression {
|
|||
}
|
||||
|
||||
protected synchronized IValue getValue( CStackFrame context ) throws DebugException {
|
||||
if ( fValue == null ) {
|
||||
if ( fValue.equals( CValueFactory.NULL_VALUE ) ) {
|
||||
if ( context.isSuspended() ) {
|
||||
try {
|
||||
ICDIValue value = fCDIExpression.getValue( context.getCDIStackFrame() );
|
||||
|
@ -156,7 +156,7 @@ public class CExpression extends CVariable implements IExpression {
|
|||
if ( fValue instanceof AbstractCValue ) {
|
||||
((AbstractCValue)fValue).reset();
|
||||
}
|
||||
fValue = null;
|
||||
fValue = CValueFactory.NULL_VALUE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -180,7 +180,7 @@ public class CExpression extends CVariable implements IExpression {
|
|||
}
|
||||
if ( fValue instanceof AbstractCValue ) {
|
||||
((AbstractCValue)fValue).dispose();
|
||||
fValue = null;
|
||||
fValue = CValueFactory.NULL_VALUE;
|
||||
}
|
||||
internalDispose( true );
|
||||
}
|
||||
|
@ -190,14 +190,12 @@ public class CExpression extends CVariable implements IExpression {
|
|||
*/
|
||||
public ICType getType() throws DebugException {
|
||||
if ( fType == null ) {
|
||||
if ( fValue != null ) {
|
||||
synchronized( this ) {
|
||||
if ( fType == null ) {
|
||||
fType = ((AbstractCValue)fValue).getType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return fType;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,16 +10,80 @@
|
|||
*******************************************************************************/
|
||||
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.type.ICDIArrayValue;
|
||||
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.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.
|
||||
*/
|
||||
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 ) {
|
||||
if ( cdiValue instanceof ICDIFloatingPointValue ) {
|
||||
return new CFloatingPointValue( parent, cdiValue );
|
||||
|
|
|
@ -74,7 +74,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
|
|||
/**
|
||||
* The cache of the current value.
|
||||
*/
|
||||
private ICValue fValue;
|
||||
private ICValue fValue = CValueFactory.NULL_VALUE;
|
||||
|
||||
/**
|
||||
* The change flag.
|
||||
|
@ -224,7 +224,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
|
|||
}
|
||||
|
||||
synchronized ICValue getValue() throws DebugException {
|
||||
if ( fValue == null ) {
|
||||
if ( fValue.equals( CValueFactory.NULL_VALUE ) ) {
|
||||
ICDIVariable var = getCDIVariable();
|
||||
if ( var != null ) {
|
||||
try {
|
||||
|
@ -255,7 +255,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
|
|||
void invalidateValue() {
|
||||
if ( fValue instanceof AbstractCValue ) {
|
||||
((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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2005-06-17 Mikhail Khodjaiants
|
||||
Bug 99217: NPE thrown when fetching deffered children.
|
||||
* CDebugModelPresentation.java
|
||||
|
||||
2005-06-12 Mikhail Khodjaiants
|
||||
Bug 100447: NPE generated when Run To Line in Disassembly view.
|
||||
* ResumeAtLineAdapter.java
|
||||
|
|
|
@ -659,15 +659,12 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
String name = var.getName();
|
||||
if ( name != null )
|
||||
label.append( name.trim() );
|
||||
IValue value = var.getValue();
|
||||
if ( value != null ) {
|
||||
String valueString = getValueText( value );
|
||||
String valueString = getValueText( var.getValue() );
|
||||
if ( !isEmpty( valueString ) ) {
|
||||
label.append( " = " ); //$NON-NLS-1$
|
||||
label.append( valueString );
|
||||
}
|
||||
}
|
||||
}
|
||||
return label.toString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue