mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
2004-11-03 Alain Magloire
Partial fix for 77435 * cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java
This commit is contained in:
parent
86af48c1f9
commit
2475ef9679
3 changed files with 52 additions and 19 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-11-03 Alain Magloire
|
||||
Partial fix for 77435
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java
|
||||
|
||||
2004-11-02 Alain Magloire
|
||||
Refactor ICDIConfiguratio --> ICDISessionConfiguration and ICDITargetConfiguration
|
||||
* cdi/org/eclipse/cdt/debug/core/cdi/Session.java
|
||||
|
|
|
@ -125,10 +125,7 @@ public class VariableManager extends Manager {
|
|||
if (vars[i].getName().equals(name)
|
||||
&& vars[i].getCastingArrayStart() == v.getCastingArrayStart()
|
||||
&& vars[i].getCastingArrayEnd() == v.getCastingArrayEnd()
|
||||
&& ((vars[i].getCastingType() == null && v.getCastingType() == null)
|
||||
|| (vars[i].getCastingType() != null
|
||||
&& v.getCastingType() != null
|
||||
&& vars[i].getCastingType().equals(v.getCastingType())))) {
|
||||
&& VariableDescriptor.equalsCasting(vars[i], v)) {
|
||||
// check threads
|
||||
ICDIThread thread = vars[i].getThread();
|
||||
if ((vthread == null && thread == null) ||
|
||||
|
@ -291,11 +288,16 @@ public class VariableManager extends Manager {
|
|||
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String casting = varDesc.getCastingType();
|
||||
if (casting != null && casting.length() > 0) {
|
||||
type = "(" + type + ")" + "(" + casting + " )"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
String[] castings = varDesc.getCastingTypes();
|
||||
if (castings == null) {
|
||||
castings = new String[] { type };
|
||||
} else {
|
||||
String[] temp = new String[castings.length + 1];
|
||||
System.arraycopy(castings, 0, temp, 0, castings.length);
|
||||
temp[castings.length] = type;
|
||||
castings = temp;
|
||||
}
|
||||
vo.setCastingType(type);
|
||||
vo.setCastingTypes(castings);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
|
|||
public abstract class VariableDescriptor extends CObject implements ICDIVariableDescriptor {
|
||||
|
||||
// Casting info.
|
||||
String castingType;
|
||||
String[] castingTypes;
|
||||
int castingIndex;
|
||||
int castingLength;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
|||
stackdepth = desc.getStackDepth();
|
||||
castingIndex = desc.getCastingArrayStart();
|
||||
castingLength = desc.getCastingArrayEnd();
|
||||
castingType = desc.getCastingType();
|
||||
castingTypes = desc.getCastingTypes();
|
||||
}
|
||||
|
||||
public VariableDescriptor(Target target, Thread thread, StackFrame stack, String n, String fn, int pos, int depth) {
|
||||
|
@ -103,11 +103,11 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
|||
return castingLength;
|
||||
}
|
||||
|
||||
public void setCastingType(String t) {
|
||||
castingType = t;
|
||||
public void setCastingTypes(String[] t) {
|
||||
castingTypes = t;
|
||||
}
|
||||
public String getCastingType() {
|
||||
return castingType;
|
||||
public String[] getCastingTypes() {
|
||||
return castingTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,10 +128,22 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
|||
buffer.append(')');
|
||||
buffer.append('@').append(castingLength);
|
||||
fn = buffer.toString();
|
||||
} else if (castingType != null && castingType.length() > 0) {
|
||||
} else if (castingTypes != null && castingTypes.length > 0) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("((").append(castingType).append(')'); //$NON-NLS-1$
|
||||
buffer.append(fn).append(')');
|
||||
for (int i = 0; i < castingTypes.length; ++i) {
|
||||
if (castingTypes[i] != null && castingTypes[i].length() > 0) {
|
||||
if (buffer.length() == 0) {
|
||||
buffer.append('(').append(castingTypes[i]).append(')');
|
||||
buffer.append(fn);
|
||||
} else {
|
||||
buffer.insert(0, '(');
|
||||
buffer.append(')');
|
||||
StringBuffer b = new StringBuffer();
|
||||
b.append('(').append(castingTypes[i]).append(')');
|
||||
buffer.insert(0, b.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
fn = buffer.toString();
|
||||
}
|
||||
return fn;
|
||||
|
@ -277,6 +289,21 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
|||
return qualifiedName;
|
||||
}
|
||||
|
||||
public static boolean equalsCasting(VariableDescriptor var1, VariableDescriptor var2) {
|
||||
String[] castings1 = var1.getCastingTypes();
|
||||
String[] castings2 = var2.getCastingTypes();
|
||||
if (castings1 == null && castings2 == null) {
|
||||
return true;
|
||||
} else if (castings1 != null && castings2 != null && castings1.length == castings2.length) {
|
||||
for (int i = 0; i < castings1.length; ++i) {
|
||||
if (!castings1[i].equals(castings2[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#equals(ICDIVariableDescriptor)
|
||||
*/
|
||||
|
@ -286,8 +313,7 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
|||
if (desc.getName().equals(getName())
|
||||
&& desc.getCastingArrayStart() == getCastingArrayStart()
|
||||
&& desc.getCastingArrayEnd() == getCastingArrayEnd()
|
||||
&& ((desc.getCastingType() == null && getCastingType() == null)
|
||||
|| (desc.getCastingType() != null && getCastingType() != null && desc.getCastingType().equals(getCastingType())))) {
|
||||
&& equalsCasting(desc, this)) {
|
||||
|
||||
// Check the threads
|
||||
ICDIThread varThread = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue