1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Bug 193776: [Debug/MI] Error displaying array variable when switching stack frame.

This commit is contained in:
Mikhail Khodjaiants 2007-06-21 17:51:23 +00:00
parent ab6ca2fc19
commit abc471dd3a

View file

@ -156,33 +156,15 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
} }
private String getHexAddress() throws CDIException { private String getHexAddress() throws CDIException {
if (hexAddress != null) { if (hexAddress != null) {
return hexAddress; return hexAddress;
} }
VariableManager vm = ((Session)((Target)getTarget()).getSession()).getVariableManager();
MISession mi = ((Target)getTarget()).getMISession(); String qualName = "&(" + getQualifiedName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
CommandFactory factory = mi.getCommandFactory(); LocalVariableDescriptor desc = new LocalVariableDescriptor((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(), getName(), qualName, getPosition(), getStackDepth());
String name = "&(" + getQualifiedName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ Variable v = vm.createVariable( desc );
MIVarCreate varCreateCmd = factory.createMIVarCreate(name); v.setFormat(ICDIFormat.HEXADECIMAL);
try { hexAddress = v.getValue().getValueString();
if (mi.getCommandTimeout() >= 0) {
mi.postCommand(varCreateCmd, mi.getCommandTimeout());
} else {
mi.postCommand(varCreateCmd);
}
MIVarCreateInfo info = varCreateCmd.getMIVarCreateInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
MIVar var = info.getMIVar();
Variable v = createVariable((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(),
name, name, getPosition(), getStackDepth(), var);
v.setFormat(ICDIFormat.HEXADECIMAL);
hexAddress = v.getValue().getValueString();
} catch (MIException e) {
throw new MI2CDIException(e);
}
return hexAddress; return hexAddress;
} }
@ -283,9 +265,12 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
ICDIType t = getType(); ICDIType t = getType();
boolean container = isStructureProvider(t); boolean container = isStructureProvider(t);
for (int i = 0; i < vars.length; i++) { for (int i = 0; i < vars.length; i++) {
String prefix = "(" + getFullName() + ")"; // parent qualified name // parent qualified name
String childName = vars[i].getExp(); // child simple name String prefix = '(' + getFullName() + ')';
String childFullName = prefix + "." + childName; // fallback full name // child simple name
String childName = vars[i].getExp();
// fallback full name
String childFullName = prefix + '.' + childName;
ICDIType childType = null; ICDIType childType = null;
boolean childFake = false; boolean childFake = false;
if (cppFakeLayer && container) { if (cppFakeLayer && container) {
@ -294,7 +279,7 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
if (!isAccessQualifier(childName)) { if (!isAccessQualifier(childName)) {
// if field is not access modifier and fake - it is a basetype // if field is not access modifier and fake - it is a basetype
// cast to it to see reduced structure as value // cast to it to see reduced structure as value
childFullName = "(" + childName + ")" + prefix; childFullName = '(' + childName + ')' + prefix;
} else { } else {
childFullName = prefix; childFullName = prefix;
} }