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

GDB has special "types"

int8_t int16_t etc ... parse them also.
This commit is contained in:
Alain Magloire 2004-05-31 23:51:45 +00:00
parent f509d06f05
commit 97876ded77
5 changed files with 60 additions and 16 deletions

View file

@ -1,7 +1,18 @@
2004-05-28 Alain Magloire
GDB has special "types"
int8_t int16_t etc ... parse them also.
* cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Register.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RegisterObject.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
2004-05-28 Alain Magloire
QuickFix for PR 58249
* cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java
2004-05-28 Alain Magloire
Error in looking for the CIdentifier.

View file

@ -307,6 +307,20 @@ public class SourceManager extends Manager implements ICDISourceManager {
return new StructType(target, typename);
}
// GDB has some special types for int
if (typename.equals("int8_t")) { //$NON-NLS-1$
return new CharType(target, typename);
} else if (typename.equals("int16_t")) { //$NON-NLS-$1
return new ShortType(target, typename);
} else if (typename.equals("int32_t")) { //$NON-NLS-$1
return new LongType(target, typename);
} else if (typename.equals("int64_t")) { //$NON-NLS-$1
return new IntType(target, typename);
} else if (typename.equals("int128_t")) { //$NON-NLS-$1
return new IntType(target, typename);
}
StringTokenizer st = new StringTokenizer(typename);
int count = st.countTokens();

View file

@ -26,14 +26,17 @@ public class Register extends Variable implements ICDIRegister {
super(obj, var);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#getQualifiedName()
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.cdi.model.VariableObject#getFullName()
*/
public String getQualifiedName() throws CDIException {
if (qualifiedName == null) {
qualifiedName = "$" + getFullName(); //$NON-NLS-1$
public String getFullName() {
if (fullName == null) {
String n = getName();
if (!n.startsWith("$")) { //$NON-NLS-1$
fullName = "$" + n; //$NON-NLS-1$
}
}
return qualifiedName;
return fullName;
}
public ICDIVariable[] getChildren() throws CDIException {
@ -52,8 +55,19 @@ public class Register extends Variable implements ICDIRegister {
MIVar[] vars = info.getMIVars();
children = new Register[vars.length];
for (int i = 0; i < vars.length; i++) {
String fn;
String exp = vars[i].getExp();
if (isCPPLanguage()) {
if ((exp.equals("private") || exp.equals("public") || exp.equals("protected"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fn = getFullName();
} else {
fn = getFullName() + "." + exp;
}
} else {
fn = getFullName() + "." + exp;
}
RegisterObject regObj = new RegisterObject(getTarget(),
vars[i].getExp(), getPosition());
exp, fn, getPosition());
children[i] = mgr.createRegister(regObj, vars[i]);
}
} catch (MIException e) {

View file

@ -1,6 +1,5 @@
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
@ -12,14 +11,8 @@ public class RegisterObject extends VariableObject implements ICDIRegisterObject
super(target, name, null, i, 0);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#getQualifiedName()
*/
public String getQualifiedName() throws CDIException {
if (qualifiedName == null) {
qualifiedName = "$" + getFullName(); //$NON-NLS-1$
}
return qualifiedName;
public RegisterObject(ICDITarget target, String name, String fn, int i) {
super(target, name, fn, null, i, 0);
}
}

View file

@ -13,6 +13,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
/**
@ -52,6 +53,17 @@ public class ArrayValue extends DerivedValue implements ICDIArrayValue {
// throw new CDIException("Index out of bound");
//}
// Overload for registers.
if (variable instanceof Register) {
ICDIVariable[] vars = getVariables();
if (index < vars.length && (index + length) <= vars.length) {
ICDIVariable[] newVars = new ICDIVariable[length];
System.arraycopy(vars, index, newVars, 0, length);
return newVars;
}
return new ICDIVariable[0];
}
//String subarray = "*(" + variable.getName() + "+" + index + ")@" + length;
ICDITarget target = getTarget();
Session session = (Session) (target.getSession());