1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

ICDIType extends ICDIObject

This commit is contained in:
Alain Magloire 2003-05-23 15:49:46 +00:00
parent 262478774d
commit 139372d3d0
27 changed files with 329 additions and 110 deletions

View file

@ -6,6 +6,8 @@
package org.eclipse.cdt.debug.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
/**
*
@ -13,7 +15,7 @@ package org.eclipse.cdt.debug.core.cdi.model.type;
*
* @since Apr 15, 2003
*/
public interface ICDIType {
public interface ICDIType extends ICDIObject {
/**
* Returns the name.

View file

@ -11,6 +11,7 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Instruction;
@ -217,53 +218,53 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
}
public Type getType(String name) throws CDIException {
public Type getType(ICDITarget target, String name) throws CDIException {
String typename = name.trim();
// Check the derived types and agregate types
if (typename.endsWith("]")) {
return new ArrayType(typename);
} else if (typename.indexOf("*") != -1) {
return new PointerType(typename);
} else if (typename.indexOf("&") != -1) {
return new ReferenceType(typename);
return new ArrayType(target, typename);
} else if (typename.endsWith("*")) {
return new PointerType(target, typename);
} else if (typename.endsWith("&")) {
return new ReferenceType(target, typename);
} else if (typename.endsWith(")")) {
return new FunctionType(typename);
return new FunctionType(target, typename);
} else if (typename.startsWith("enum ")) {
return new EnumType(typename);
return new EnumType(target, typename);
} else if (typename.startsWith("union ")) {
return new StructType(typename);
return new StructType(target, typename);
} else if (typename.startsWith("struct ")) {
return new StructType(typename);
return new StructType(target, typename);
} else if (typename.startsWith("class ")) {
return new StructType(typename);
return new StructType(target, typename);
}
// Check the primitives.
if (typename.equals("char")) {
return new CharType(typename);
return new CharType(target, typename);
} else if (typename.equals("wchar_t")) {
return new WCharType(typename);
return new WCharType(target, typename);
} else if (typename.equals("short")) {
return new ShortType(typename);
return new ShortType(target, typename);
} else if (typename.equals("int")) {
return new IntType(typename);
return new IntType(target, typename);
} else if (typename.equals("long")) {
return new LongType(typename);
return new LongType(target, typename);
} else if (typename.equals("unsigned")) {
return new IntType(typename, true);
return new IntType(target, typename, true);
} else if (typename.equals("signed")) {
return new IntType(typename);
return new IntType(target, typename);
} else if (typename.equals("bool")) {
return new BoolType(typename);
return new BoolType(target, typename);
} else if (typename.equals("_Bool")) {
return new BoolType(typename);
return new BoolType(target, typename);
} else if (typename.equals("float")) {
return new FloatType(typename);
return new FloatType(target, typename);
} else if (typename.equals("double")) {
return new DoubleType(typename);
return new DoubleType(target, typename);
} else if (typename.equals("void")) {
return new VoidType(typename);
return new VoidType(target, typename);
}
StringTokenizer st = new StringTokenizer(typename);
@ -289,19 +290,19 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
boolean isImaginery = (first.equals("_Imaginary") || second.equals("_Imaginary"));
if (isChar && (isSigned || isUnsigned)) {
return new CharType(typename, isUnsigned);
return new CharType(target, typename, isUnsigned);
} else if (isShort && (isSigned || isUnsigned)) {
return new ShortType(typename, isUnsigned);
return new ShortType(target, typename, isUnsigned);
} else if (isInt && (isSigned || isUnsigned)) {
return new IntType(typename, isUnsigned);
return new IntType(target, typename, isUnsigned);
} else if (isLong && (isInt || isSigned || isUnsigned)) {
return new LongType(typename, isUnsigned);
return new LongType(target, typename, isUnsigned);
} else if (isLongLong) {
return new LongLongType(typename);
return new LongLongType(target, typename);
} else if (isDouble && (isLong || isComplex || isImaginery)) {
return new DoubleType(typename, isComplex, isImaginery, isLong);
return new DoubleType(target, typename, isComplex, isImaginery, isLong);
} else if (isFloat && (isComplex || isImaginery)) {
return new FloatType(typename, isComplex, isImaginery);
return new FloatType(target, typename, isComplex, isImaginery);
}
} else if (count == 3) {
// ISOC allows permutation. replace short by: long or short
@ -329,13 +330,13 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
if (isShort && isInt && (isSigned || unSigned)) {
return new ShortType(typename, unSigned);
return new ShortType(target, typename, unSigned);
} else if (isLong && isInt && (isSigned || unSigned)) {
return new LongType(typename, unSigned);
return new LongType(target, typename, unSigned);
} else if (isLongLong && (isSigned || unSigned)) {
return new LongLongType(typename, unSigned);
return new LongLongType(target, typename, unSigned);
} else if (isDouble && isLong && (isComplex || isImaginery)) {
return new DoubleType(typename, isComplex, isImaginery, isLong);
return new DoubleType(target, typename, isComplex, isImaginery, isLong);
}
} else if (count == 4) {
// ISOC allows permutation:
@ -355,7 +356,7 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|| (third.equals("long") && fourth.equals("long"));
if (isLongLong && isInt && (isSigned || unSigned)) {
return new LongLongType(typename, unSigned);
return new LongLongType(target, typename, unSigned);
}
}
throw new CDIException("Unknown type");

View file

@ -114,6 +114,48 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
return (Variable[]) variableList.toArray(new Variable[0]);
}
/**
* Check the type
*/
public void checkType(String type) throws CDIException {
try {
MISession mi = ((Session)getSession()).getMISession();
CommandFactory factory = mi.getCommandFactory();
MIPType ptype = factory.createMIPType(type);
mi.postCommand(ptype);
MIPTypeInfo info = ptype.getMIPtypeInfo();
if (info == null) {
throw new CDIException("No answer");
}
} catch (MIException e) {
throw new MI2CDIException(e);
}
}
public String createStringEncoding(VariableObject varObj) {
StringBuffer buffer = new StringBuffer();
if (varObj.length > 0) {
buffer.append("*(");
buffer.append('(');
if (varObj.type != null && varObj.type.length() > 0) {
buffer.append('(').append(varObj.type).append(')');
}
buffer.append(varObj.getName());
buffer.append(')');
if (varObj.index != 0) {
buffer.append('+').append(varObj.index);
}
buffer.append(')');
buffer.append('@').append(varObj.length - varObj.index);
} else if (varObj.type != null && varObj.type.length() > 0) {
buffer.append('(').append(varObj.type).append(')');
buffer.append('(').append(varObj.getName()).append(')');
} else {
buffer.append(varObj.getName());
}
return buffer.toString();
}
/**
* Tell gdb to remove the underlying var-object also.
*/

View file

@ -169,9 +169,11 @@ public class Variable extends CObject implements ICDIVariable {
//value = new FunctionValue(this);
value = new Value(this);
} else if (t instanceof ICDIPointerType) {
((ICDIPointerType)t).getComponentType();
//value = new PointerValue(this);
value = new Value(this);
} else if (t instanceof ICDIArrayType) {
((ICDIArrayType)t).getComponentType();
//value = new ArrayValue(this);
value = new Value(this);
} else if (t instanceof ICDIStructType) {
@ -287,9 +289,9 @@ public class Variable extends CObject implements ICDIVariable {
SourceManager sourceMgr = (SourceManager)session.getSourceManager();
String typename = getTypeName();
try {
type = sourceMgr.getType(typename);
type = sourceMgr.getType(getTarget(), typename);
} catch (CDIException e) {
type = new IncompleteType(typename);
type = new IncompleteType(getTarget(), typename);
// // Try after ptype.
// String ptype = sourceMgr.getDetailTypeName(typename);
// try {

View file

@ -13,6 +13,11 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
*/
public class VariableObject extends CObject implements ICDIVariableObject {
// Casting info.
public String type;
public int index;
public int length;
String name;
int position;
ICDIStackFrame frame;
@ -30,6 +35,9 @@ public class VariableObject extends CObject implements ICDIVariableObject {
frame = stack;
position = pos;
stackdepth = depth;
type = new String();
index = 0;
length = 0;
}
public ICDITarget getTarget() {

View file

@ -5,13 +5,14 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIAggregateType;
/**
*/
public abstract class AggregateType extends Type implements ICDIAggregateType {
public AggregateType(String typename) {
super(typename);
public AggregateType(ICDITarget target, String typename) {
super(target, typename);
}
}

View file

@ -5,32 +5,66 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
/**
*/
public class ArrayType extends DerivedType implements ICDIArrayType {
int dimension;
/**
* @param typename
*/
public ArrayType(String typename) {
super(typename);
public ArrayType(ICDITarget target, String typename) {
super(target, typename);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIArrayType#getComponentType()
*/
public ICDIType getComponentType() {
return null;
if (derivedType == null) {
String orig = getTypeName();
String name = orig;
int lbracket = orig.lastIndexOf('[');
int rbracket = orig.lastIndexOf(']');
if (lbracket != -1 && rbracket != -1 && (rbracket > lbracket)) {
String dim = name.substring(lbracket + 1, rbracket).trim();
try {
dimension = Integer.parseInt(dim);
name = orig.substring(0, lbracket).trim();
Session session = (Session)(getTarget().getSession());
SourceManager sourceMgr = (SourceManager)session.getSourceManager();
derivedType = sourceMgr.getType(getTarget(), name);
} catch (CDIException e) {
// // Try after ptype.
// String ptype = sourceMgr.getDetailTypeName(type);
// try {
// type = sourceMgr.getType(ptype);
// } catch (CDIException ex) {
// type = new IncompleteType(typename);
// }
} catch (NumberFormatException e) {
}
}
if (derivedType == null) {
derivedType = new IncompleteType(getTarget(), name);
}
}
return derivedType;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType#getDimension()
*/
public int getDimension() {
return 0;
return dimension;
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType;
/**
@ -14,12 +15,12 @@ public class BoolType extends IntegralType implements ICDIBoolType {
/**
* @param typename
*/
public BoolType(String typename) {
this(typename, false);
public BoolType(ICDITarget target, String typename) {
this(target, typename, false);
}
public BoolType(String typename, boolean usigned) {
super(typename, usigned);
public BoolType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType;
/**
@ -14,11 +15,11 @@ public class CharType extends IntegralType implements ICDICharType {
/**
* @param typename
*/
public CharType(String typename) {
this(typename, false);
public CharType(ICDITarget target, String typename) {
this(target, typename, false);
}
public CharType(String typename, boolean usigned) {
super(typename, usigned);
public CharType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
@ -12,15 +13,10 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
*/
public abstract class DerivedType extends Type implements ICDIDerivedType {
public DerivedType(String typename) {
super(typename);
}
ICDIType derivedType;
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType#getComponentType()
*/
public ICDIType getComponentType() {
return null;
public DerivedType(ICDITarget target, String typename) {
super(target, typename);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType;
/**
@ -14,11 +15,11 @@ public class DoubleType extends FloatingPointType implements ICDIDoubleType {
/**
* @param typename
*/
public DoubleType(String typename) {
this(typename, false, false, false);
public DoubleType(ICDITarget target, String typename) {
this(target, typename, false, false, false);
}
public DoubleType(String typename, boolean isComplex, boolean isImg, boolean isLong) {
super(typename, isComplex, isImg, isLong);
public DoubleType(ICDITarget target, String typename, boolean isComplex, boolean isImg, boolean isLong) {
super(target, typename, isComplex, isImg, isLong);
}
}

View file

@ -6,6 +6,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType;
/**
@ -15,11 +16,11 @@ public class EnumType extends IntegralType implements ICDIEnumType {
/**
* @param typename
*/
public EnumType(String typename) {
this(typename, false);
public EnumType(ICDITarget target, String typename) {
this(target, typename, false);
}
public EnumType(String typename, boolean usigned) {
super(typename, usigned);
public EnumType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType;
/**
@ -14,11 +15,11 @@ public class FloatType extends FloatingPointType implements ICDIFloatType {
/**
* @param typename
*/
public FloatType(String typename) {
this(typename, false, false);
public FloatType(ICDITarget target, String typename) {
this(target, typename, false, false);
}
public FloatType(String typename, boolean isComplex, boolean isImg) {
super(typename, isComplex, isImg, false);
public FloatType(ICDITarget target, String typename, boolean isComplex, boolean isImg) {
super(target, typename, isComplex, isImg, false);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType;
/**
@ -15,8 +16,8 @@ public abstract class FloatingPointType extends Type implements ICDIFloatingPoin
boolean imaginary;
boolean islong;
public FloatingPointType(String typename, boolean comp, boolean img, boolean l) {
super(typename);
public FloatingPointType(ICDITarget target, String typename, boolean comp, boolean img, boolean l) {
super(target, typename);
complex = comp;
imaginary = img;
islong = l;

View file

@ -5,13 +5,51 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
/**
*/
public class FunctionType extends DerivedType implements ICDIFunctionType {
public FunctionType(String typename) {
super(typename);
public FunctionType(ICDITarget target, String typename) {
super(target, typename);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType#getComponentType()
*/
public ICDIType getComponentType() {
if (derivedType != null) {
String orig = getTypeName();
String name = orig;
int lparen = orig.lastIndexOf('(');
int rparen = orig.lastIndexOf(')');
if (lparen != -1 && rparen != -1 && (rparen > lparen)) {
String dim = name.substring(lparen + 1, rparen).trim();
try {
name = orig.substring(0, lparen).trim();
Session session = (Session)(getTarget().getSession());
SourceManager sourceMgr = (SourceManager)session.getSourceManager();
derivedType = sourceMgr.getType(getTarget(), name);
} catch (CDIException e) {
// // Try after ptype.
// String ptype = sourceMgr.getDetailTypeName(type);
// try {
// type = sourceMgr.getType(ptype);
// } catch (CDIException ex) {
// type = new IncompleteType(typename);
// }
}
}
if (derivedType == null) {
derivedType = new IncompleteType(getTarget(), name);
}
}
return derivedType;
}
}

View file

@ -5,6 +5,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
/**
*/
@ -13,8 +15,8 @@ public class IncompleteType extends Type {
/**
* @param name
*/
public IncompleteType(String name) {
super(name);
public IncompleteType(ICDITarget target, String name) {
super(target, name);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType;
/**
@ -14,12 +15,12 @@ public class IntType extends IntegralType implements ICDIIntType {
/**
* @param typename
*/
public IntType(String typename) {
this(typename, false);
public IntType(ICDITarget target, String typename) {
this(target, typename, false);
}
public IntType(String typename, boolean usigned) {
super(typename, usigned);
public IntType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralType;
/**
@ -13,8 +14,8 @@ public abstract class IntegralType extends Type implements ICDIIntegralType {
boolean unSigned;
public IntegralType(String typename, boolean usigned) {
super(typename);
public IntegralType(ICDITarget target, String typename, boolean usigned) {
super(target, typename);
unSigned = usigned;
}

View file

@ -6,6 +6,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType;
/**
@ -15,11 +16,11 @@ public class LongLongType extends IntegralType implements ICDILongLongType {
/**
* @param typename
*/
public LongLongType(String typename) {
this(typename, false);
public LongLongType(ICDITarget target, String typename) {
this(target, typename, false);
}
public LongLongType(String typename, boolean usigned) {
super(typename, usigned);
public LongLongType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType;
/**
@ -14,11 +15,11 @@ public class LongType extends IntegralType implements ICDILongType {
/**
* @param typename
*/
public LongType(String typename) {
this(typename, false);
public LongType(ICDITarget target, String typename) {
this(target, typename, false);
}
public LongType(String typename, boolean usigned) {
super(typename, usigned);
public LongType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}

View file

@ -5,13 +5,52 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
/**
*/
public class PointerType extends DerivedType implements ICDIPointerType {
public PointerType(String typename) {
super(typename);
public PointerType(ICDITarget target, String typename) {
super(target, typename);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType#getComponentType()
*/
public ICDIType getComponentType() {
if (derivedType == null) {
String orig = getTypeName();
String name = orig;
int star = orig.lastIndexOf('*');
// remove last '*'
if (star != -1) {
name = orig.substring(0, star).trim();
Session session = (Session)(getTarget().getSession());
SourceManager sourceMgr = (SourceManager)session.getSourceManager();
try {
derivedType = sourceMgr.getType(getTarget(), name);
} catch (CDIException e) {
// // Try after ptype.
// String ptype = sourceMgr.getDetailTypeName(type);
// try {
// type = sourceMgr.getType(ptype);
// } catch (CDIException ex) {
// type = new IncompleteType(typename);
// }
}
}
if (derivedType == null) {
derivedType = new IncompleteType(getTarget(), name);
}
}
return derivedType;
}
}

View file

@ -5,7 +5,12 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
/**
*/
@ -14,8 +19,40 @@ public class ReferenceType extends DerivedType implements ICDIReferenceType {
/**
* @param name
*/
public ReferenceType(String name) {
super(name);
public ReferenceType(ICDITarget target, String name) {
super(target, name);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType#getComponentType()
*/
public ICDIType getComponentType() {
if (derivedType == null) {
String orig = getTypeName();
String name = orig;
int amp = orig.lastIndexOf('&');
// remove last '*'
if (amp != -1) {
name = orig.substring(0, amp).trim();
Session session = (Session)(getTarget().getSession());
SourceManager sourceMgr = (SourceManager)session.getSourceManager();
try {
derivedType = sourceMgr.getType(getTarget(), name);
} catch (CDIException e) {
// // Try after ptype.
// String ptype = sourceMgr.getDetailTypeName(type);
// try {
// type = sourceMgr.getType(ptype);
// } catch (CDIException ex) {
// type = new IncompleteType(typename);
// }
}
}
if (derivedType == null) {
derivedType = new IncompleteType(getTarget(), name);
}
}
return derivedType;
}
}

View file

@ -5,6 +5,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType;
/**
@ -14,11 +15,11 @@ public class ShortType extends IntegralType implements ICDIShortType {
/**
* @param typename
*/
public ShortType(String typename) {
this(typename, false);
public ShortType(ICDITarget target, String typename) {
this(target, typename, false);
}
public ShortType(String typename, boolean usigned) {
super(typename, usigned);
public ShortType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}

View file

@ -6,6 +6,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
/**
@ -15,8 +16,8 @@ public class StructType extends AggregateType implements ICDIStructType {
/**
* @param typename
*/
public StructType(String typename) {
super(typename);
public StructType(ICDITarget target, String typename) {
super(target, typename);
}

View file

@ -6,16 +6,19 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.model.CObject;
/**
*/
public abstract class Type implements ICDIType {
public abstract class Type extends CObject implements ICDIType {
String typename;
String detailName;
public Type(String name) {
public Type(ICDITarget target, String name) {
super(target);
typename = name;
}

View file

@ -5,13 +5,14 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIVoidType;
/**
*/
public class VoidType extends Type implements ICDIVoidType {
public VoidType(String typename) {
super(typename);
public VoidType(ICDITarget target, String typename) {
super(target, typename);
}
}

View file

@ -7,6 +7,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType;
/**
@ -16,11 +17,11 @@ public class WCharType extends IntegralType implements ICDIWCharType {
/**
* @param typename
*/
public WCharType(String typename) {
this(typename, false);
public WCharType(ICDITarget target, String typename) {
this(target, typename, false);
}
public WCharType(String typename, boolean usigned) {
super(typename, usigned);
public WCharType(ICDITarget target, String typename, boolean usigned) {
super(target, typename, usigned);
}
}