mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
New method getVariableObjectAsArray()
and getVariableObjectAsType().
This commit is contained in:
parent
2626b7316b
commit
fdfc8a1b98
2 changed files with 67 additions and 6 deletions
|
@ -42,9 +42,7 @@ public interface ICDIVariableManager extends ICDIManager {
|
|||
ICDIVariableObject getVariableObject(String filename, String function, String name) throws CDIException;
|
||||
|
||||
/**
|
||||
* Method createVariable.
|
||||
* Use the current stackframe to return an ICDIVariable.
|
||||
* A null stack means to use the current stackframe.
|
||||
* Use the stackframe to return an ICDIVariableObject for name.
|
||||
*
|
||||
* @param stack
|
||||
* @param name
|
||||
|
@ -53,6 +51,24 @@ public interface ICDIVariableManager extends ICDIManager {
|
|||
*/
|
||||
ICDIVariableObject getVariableObject(ICDIStackFrame stack, String name) throws CDIException;
|
||||
|
||||
/**
|
||||
* Consider the variable object as an Array of type and range[start, end]
|
||||
* @param stack
|
||||
* @param name
|
||||
* @return ICDIVariableObject
|
||||
* @throws CDIException
|
||||
*/
|
||||
ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject var, String type, int start, int end) throws CDIException;
|
||||
|
||||
/**
|
||||
* Consider the variable object as type.
|
||||
* @param stack
|
||||
* @param name
|
||||
* @return ICDIVariableObject
|
||||
* @throws CDIException
|
||||
*/
|
||||
ICDIVariableObject getVariableObjectAsType(ICDIVariableObject var, String type) throws CDIException;
|
||||
|
||||
/**
|
||||
* Method getVariableObjects.
|
||||
* Returns all the local variable objects of that stackframe.
|
||||
|
@ -74,7 +90,6 @@ public interface ICDIVariableManager extends ICDIManager {
|
|||
*/
|
||||
ICDIVariable createVariable(ICDIVariableObject var) throws CDIException;
|
||||
|
||||
|
||||
/**
|
||||
* Method getArgumentObject.
|
||||
* Returns a argument Object that will hold the name and the stackframe.
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.model.ArgumentObject;
|
|||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.VariableObject;
|
||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIPType;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIStackListArguments;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
|
||||
|
@ -35,6 +36,7 @@ import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
|||
import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIArg;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIPTypeInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIVar;
|
||||
|
@ -282,15 +284,28 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableArrayObject(ICDIVariableObject, String, int, int)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjectAsArray(ICDIVariableObject, String, int, int)
|
||||
*/
|
||||
public ICDIVariableObject getVariableArrayObject(ICDIVariableObject object, String type, int start, int end) throws CDIException {
|
||||
public ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject object, String type, int start, int end) throws CDIException {
|
||||
if (object instanceof VariableObject) {
|
||||
VariableObject obj = (VariableObject)object;
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("*(");
|
||||
buffer.append('(');
|
||||
if (type != null && type.length() > 0) {
|
||||
// Check if the type is valid.
|
||||
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);
|
||||
}
|
||||
buffer.append('(').append(type).append(')');
|
||||
}
|
||||
buffer.append(obj.getName());
|
||||
|
@ -305,6 +320,37 @@ public class VariableManager extends SessionObject implements ICDIVariableManage
|
|||
throw new CDIException("Unknown variable object");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjectAsArray(ICDIVariableObject, String, int, int)
|
||||
*/
|
||||
public ICDIVariableObject getVariableObjectAsType(ICDIVariableObject object, String type) throws CDIException {
|
||||
if (object instanceof VariableObject) {
|
||||
VariableObject obj = (VariableObject)object;
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
if (type != null && type.length() > 0) {
|
||||
// Check if the type is valid.
|
||||
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);
|
||||
}
|
||||
buffer.append('(').append(type).append(')');
|
||||
}
|
||||
buffer.append('(');
|
||||
buffer.append(obj.getName());
|
||||
buffer.append(')');
|
||||
return new VariableObject(obj, buffer.toString());
|
||||
}
|
||||
throw new CDIException("Unknown variable object");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjects(ICDIStackFrame)
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue