[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] MI/Core fixes
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.157
diff -u -r1.157 ChangeLog
--- ChangeLog 8 Aug 2003 01:59:38 -0000 1.157
+++ ChangeLog 8 Aug 2003 02:55:09 -0000
@@ -1,5 +1,14 @@
2003-08-07 Alain Magloire
+ * src/org/eclipse/cdt/debug/mi/core/cdi/variableManager.java
+ getVariableObjectAsArray() ignore the type argument it does
+ not work with gdb.
+
+ * src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java
+ Added hasChildren() method.
+
+2003-08-07 Alain Magloire
+
* src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java:
Update the interface to reflect ICDIVariableManager.
Index: src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java,v
retrieving revision 1.37
diff -u -r1.37 VariableManager.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java 8 Aug 2003 01:59:00 -0000 1.37
+++ src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java 8 Aug 2003 02:55:09 -0000
@@ -303,9 +303,13 @@
if (obj != null) {
// Check if the type is valid.
checkType(type);
- VariableObject vo = new VariableObject(obj.getTarget(),
- obj.getQualifiedName(), obj.getStackFrame(), obj.getPosition(), obj.getStackDepth());
- vo.setCastingType(type);
+ VariableObject vo =
+ new VariableObject(
+ obj.getTarget(),
+ obj.getQualifiedName(),
+ obj.getStackFrame(),
+ obj.getPosition(),
+ obj.getStackDepth());
vo.setCastingArrayStart(start);
vo.setCastingArrayEnd(length);
return vo;
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java,v
retrieving revision 1.9
diff -u -r1.9 VariableObject.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java 7 Aug 2003 03:32:15 -0000 1.9
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java 8 Aug 2003 02:55:09 -0000
@@ -11,6 +11,8 @@
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType;
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIVoidType;
@@ -40,7 +42,7 @@
int position;
ICDIStackFrame frame;
int stackdepth;
-
+
String qualifiedName = null;
Type type = null;
String typename = null;
@@ -63,16 +65,6 @@
castingLength = obj.getCastingArrayEnd();
castingType = obj.getCastingType();
}
-// public VariableObject(VariableObject obj, String n) {
-// super(obj.getTarget());
-// name = n;
-// try {
-// frame = obj.getStackFrame();
-// } catch (CDIException e) {
-// }
-// position = obj.getPosition();
-// stackdepth = obj.getStackDepth();
-// }
public VariableObject(ICDITarget target, String n, ICDIStackFrame stack, int pos, int depth) {
this(target, n, null, stack, pos, depth);
@@ -115,7 +107,7 @@
public String getCastingType() {
return castingType;
}
-
+
/**
* If the variable was a cast encode the string appropriately for GDB.
* For example castin to an array is of 2 elements:
@@ -125,21 +117,16 @@
public String encodeVariable() {
StringBuffer buffer = new StringBuffer();
if (castingLength > 0 || castingIndex > 0) {
- buffer.append("(");
- //buffer.append('(');
- if (castingType != null && castingType.length() > 0) {
- buffer.append('(').append(castingType).append(')');
- }
- buffer.append(getName());
- //buffer.append(')');
+ buffer.append("*(");
+ buffer.append('(').append(getName()).append(')');
if (castingIndex != 0) {
- buffer.append('+').append(castingIndex);
+ buffer.append('+').append(castingIndex);
}
buffer.append(')');
- buffer.append('@').append(castingLength - castingIndex);
+ buffer.append('@').append(castingLength);
} else if (castingType != null && castingType.length() > 0) {
- buffer.append('(').append(castingType).append(')');
- buffer.append('(').append(getName()).append(')');
+ buffer.append("((").append(castingType).append(')');
+ buffer.append(getName()).append(')');
} else {
buffer.append(getName());
}
@@ -217,10 +204,10 @@
*/
public boolean isEditable() throws CDIException {
ICDIType t = getType();
- if (t instanceof ICDIArrayType ||
- t instanceof ICDIStructType ||
- t instanceof ICDIVoidType ||
- t instanceof ICDIFunctionType) {
+ if (t instanceof ICDIArrayType
+ || t instanceof ICDIStructType
+ || t instanceof ICDIVoidType
+ || t instanceof ICDIFunctionType) {
return false;
}
return true;
@@ -258,6 +245,30 @@
}
/**
+ * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#hasChildren()
+ */
+ public boolean hasChildren() throws CDIException {
+ ICDIType t = getType();
+
+ // For reference we need to get the referenced type
+ // to make a decision.
+ if (t instanceof ICDIReferenceType) {
+ t = ((ICDIReferenceType) t).getComponentType();
+ }
+
+ if (t instanceof ICDIArrayType || t instanceof ICDIStructType) {
+ return true;
+ } else if (t instanceof ICDIPointerType) {
+ ICDIType sub = ((ICDIPointerType) t).getComponentType();
+ if (sub instanceof ICDIVoidType) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#getQualifiedName()
*/
public String getQualifiedName() throws CDIException {
@@ -266,6 +277,5 @@
}
return qualifiedName;
}
-
}