mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Provide a getFullName() to return the complete name
but without the casting information.
This commit is contained in:
parent
1bccb61ec6
commit
d95d657a19
2 changed files with 24 additions and 14 deletions
|
@ -164,18 +164,18 @@ public class Variable extends VariableObject implements ICDIVariable {
|
||||||
MIVar[] vars = info.getMIVars();
|
MIVar[] vars = info.getMIVars();
|
||||||
children = new Variable[vars.length];
|
children = new Variable[vars.length];
|
||||||
for (int i = 0; i < vars.length; i++) {
|
for (int i = 0; i < vars.length; i++) {
|
||||||
String qName = getQualifiedName();
|
String fn= getFullName();
|
||||||
String childName = vars[i].getExp();
|
String childName = vars[i].getExp();
|
||||||
String childTypename = null;
|
String childTypename = null;
|
||||||
boolean childFake = false;
|
boolean childFake = false;
|
||||||
ICDIType t = getType();
|
ICDIType t = getType();
|
||||||
if (t instanceof ICDIArrayType) {
|
if (t instanceof ICDIArrayType) {
|
||||||
qName = "(" + getQualifiedName() + ")[" + i + "]";
|
fn = "(" + fn + ")[" + i + "]";
|
||||||
// For Array gdb varobj only return the index, override here.
|
// For Array gdb varobj only return the index, override here.
|
||||||
int index = castingIndex + i;
|
int index = castingIndex + i;
|
||||||
childName = getName() + "[" + index + "]";
|
childName = getName() + "[" + index + "]";
|
||||||
} else if (t instanceof ICDIPointerType) {
|
} else if (t instanceof ICDIPointerType) {
|
||||||
qName = "*(" + getQualifiedName() + ")";
|
fn = "*(" + fn + ")";
|
||||||
} else if (t instanceof ICDIStructType) {
|
} else if (t instanceof ICDIStructType) {
|
||||||
if (isCPPLanguage()) {
|
if (isCPPLanguage()) {
|
||||||
// For C++ in GDB the children of the
|
// For C++ in GDB the children of the
|
||||||
|
@ -199,13 +199,13 @@ public class Variable extends VariableObject implements ICDIVariable {
|
||||||
childFake = true;
|
childFake = true;
|
||||||
childTypename = getTypeName();
|
childTypename = getTypeName();
|
||||||
} else {
|
} else {
|
||||||
qName = "(" + getQualifiedName() + ")." + vars[i].getExp();
|
fn = "(" + fn + ")." + vars[i].getExp();
|
||||||
}
|
}
|
||||||
} else { // If not C++ language
|
} 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) {
|
if (childTypename != null) {
|
||||||
// Hack to reset the typename to a known value
|
// Hack to reset the typename to a known value
|
||||||
v.typename = childTypename;
|
v.typename = childTypename;
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
int stackdepth;
|
int stackdepth;
|
||||||
|
|
||||||
String qualifiedName = null;
|
String qualifiedName = null;
|
||||||
|
String fullName = null;
|
||||||
Type type = null;
|
Type type = null;
|
||||||
String typename = null;
|
String typename = null;
|
||||||
String sizeof = null;
|
String sizeof = null;
|
||||||
|
@ -70,10 +71,10 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
this(target, n, null, stack, pos, depth);
|
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);
|
super(target);
|
||||||
name = n;
|
name = n;
|
||||||
qualifiedName = q;
|
fullName = fn;
|
||||||
frame = stack;
|
frame = stack;
|
||||||
position = pos;
|
position = pos;
|
||||||
stackdepth = depth;
|
stackdepth = depth;
|
||||||
|
@ -115,22 +116,31 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String encodeVariable() {
|
public String encodeVariable() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
String fn = getFullName();
|
||||||
if (castingLength > 0 || castingIndex > 0) {
|
if (castingLength > 0 || castingIndex > 0) {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append("*(");
|
buffer.append("*(");
|
||||||
buffer.append('(').append(getName()).append(')');
|
buffer.append('(').append(fn).append(')');
|
||||||
if (castingIndex != 0) {
|
if (castingIndex != 0) {
|
||||||
buffer.append('+').append(castingIndex);
|
buffer.append('+').append(castingIndex);
|
||||||
}
|
}
|
||||||
buffer.append(')');
|
buffer.append(')');
|
||||||
buffer.append('@').append(castingLength);
|
buffer.append('@').append(castingLength);
|
||||||
|
fn = buffer.toString();
|
||||||
} else if (castingType != null && castingType.length() > 0) {
|
} else if (castingType != null && castingType.length() > 0) {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append("((").append(castingType).append(')');
|
buffer.append("((").append(castingType).append(')');
|
||||||
buffer.append(getName()).append(')');
|
buffer.append(fn).append(')');
|
||||||
} else {
|
fn = buffer.toString();
|
||||||
buffer.append(getName());
|
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullName() {
|
||||||
|
if (fullName == null) {
|
||||||
|
fullName = getName();
|
||||||
|
}
|
||||||
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue