mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
2005-06-27 Alain Magloire
Bug when parsing "int *&" corrected. Change in ICDIReferenceValue. Use the type in the response of the var-create instead of reissuing -var-info-type * cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResource.properties * cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/ SourceManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/CharValue.java * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/IntergralValue.java * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/PointerValue.java * cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/ReferenceValue.java * mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java * mi/org/eclipse/cdt/debug/mi/core/MIInferior.java
This commit is contained in:
parent
504759ff91
commit
dd61bd77b0
12 changed files with 159 additions and 95 deletions
|
@ -1,3 +1,20 @@
|
|||
2005-06-27 Alain Magloire
|
||||
Bug when parsing "int *&" corrected.
|
||||
Change in ICDIReferenceValue.
|
||||
Use the type in the response of the var-create instead of reissuing -var-info-type
|
||||
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/CdiResource.properties
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/ SourceManager.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
|
||||
* cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/CharValue.java
|
||||
* cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/IntergralValue.java
|
||||
* cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/PointerValue.java
|
||||
* cdi;/org/eclipse/cdt/debug/mi/core/cdi/model/ReferenceValue.java
|
||||
* mi/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java
|
||||
* mi/org/eclipse/cdt/debug/mi/core/MIInferior.java
|
||||
|
||||
2005-06-27 Alain Magloire
|
||||
Base on a patch from Chris Wiebe.
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
|
||||
|
|
|
@ -23,7 +23,7 @@ cdi.RuntimeOptions.Unable_to_set_working_dir=Unable to set working directory:
|
|||
cdi.Session.Unknown_target=Unkown target
|
||||
cdi.VariableManager.Unknown_type=Unknown type
|
||||
cdi.VariableManager.Wrong_variable_type=Wrong variable type
|
||||
cdi.VariableManager.Unknown_variable_ogject=Unknown variable object
|
||||
cdi.VariableManager.Unknown_variable_object=Unknown variable object
|
||||
cdi.model.VariableObject.Target_not_responding=Target is not responding
|
||||
cdi.model.Target.Unknown_thread=Unknown thread
|
||||
cdi.model.Target.Target_not_responding=Target is not responding
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||
import org.eclipse.cdt.debug.mi.core.RxThread;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Signal;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||
|
@ -57,6 +58,8 @@ public class SignalManager extends Manager {
|
|||
CommandFactory factory = miSession.getCommandFactory();
|
||||
CLIInfoSignals sigs = factory.createCLIInfoSignals();
|
||||
try {
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(false);
|
||||
miSession.postCommand(sigs);
|
||||
CLIInfoSignalsInfo info = sigs.getMIInfoSignalsInfo();
|
||||
if (info == null) {
|
||||
|
@ -65,6 +68,9 @@ public class SignalManager extends Manager {
|
|||
miSigs = info.getMISignals();
|
||||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(true);
|
||||
}
|
||||
return miSigs;
|
||||
}
|
||||
|
@ -74,6 +80,8 @@ public class SignalManager extends Manager {
|
|||
CommandFactory factory = miSession.getCommandFactory();
|
||||
CLIInfoSignals sigs = factory.createCLIInfoSignals(name);
|
||||
try {
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(false);
|
||||
miSession.postCommand(sigs);
|
||||
CLIInfoSignalsInfo info = sigs.getMIInfoSignalsInfo();
|
||||
if (info == null) {
|
||||
|
@ -85,6 +93,9 @@ public class SignalManager extends Manager {
|
|||
}
|
||||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(true);
|
||||
}
|
||||
return sig;
|
||||
}
|
||||
|
|
|
@ -471,11 +471,13 @@ public class SourceManager extends Manager {
|
|||
}
|
||||
|
||||
public String getTypeName(Target target, String variable) throws CDIException {
|
||||
MISession miSession = target.getMISession();
|
||||
try {
|
||||
MISession mi = target.getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(false);
|
||||
CommandFactory factory = miSession.getCommandFactory();
|
||||
CLIWhatis whatis = factory.createCLIWhatis(variable);
|
||||
mi.postCommand(whatis);
|
||||
miSession.postCommand(whatis);
|
||||
CLIWhatisInfo info = whatis.getMIWhatisInfo();
|
||||
if (info == null) {
|
||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||
|
@ -483,6 +485,9 @@ public class SourceManager extends Manager {
|
|||
return info.getType();
|
||||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
} finally {
|
||||
RxThread rxThread = miSession.getRxThread();
|
||||
rxThread.setEnableConsole(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,11 @@ public class Value extends CObject implements ICDIValue {
|
|||
super((Target)v.getTarget());
|
||||
variable = v;
|
||||
}
|
||||
|
||||
|
||||
protected Variable getVariable() {
|
||||
return variable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getTypeName()
|
||||
*/
|
||||
|
|
|
@ -426,18 +426,21 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
|||
*/
|
||||
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 = fMiVar.getType();
|
||||
if (fTypename == null || fTypename.length() == 0) {
|
||||
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);
|
||||
}
|
||||
fTypename = info.getType();
|
||||
} catch (MIException e) {
|
||||
throw new MI2CDIException(e);
|
||||
}
|
||||
}
|
||||
return fTypename;
|
||||
|
|
|
@ -30,8 +30,7 @@ public class CharValue extends IntegralValue implements ICDICharValue {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDICharValue#getValue()
|
||||
*/
|
||||
public char getValue() throws CDIException {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
return (char)intValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,11 +36,24 @@ public abstract class IntegralValue extends Value implements ICDIIntegralValue {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#biIntegerValue()
|
||||
*/
|
||||
public BigInteger bigIntegerValue() throws CDIException {
|
||||
String valueString = getValueString();
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
return bigIntegerValue(getValueString());
|
||||
}
|
||||
|
||||
public static BigInteger bigIntegerValue(String valueString) {
|
||||
// Coming from a reference
|
||||
if (valueString.startsWith("@")) { //$NON-NLS-1$
|
||||
valueString = valueString.substring(1);
|
||||
int colon = valueString.indexOf(':');
|
||||
if (colon != -1) {
|
||||
valueString = valueString.substring(colon + 1);
|
||||
}
|
||||
} else {
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return MIFormat.getBigInteger(valueString);
|
||||
} catch (NumberFormatException e) {
|
||||
|
@ -52,68 +65,28 @@ public abstract class IntegralValue extends Value implements ICDIIntegralValue {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#longValue()
|
||||
*/
|
||||
public long longValue() throws CDIException {
|
||||
long value = 0;
|
||||
String valueString = getValueString();
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
value = MIFormat.getBigInteger(valueString).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return value;
|
||||
return bigIntegerValue().longValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#longValue()
|
||||
*/
|
||||
public int intValue() throws CDIException {
|
||||
int value = 0;
|
||||
String valueString = getValueString();
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
value = MIFormat.getBigInteger(valueString).intValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return value;
|
||||
return bigIntegerValue().intValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#shortValue()
|
||||
*/
|
||||
public short shortValue() throws CDIException {
|
||||
short value = 0;
|
||||
String valueString = getValueString();
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
value = MIFormat.getBigInteger(valueString).shortValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return value;
|
||||
return bigIntegerValue().shortValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#byteValue()
|
||||
*/
|
||||
public int byteValue() throws CDIException {
|
||||
byte value = 0;
|
||||
String valueString = getValueString();
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
value = MIFormat.getBigInteger(valueString).byteValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return value;
|
||||
return bigIntegerValue().byteValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.math.BigInteger;
|
|||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
|
||||
import org.eclipse.cdt.debug.mi.core.MIFormat;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
|
||||
/**
|
||||
|
@ -33,15 +32,6 @@ public class PointerValue extends DerivedValue implements ICDIPointerValue {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
|
||||
*/
|
||||
public BigInteger pointerValue() throws CDIException {
|
||||
String valueString = getValueString().trim();
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
return MIFormat.getBigInteger(valueString);
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
return IntegralValue.bigIntegerValue(getValueString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,26 @@
|
|||
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue;
|
||||
import org.eclipse.cdt.debug.mi.core.MIFormat;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
|
||||
/**
|
||||
|
@ -35,21 +50,43 @@ public class ReferenceValue extends DerivedValue implements ICDIReferenceValue {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue()
|
||||
*/
|
||||
public BigInteger referenceValue() throws CDIException {
|
||||
String valueString = getValueString().trim();
|
||||
if (valueString.startsWith("@")) { //$NON-NLS-1$
|
||||
valueString = valueString.substring(1);
|
||||
public ICDIValue referenceValue() throws CDIException {
|
||||
Value value = null;
|
||||
ICDIReferenceType rt = (ICDIReferenceType)getType();
|
||||
ICDIType t = rt.getComponentType();
|
||||
if (t instanceof ICDIBoolType) {
|
||||
value = new BoolValue(getVariable());
|
||||
} else if (t instanceof ICDICharType) {
|
||||
value = new CharValue(getVariable());
|
||||
} else if (t instanceof ICDIWCharType) {
|
||||
value = new WCharValue(getVariable());
|
||||
} else if (t instanceof ICDIShortType) {
|
||||
value = new ShortValue(getVariable());
|
||||
} else if (t instanceof ICDIIntType) {
|
||||
value = new IntValue(getVariable());
|
||||
} else if (t instanceof ICDILongType) {
|
||||
value = new LongValue(getVariable());
|
||||
} else if (t instanceof ICDILongLongType) {
|
||||
value = new LongLongValue(getVariable());
|
||||
} else if (t instanceof ICDIEnumType) {
|
||||
value = new EnumValue(getVariable());
|
||||
} else if (t instanceof ICDIFloatType) {
|
||||
value = new FloatValue(getVariable());
|
||||
} else if (t instanceof ICDIDoubleType) {
|
||||
value = new DoubleValue(getVariable());
|
||||
} else if (t instanceof ICDIFunctionType) {
|
||||
value = new FunctionValue(getVariable());
|
||||
} else if (t instanceof ICDIPointerType) {
|
||||
value = new PointerValue(getVariable());
|
||||
// } else if (t instanceof ICDIReferenceType) {
|
||||
// value = new ReferenceValue(getVariable());
|
||||
} else if (t instanceof ICDIArrayType) {
|
||||
value = new ArrayValue(getVariable());
|
||||
} else if (t instanceof ICDIStructType) {
|
||||
value = new StructValue(getVariable());
|
||||
} else {
|
||||
value = new Value(getVariable());
|
||||
}
|
||||
int space = valueString.indexOf(":"); //$NON-NLS-1$
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
|
||||
return MIFormat.getBigInteger(valueString);
|
||||
} catch(Exception e){
|
||||
return null;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -412,6 +412,8 @@ public class GDBTypeParser {
|
|||
}
|
||||
}
|
||||
insertingChild(GDBType.ARRAY, len);
|
||||
} else if (tokenType == '&') {
|
||||
insertingChild(GDBType.REFERENCE);
|
||||
} else {
|
||||
// oops bad declaration ?
|
||||
return;
|
||||
|
@ -437,6 +439,24 @@ public class GDBTypeParser {
|
|||
|
||||
GDBTypeParser parser = new GDBTypeParser();
|
||||
|
||||
System.out.println("int *&"); //$NON-NLS-1$
|
||||
parser.parse("int *&"); //$NON-NLS-1$
|
||||
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||
System.out.println(parser.getGDBType().verbose());
|
||||
System.out.println();
|
||||
|
||||
System.out.println("int (&rg)(int)"); //$NON-NLS-1$
|
||||
parser.parse("int (&rg)(int)"); //$NON-NLS-1$
|
||||
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||
System.out.println(parser.getGDBType().verbose());
|
||||
System.out.println();
|
||||
|
||||
System.out.println("int (&ra)[3]"); //$NON-NLS-1$
|
||||
parser.parse("int (&rg)[3]"); //$NON-NLS-1$
|
||||
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||
System.out.println(parser.getGDBType().verbose());
|
||||
System.out.println();
|
||||
|
||||
System.out.println("struct link { int i; int j; struct link * next;} *"); //$NON-NLS-1$
|
||||
parser.parse("struct link { int i; int j; struct link * next} *"); //$NON-NLS-1$
|
||||
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||
|
|
|
@ -332,11 +332,16 @@ public class MIInferior extends Process {
|
|||
CommandFactory factory = session.getCommandFactory();
|
||||
CLIInfoProgram prog = factory.createCLIInfoProgram();
|
||||
try {
|
||||
RxThread rxThread = session.getRxThread();
|
||||
rxThread.setEnableConsole(false);
|
||||
session.postCommand(prog);
|
||||
CLIInfoProgramInfo info = prog.getMIInfoProgramInfo();
|
||||
pid = info.getPID();
|
||||
} catch (MIException e) {
|
||||
// no rethrown.
|
||||
} finally {
|
||||
RxThread rxThread = session.getRxThread();
|
||||
rxThread.setEnableConsole(true);
|
||||
}
|
||||
}
|
||||
// We fail permantely.
|
||||
|
|
Loading…
Add table
Reference in a new issue