1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 01:35:39 +02:00

Provide a getFullName() to return the complete name

but without the casting information.
This commit is contained in:
Alain Magloire 2003-08-22 17:09:16 +00:00
parent 1bccb61ec6
commit d95d657a19
2 changed files with 24 additions and 14 deletions

View file

@ -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;

View file

@ -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;
}
/**