diff options
author | Alain Magloire | 2003-08-22 17:09:16 +0000 |
---|---|---|
committer | Alain Magloire | 2003-08-22 17:09:16 +0000 |
commit | d95d657a192c5fd399c54d385f65551fcf1324ff (patch) | |
tree | e963d5484221c052d2b9282c4246dbcf6ebb2420 /debug | |
parent | 1bccb61ec669962598c70eeec7f8fe95748dccd0 (diff) | |
download | org.eclipse.cdt-d95d657a192c5fd399c54d385f65551fcf1324ff.tar.gz org.eclipse.cdt-d95d657a192c5fd399c54d385f65551fcf1324ff.tar.xz org.eclipse.cdt-d95d657a192c5fd399c54d385f65551fcf1324ff.zip |
Provide a getFullName() to return the complete name
but without the casting information.
Diffstat (limited to 'debug')
2 files changed, 24 insertions, 14 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java index e99c5aa1854..7b993abf789 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java @@ -164,18 +164,18 @@ public class Variable extends VariableObject implements ICDIVariable { MIVar[] vars = info.getMIVars(); children = new Variable[vars.length]; for (int i = 0; i < vars.length; i++) { - String qName = getQualifiedName(); + String fn= getFullName(); String childName = vars[i].getExp(); String childTypename = null; boolean childFake = false; ICDIType t = getType(); if (t instanceof ICDIArrayType) { - qName = "(" + getQualifiedName() + ")[" + i + "]"; + fn = "(" + fn + ")[" + i + "]"; // For Array gdb varobj only return the index, override here. int index = castingIndex + i; childName = getName() + "[" + index + "]"; } else if (t instanceof ICDIPointerType) { - qName = "*(" + getQualifiedName() + ")"; + fn = "*(" + fn + ")"; } else if (t instanceof ICDIStructType) { if (isCPPLanguage()) { // For C++ in GDB the children of the @@ -199,13 +199,13 @@ public class Variable extends VariableObject implements ICDIVariable { childFake = true; childTypename = getTypeName(); } else { - qName = "(" + getQualifiedName() + ")." + vars[i].getExp(); + fn = "(" + fn + ")." + vars[i].getExp(); } } else { // If not C++ language - qName = "(" + getQualifiedName() + ")." + vars[i].getExp(); + fn = "(" + fn + ")." + vars[i].getExp(); } } - Variable v = new Variable(getTarget(), childName, qName, getStackFrame(), getPosition(), getStackDepth(), vars[i]); + Variable v = new Variable(getTarget(), childName, fn, getStackFrame(), getPosition(), getStackDepth(), vars[i]); if (childTypename != null) { // Hack to reset the typename to a known value v.typename = childTypename; diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java index baa5ef5061d..3bd22c3a208 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java @@ -44,6 +44,7 @@ public class VariableObject extends CObject implements ICDIVariableObject { int stackdepth; String qualifiedName = null; + String fullName = null; Type type = null; String typename = null; String sizeof = null; @@ -70,10 +71,10 @@ public class VariableObject extends CObject implements ICDIVariableObject { this(target, n, null, stack, pos, depth); } - public VariableObject(ICDITarget target, String n, String q, ICDIStackFrame stack, int pos, int depth) { + public VariableObject(ICDITarget target, String n, String fn, ICDIStackFrame stack, int pos, int depth) { super(target); name = n; - qualifiedName = q; + fullName = fn; frame = stack; position = pos; stackdepth = depth; @@ -115,22 +116,31 @@ public class VariableObject extends CObject implements ICDIVariableObject { * @return */ public String encodeVariable() { - StringBuffer buffer = new StringBuffer(); + String fn = getFullName(); if (castingLength > 0 || castingIndex > 0) { + StringBuffer buffer = new StringBuffer(); buffer.append("*("); - buffer.append('(').append(getName()).append(')'); + buffer.append('(').append(fn).append(')'); if (castingIndex != 0) { buffer.append('+').append(castingIndex); } buffer.append(')'); buffer.append('@').append(castingLength); + fn = buffer.toString(); } else if (castingType != null && castingType.length() > 0) { + StringBuffer buffer = new StringBuffer(); buffer.append("((").append(castingType).append(')'); - buffer.append(getName()).append(')'); - } else { - buffer.append(getName()); + buffer.append(fn).append(')'); + fn = buffer.toString(); } - return buffer.toString(); + return fn; + } + + public String getFullName() { + if (fullName == null) { + fullName = getName(); + } + return fullName; } /** |