1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

2004-11-11 Alain Magloire

Fix for PR 75000, from PalmSource
	* cdi/org/eclipse/cdt/debug/core/cdi/model/Variable.java
	* cdi/org/eclipse/cdt/debug/core/cdi/model/VariableDescriptor.java
	* mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoType.java
This commit is contained in:
Alain Magloire 2004-11-12 02:11:55 +00:00
parent 1885ceaedf
commit f9fc2468d8
4 changed files with 69 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2004-11-11 Alain Magloire
Fix for PR 75000, from PalmSource
* cdi/org/eclipse/cdt/debug/core/cdi/model/Variable.java
* cdi/org/eclipse/cdt/debug/core/cdi/model/VariableDescriptor.java
* mi/org/eclipse/cdt/debug/mi/core/command/MIVarInfoType.java
2004-11-10 Alain Magloire 2004-11-10 Alain Magloire
Fix for PR 51113 and PR 66268 Fix for PR 51113 and PR 66268
It allow more flexibility in the GDB console, for example It allow more flexibility in the GDB console, for example

View file

@ -57,6 +57,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.model.type.WCharValue;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory; import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIVarAssign; import org.eclipse.cdt.debug.mi.core.command.MIVarAssign;
import org.eclipse.cdt.debug.mi.core.command.MIVarInfoExpression; import org.eclipse.cdt.debug.mi.core.command.MIVarInfoExpression;
import org.eclipse.cdt.debug.mi.core.command.MIVarInfoType;
import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren; import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren;
import org.eclipse.cdt.debug.mi.core.command.MIVarSetFormat; import org.eclipse.cdt.debug.mi.core.command.MIVarSetFormat;
import org.eclipse.cdt.debug.mi.core.command.MIVarShowAttributes; import org.eclipse.cdt.debug.mi.core.command.MIVarShowAttributes;
@ -64,6 +65,7 @@ import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIVar; import org.eclipse.cdt.debug.mi.core.output.MIVar;
import org.eclipse.cdt.debug.mi.core.output.MIVarInfoExpressionInfo; import org.eclipse.cdt.debug.mi.core.output.MIVarInfoExpressionInfo;
import org.eclipse.cdt.debug.mi.core.output.MIVarInfoTypeInfo;
import org.eclipse.cdt.debug.mi.core.output.MIVarListChildrenInfo; import org.eclipse.cdt.debug.mi.core.output.MIVarListChildrenInfo;
import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo; import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo;
@ -402,4 +404,25 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
varMgr.destroyVariable(this); varMgr.destroyVariable(this);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName()
*/
public String getTypeName() throws CDIException {
if (fTypename == null) {
MISession mi = ((Target) getTarget()).getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarInfoType infoType = factory.createMIVarInfoType(fMiVar.getVarName());
try {
mi.postCommand(infoType);
MIVarInfoTypeInfo info = infoType.getMIVarInfoTypeInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
fTypename = info.getType();
} catch (MIException e) {
throw new MI2CDIException(e);
}
}
return fTypename;
}
} }

View file

@ -46,7 +46,7 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
String qualifiedName = null; String qualifiedName = null;
String fFullName = null; String fFullName = null;
ICDIType fType = null; ICDIType fType = null;
String typename = null; String fTypename = null;
String sizeof = null; String sizeof = null;
/** /**
@ -168,8 +168,8 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
*/ */
public ICDIType getType() throws CDIException { public ICDIType getType() throws CDIException {
if (fType == null) { if (fType == null) {
String nametype = getTypeName();
Target target = (Target)getTarget(); Target target = (Target)getTarget();
Session session = (Session) (target.getSession());
StackFrame frame = (StackFrame)getStackFrame(); StackFrame frame = (StackFrame)getStackFrame();
if (frame == null) { if (frame == null) {
Thread thread = (Thread)getThread(); Thread thread = (Thread)getThread();
@ -179,8 +179,8 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
frame = ((Thread)target.getCurrentThread()).getCurrentStackFrame(); frame = ((Thread)target.getCurrentThread()).getCurrentStackFrame();
} }
} }
Session session = (Session) target.getSession();
SourceManager sourceMgr = session.getSourceManager(); SourceManager sourceMgr = session.getSourceManager();
String nametype = sourceMgr.getTypeName(frame, getQualifiedName());
try { try {
fType = sourceMgr.getType(frame, nametype); fType = sourceMgr.getType(frame, nametype);
} catch (CDIException e) { } catch (CDIException e) {
@ -271,11 +271,22 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName()
*/ */
public String getTypeName() throws CDIException { public String getTypeName() throws CDIException {
if (typename == null) { if (fTypename == null) {
ICDIType theType = getType(); Target target = (Target)getTarget();
typename = theType.getTypeName(); StackFrame frame = (StackFrame)getStackFrame();
if (frame == null) {
Thread thread = (Thread)getThread();
if (thread != null) {
frame = thread.getCurrentStackFrame();
} else {
frame = ((Thread)target.getCurrentThread()).getCurrentStackFrame();
}
}
Session session = (Session) target.getSession();
SourceManager sourceMgr = session.getSourceManager();
fTypename = sourceMgr.getTypeName(frame, getQualifiedName());
} }
return typename; return fTypename;
} }
/** /**

View file

@ -11,6 +11,11 @@
package org.eclipse.cdt.debug.mi.core.command; package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
import org.eclipse.cdt.debug.mi.core.output.MIVarInfoTypeInfo;
/** /**
* *
* -var-info-type NAME * -var-info-type NAME
@ -26,4 +31,21 @@ public class MIVarInfoType extends MICommand
public MIVarInfoType(String name) { public MIVarInfoType(String name) {
super("-var-info-type", new String[]{name}); //$NON-NLS-1$ super("-var-info-type", new String[]{name}); //$NON-NLS-1$
} }
public MIVarInfoTypeInfo getMIVarInfoTypeInfo() throws MIException {
return (MIVarInfoTypeInfo)getMIInfo();
}
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();
if (out != null) {
info = new MIVarInfoTypeInfo(out);
if (info.isError()) {
throwMIException(info, out);
}
}
return info;
}
} }