1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 17:25:38 +02:00

2004-10-31 Alain Magloire

Refactor ICDIVariableObject --> ICDIVariableDescriptor
	Refactor ICDIArgumentObject --> ICDIArgumentDescriptor
	Refactor ICDIRegisterObject --> ICDIRegisterDescriptor
	Addition ICDIThreadStorageDescriptor, ICDIThreadStorage
	Addition ICDILocalVariableDescriptor, ICDILocalVariable
	Addition ICDIGlobalVariableDescriptor, ICDIGlovalVariable

	Adjust the classes to the changes.
This commit is contained in:
Alain Magloire 2004-10-31 20:57:40 +00:00
parent 2a6c0b8c16
commit 8edc6b4de2
89 changed files with 1347 additions and 1068 deletions

View file

@ -1,3 +1,13 @@
2004-10-31 Alain Magloire
Refactor ICDIVariableObject --> ICDIVariableDescriptor
Refactor ICDIArgumentObject --> ICDIArgumentDescriptor
Refactor ICDIRegisterObject --> ICDIRegisterDescriptor
Addition ICDIThreadStorageDescriptor, ICDIThreadStorage
Addition ICDILocalVariableDescriptor, ICDILocalVariable
Addition ICDIGlobalVariableDescriptor, ICDIGlovalVariable
Adjust the classes to the changes.
2004-10-29 Mikhail Khodjaiants 2004-10-29 Mikhail Khodjaiants
Use the new expression API of CDI. Use the new expression API of CDI.
* CDebugModel.java * CDebugModel.java

View file

@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.debug.core.cdi.model.*;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
/**
* The default behaviour of the register is autoupdate on.
*/
public interface ICDIRegisterManager extends ICDIManager {
/**
* Method getRegisterObjects.
* @return ICDIRegisterObject[]
* @throws CDIException
*/
ICDIRegisterObject[] getRegisterObjects() throws CDIException;
/**
* Method createRegister.
* @param stack
* @param reg
* @return ICDIRegister
* @throws CDIException
*/
ICDIRegister createRegister(ICDIRegisterObject reg) throws CDIException;
/**
* Method removeRegister, remove register from the manager list.
* @param reg
*/
void destroyRegister(ICDIRegister reg);
}

View file

@ -45,20 +45,6 @@ public interface ICDISession {
*/ */
String getAttribute(String key); String getAttribute(String key);
/**
* Returns the variable manager of this debug session.
*
* @return the variable manager
*/
ICDIVariableManager getVariableManager();
/**
* Returns the register manager of this debug session.
*
* @return the register manager
*/
ICDIRegisterManager getRegisterManager();
/** /**
* Returns the event manager of this debug session. * Returns the event manager of this debug session.
* *

View file

@ -1,126 +0,0 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.debug.core.cdi.model.*;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
/**
* Auto update is on by default.
*/
public interface ICDIVariableManager extends ICDIManager {
/**
* Method getVariableObject.
* you can specify a static/global variable in a particular function or file,
* filename or/and function is the context for the static ICDIVariableObject.
* <pre>
* hello.c:
* int bar;
* int main() {
* static int bar;
* }
* file.c:
* int foo() {
* static int bar;
* }
* getVariableObject(null, null, "bar");
* getVariableObject(null, "main", "bar");
* getVariableObject("file.c", "foo", "bar");
* </pre>
* @param filename
* @param function
* @param name
* @return ICDIVariableObject
* @throws CDIException
*/
ICDIVariableObject getGlobalVariableObject(String filename, String function, String name) throws CDIException;
/**
* Consider the variable object as an Array of type and range[start, start + length - 1]
* @param stack
* @param name
* @return ICDIVariableObject
* @throws CDIException
*/
ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject var, int start, int length) 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.
* @param stack
* @return ICDIVariableObject[]
* @throws CDIException
*/
ICDIVariableObject[] getLocalVariableObjects(ICDIStackFrame stack) throws CDIException;
/**
* Method getVariableObjects.
* Returns all the local variable objects of that stackframe.
* @param stack
* @return ICDIVariableObject[]
* @throws CDIException
*/
ICDIVariableObject[] getVariableObjects(ICDIStackFrame stack) throws CDIException;
/**
* Method createVariable.
* Create a Variable for evaluation. A CreatedEvent will be trigger and
* ChangedEvent will also be trigger when the variable is assign a new value.
* DestroyedEvent is fired when the variable is out of scope and automatically
* removed from the manager list.
* @param var
* @return ICDIVariable
* @throws CDIException
*/
ICDIVariable createVariable(ICDIVariableObject var) throws CDIException;
/**
* Method getArgumentObjects.
* Returns all the local arguments of that stackframe.
* @param stack
* @return ICDIArgumentObject[]
* @throws CDIException
*/
ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame stack) throws CDIException;
/**
* Method createArgument.
* Create a Variable for evaluation. CreatedEvent will be trigger and
* ChangedEvent will also be trigger when the variable is assign a new value.
* DestroyedEvent is fired when the variable is out of scope and automatically
* from th manager list.
* @param var
* @return ICDIArgument
* @throws CDIException
*/
ICDIArgument createArgument(ICDIArgumentObject var) throws CDIException;
/**
* Remove the variable from the manager list.
* @param var
* @return ICDIArgument
* @throws CDIException
*/
void destroyVariable(ICDIVariable var) throws CDIException;
}

View file

@ -17,5 +17,5 @@ package org.eclipse.cdt.debug.core.cdi.model;
* *
* @since Jul 22, 2002 * @since Jul 22, 2002
*/ */
public interface ICDIArgument extends ICDIVariable, ICDIArgumentObject { public interface ICDIArgument extends ICDIVariable, ICDIArgumentDescriptor {
} }

View file

@ -13,5 +13,5 @@ package org.eclipse.cdt.debug.core.cdi.model;
/** /**
*/ */
public interface ICDIArgumentObject extends ICDIVariableObject { public interface ICDIArgumentDescriptor extends ICDILocalVariableDescriptor {
} }

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.debug.core.cdi.model; package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
/** /**
* An expression is a snippet of code that can be evaluated to * An expression is a snippet of code that can be evaluated to
@ -47,4 +46,13 @@ public interface ICDIExpression extends ICDIObject {
*/ */
ICDIValue getValue(ICDIStackFrame context) throws CDIException; ICDIValue getValue(ICDIStackFrame context) throws CDIException;
/**
* Remove the expression from the manager list.
*
* @param var
* @return ICDIArgument
* @throws CDIException
*/
void dispose() throws CDIException;
} }

View file

@ -0,0 +1,19 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
/**
* ICDIGlobalVariable
*/
public interface ICDIGlobalVariable extends ICDIVariable {
}

View file

@ -0,0 +1,19 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
/**
* ICDIGlobalVariableDescriptor
*/
public interface ICDIGlobalVariableDescriptor extends ICDIVariableDescriptor {
}

View file

@ -0,0 +1,26 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
/**
* ICDILocalVariable
*/
public interface ICDILocalVariable extends ICDIVariable {
/**
*
* @return ICDIStackFrame
*/
ICDIStackFrame getStackFrame() throws CDIException;
}

View file

@ -0,0 +1,28 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
/**
* ICDILocalVariableDescriptor
*/
public interface ICDILocalVariableDescriptor extends ICDIVariableDescriptor {
/**
* Return the stackframe.
*
* @return ICDIStackFrame
* @throws CDIException
*/
ICDIStackFrame getStackFrame() throws CDIException;
}

View file

@ -18,5 +18,5 @@ package org.eclipse.cdt.debug.core.cdi.model;
* *
* @since Jul 9, 2002 * @since Jul 9, 2002
*/ */
public interface ICDIRegister extends ICDIVariable, ICDIRegisterObject { public interface ICDIRegister extends ICDIVariable, ICDIRegisterDescriptor {
} }

View file

@ -17,5 +17,5 @@ package org.eclipse.cdt.debug.core.cdi.model;
* *
* @since Jul 9, 2002 * @since Jul 9, 2002
*/ */
public interface ICDIRegisterObject extends ICDIVariableObject { public interface ICDIRegisterDescriptor extends ICDIVariableDescriptor {
} }

View file

@ -20,11 +20,19 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
* @since Jul 9, 2002 * @since Jul 9, 2002
*/ */
public interface ICDIRegisterGroup extends ICDIObject { public interface ICDIRegisterGroup extends ICDIObject {
/** /**
* Returns the registers in this register group. * The name of the group.
* *
* @return the registers in this register group * @return String name
*/
String getName();
/**
* Returns the register descriptors in this register group.
*
* @return ICDIRegisterDescriptor[] in this register group
* @throws CDIException if this method fails. Reasons include: * @throws CDIException if this method fails. Reasons include:
*/ */
ICDIRegister[] getRegisters() throws CDIException; ICDIRegisterDescriptor[] getRegisterDescriptors() throws CDIException;
} }

View file

@ -23,6 +23,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDILocation;
* @since Jul 8, 2002 * @since Jul 8, 2002
*/ */
public interface ICDIStackFrame extends ICDIExecuteStepReturn, ICDIObject { public interface ICDIStackFrame extends ICDIExecuteStepReturn, ICDIObject {
/** /**
* Returns the location of the instruction pointer in this * Returns the location of the instruction pointer in this
* stack frame. * stack frame.
@ -38,7 +39,7 @@ public interface ICDIStackFrame extends ICDIExecuteStepReturn, ICDIObject {
* @return a collection of visible variables * @return a collection of visible variables
* @throws CDIException if this method fails. Reasons include: * @throws CDIException if this method fails. Reasons include:
*/ */
ICDIVariable[] getLocalVariables() throws CDIException; ICDILocalVariableDescriptor[] getLocalVariableDescriptors() throws CDIException;
/** /**
* Returns the arguments in this stack frame. An empty collection * Returns the arguments in this stack frame. An empty collection
@ -47,7 +48,7 @@ public interface ICDIStackFrame extends ICDIExecuteStepReturn, ICDIObject {
* @return a collection of arguments * @return a collection of arguments
* @throws CDIException if this method fails. Reasons include: * @throws CDIException if this method fails. Reasons include:
*/ */
ICDIArgument[] getArguments() throws CDIException; ICDIArgumentDescriptor[] getArgumentDescriptors() throws CDIException;
/** /**
* Returns the thread this stackframe is contained in. * Returns the thread this stackframe is contained in.

View file

@ -1,21 +0,0 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
/**
*
* Represents a static data structure in the program.
*
* @since Jul 9, 2002
*/
public interface ICDIStaticVariable extends ICDIVariable {
}

View file

@ -47,6 +47,38 @@ public interface ICDITarget extends ICDIThreadGroup, ICDIExpressionManagement,
String evaluateExpressionToString(ICDIStackFrame context, String expressionText) String evaluateExpressionToString(ICDIStackFrame context, String expressionText)
throws CDIException; throws CDIException;
/**
* A static/global variable in a particular function or file,
* filename or/and function is the context for the static ICDIVariableDescriptor.
* <pre>
* hello.c:
* int bar;
* int main() {
* static int bar;
* }
* file.c:
* int foo() {
* static int bar;
* }
* getVariableObject(null, null, "bar");
* getVariableObject(null, "main", "bar");
* getVariableObject("file.c", "foo", "bar");
* </pre>
* @param filename
* @param function
* @param name
* @return ICDIVariableDescriptor
* @throws CDIException
*/
ICDIVariableDescriptor getGlobalVariableDescriptors(String filename, String function, String name) throws CDIException;
/**
* Return the register groups.
*
* @return ICDIRegisterGroup[]
*/
ICDIRegisterGroup[] getRegisterGroups() throws CDIException;
/** /**
* Returns whether this target is terminated. * Returns whether this target is terminated.
* *

View file

@ -48,37 +48,20 @@ public interface ICDIThread extends ICDIExecuteStep, ICDIExecuteResume, ICDISusp
ICDIStackFrame[] getStackFrames(int lowFrame, int highFrame) throws CDIException; ICDIStackFrame[] getStackFrames(int lowFrame, int highFrame) throws CDIException;
/** /**
* Returns the depth of the stack frames * Returns the depth of the stack frames.
*
* @return depth of stack frames * @return depth of stack frames
* @throws CDIException if this method fails. Reasons include: * @throws CDIException if this method fails. Reasons include:
*/ */
int getStackFrameCount() throws CDIException; int getStackFrameCount() throws CDIException;
/** /**
* Set the current Stack for the thread. * Return thread local storage variables descriptor.
* *
* @deprecated * @return
* @param - ICDIStackFrame * @throws CDIException
*/ */
void setCurrentStackFrame(ICDIStackFrame current) throws CDIException; ICDIThreadStorageDescriptor[] getThreadStorageDescriptors() throws CDIException;
/**
* Set the current frame whithout generation any events, for example
* registers changed events.
*
* @deprecated
* @param frame
* @param b
*/
void setCurrentStackFrame(ICDIStackFrame frame, boolean doUpdate) throws CDIException;
/**
* Set the current stackframe.
*
* @deprecated
* @return ICDIStackFrame
*/
ICDIStackFrame getCurrentStackFrame() throws CDIException;
/** /**
* Equivalent to resume(false) * Equivalent to resume(false)

View file

@ -0,0 +1,25 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
/**
* ICDIThreadStorage
*/
public interface ICDIThreadStorage extends ICDIVariable {
/**
* @return ICDIThread
*/
ICDIThread getThread() throws CDIException;
}

View file

@ -0,0 +1,29 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
/**
* ICDIThreadStorageDescriptor
*/
public interface ICDIThreadStorageDescriptor extends
ICDIVariableDescriptor {
/**
* Return the thread.
*
* @return ICDIThread
* @throws CDIException
*/
ICDIThread getThread() throws CDIException;
}

View file

@ -20,8 +20,15 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
* *
* @since Jul 9, 2002 * @since Jul 9, 2002
*/ */
public interface ICDIVariable extends ICDIVariableObject { public interface ICDIVariable extends ICDIVariableDescriptor {
/**
* Returns true if the value of this variable could be changed.
*
* @return true if the value of this variable could be changed
* @throws CDIException if this method fails. Reasons include:
*/
boolean isEditable() throws CDIException;
/** /**
* Returns the value of this variable. * Returns the value of this variable.
@ -56,4 +63,13 @@ public interface ICDIVariable extends ICDIVariableObject {
*/ */
void setFormat(int format) throws CDIException; void setFormat(int format) throws CDIException;
/**
* Remove the variable from the manager list.
*
* @param var
* @return ICDIArgument
* @throws CDIException
*/
void dispose() throws CDIException;
} }

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
/** /**
* *
*/ */
public interface ICDIVariableObject extends ICDIObject { public interface ICDIVariableDescriptor extends ICDIObject {
/** /**
* Returns the name of this variable. * Returns the name of this variable.
@ -28,16 +28,7 @@ public interface ICDIVariableObject extends ICDIObject {
String getName(); String getName();
/** /**
* Returns the stackframe where the variable was found * Returns the type of this variable descriptor.
* may return null.
*
* @return the stackframe
* @throws CDIException if this method fails. Reasons include:
*/
ICDIStackFrame getStackFrame() throws CDIException;
/**
* Returns the type of data this variable is declared.
* *
* @return the type of data this variable is declared * @return the type of data this variable is declared
* @throws CDIException if this method fails. Reasons include: * @throws CDIException if this method fails. Reasons include:
@ -45,7 +36,7 @@ public interface ICDIVariableObject extends ICDIObject {
ICDIType getType() throws CDIException; ICDIType getType() throws CDIException;
/** /**
* Returns the type of data this variable is declared. * Returns the type name of this variable descriptor.
* *
* @return the type of data this variable is declared * @return the type of data this variable is declared
* @throws CDIException if this method fails. Reasons include: * @throws CDIException if this method fails. Reasons include:
@ -53,21 +44,13 @@ public interface ICDIVariableObject extends ICDIObject {
String getTypeName() throws CDIException; String getTypeName() throws CDIException;
/** /**
* Returns the size of this variable. * Returns the size of this variable descriptor.
* *
* @return the size of this variable * @return the size of this variable
* @throws CDIException if this method fails. Reasons include: * @throws CDIException if this method fails. Reasons include:
*/ */
int sizeof() throws CDIException; int sizeof() throws CDIException;
/**
* Returns true if the value of this variable could be changed.
*
* @return true if the value of this variable could be changed
* @throws CDIException if this method fails. Reasons include:
*/
boolean isEditable() throws CDIException;
/** /**
* Returns the qualified name of this variable. * Returns the qualified name of this variable.
* *
@ -76,12 +59,42 @@ public interface ICDIVariableObject extends ICDIObject {
*/ */
String getQualifiedName() throws CDIException; String getQualifiedName() throws CDIException;
/**
* Consider the variable object as an Array of type and range[start, start + length - 1]
* @param stack
* @param name
* @return ICDIVariableDescriptor
* @throws CDIException
*/
ICDIVariableDescriptor getVariableDescriptorAsArray(int start, int length) throws CDIException;
/**
* Consider the variable descritor as type.
*
* @param stack
* @param name
* @return ICDIVariableDescriptor
* @throws CDIException
*/
ICDIVariableDescriptor getVariableDescriptorAsType(String type) throws CDIException;
/**
* Create a Variable for evaluation. A CreatedEvent will be trigger and
* ChangedEvent will also be trigger when the variable is assign a new value.
* DestroyedEvent is fired when the variable is out of scope and automatically
* removed from the manager list.
* @param var
* @return ICDIVariable
* @throws CDIException
*/
ICDIVariable createVariable() throws CDIException;
/** /**
* Returns true if the variable Object are the same, * Returns true if the variable Object are the same,
* For example event if the name is the same because of * For example event if the name is the same because of
* casting this may return false; * casting this may return false;
* @return true if the same * @return true if the same
*/ */
boolean equals(ICDIVariableObject varObject); boolean equals(ICDIVariableDescriptor varDesc);
} }

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.ICRegisterManager; import org.eclipse.cdt.debug.core.ICRegisterManager;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIManager; import org.eclipse.cdt.debug.core.cdi.ICDIManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CRegisterGroup; import org.eclipse.cdt.debug.internal.core.model.CRegisterGroup;
import org.eclipse.cdt.debug.internal.core.model.CStackFrame; import org.eclipse.cdt.debug.internal.core.model.CStackFrame;
@ -103,22 +103,19 @@ public class CRegisterManager extends CUpdateManager implements ICRegisterManage
} }
private void createMainRegisterGroup() { private void createMainRegisterGroup() {
ICDIRegisterObject[] regObjects = null; ICDIRegisterGroup[] groups = null;
try { try {
regObjects = getDebugTarget().getCDISession().getRegisterManager().getRegisterObjects(); groups = getDebugTarget().getCDITarget().getRegisterGroups();
} }
catch( CDIException e ) { catch( CDIException e ) {
CDebugCorePlugin.log( e ); CDebugCorePlugin.log( e );
} }
if ( regObjects != null ) { for (int i = 0; i < groups.length; ++i) {
fRegisterGroups.add( new CRegisterGroup( getDebugTarget(), "Main", regObjects ) ); //$NON-NLS-1$ fRegisterGroups.add( new CRegisterGroup( getDebugTarget(), groups[i] ) ); //$NON-NLS-1$
} }
} }
protected ICDIManager getCDIManager() { protected ICDIManager getCDIManager() {
if ( getDebugTarget() != null ) {
return getDebugTarget().getCDISession().getRegisterManager();
}
return null; return null;
} }

View file

@ -15,7 +15,7 @@ import java.util.List;
import org.eclipse.cdt.debug.core.cdi.CDIException; 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.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; 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.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue;
import org.eclipse.cdt.debug.core.model.CVariableFormat; import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.cdt.debug.core.model.ICType; import org.eclipse.cdt.debug.core.model.ICType;
@ -34,7 +34,7 @@ public class CArrayPartition extends AbstractCVariable {
private int fEnd; private int fEnd;
private ICDIVariableObject fCDIVariableObject; private ICDIVariableDescriptor fCDIVariableObject;
private ICDIVariable fCDIVariable; private ICDIVariable fCDIVariable;
@ -63,7 +63,7 @@ public class CArrayPartition extends AbstractCVariable {
public ICType getType() throws DebugException { public ICType getType() throws DebugException {
if ( fType == null ) { if ( fType == null ) {
try { try {
ICDIVariableObject varObject = getVariableObject(); ICDIVariableDescriptor varObject = getVariableObject();
if ( varObject != null ) if ( varObject != null )
fType = new CType( varObject.getType() ); fType = new CType( varObject.getType() );
} }
@ -238,9 +238,10 @@ public class CArrayPartition extends AbstractCVariable {
return false; return false;
} }
private ICDIVariableObject getVariableObject() throws CDIException { private ICDIVariableDescriptor getVariableObject() throws CDIException {
if ( fCDIVariableObject == null ) { if ( fCDIVariableObject == null ) {
fCDIVariableObject = getCDISession().getVariableManager().getVariableObjectAsArray( getCDIVariable(), getStart(), getEnd() - getStart() + 1 ); fCDIVariableObject = getCDIVariable().getVariableDescriptorAsArray(getStart(), getEnd() - getStart() + 1 );
//fCDIVariableObject = getCDISession().getVariableManager().getVariableObjectAsArray( getCDIVariable(), getStart(), getEnd() - getStart() + 1 );
} }
return fCDIVariableObject; return fCDIVariableObject;
} }

View file

@ -59,7 +59,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.CDebugElementState; import org.eclipse.cdt.debug.core.model.CDebugElementState;
import org.eclipse.cdt.debug.core.model.IBreakpointTarget; import org.eclipse.cdt.debug.core.model.IBreakpointTarget;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
@ -1872,9 +1872,9 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
} }
public ICGlobalVariable createGlobalVariable( IGlobalVariableDescriptor info ) throws DebugException { public ICGlobalVariable createGlobalVariable( IGlobalVariableDescriptor info ) throws DebugException {
ICDIVariableObject vo = null; ICDIVariableDescriptor vo = null;
try { try {
vo = getCDISession().getVariableManager().getGlobalVariableObject( info.getPath().lastSegment(), null, info.getName() ); vo = getCDITarget().getGlobalVariableDescriptors(info.getPath().lastSegment(), null, info.getName());
} }
catch( CDIException e ) { catch( CDIException e ) {
throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$ throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$

View file

@ -19,7 +19,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.CVariableFormat; import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -40,7 +40,7 @@ public class CExpression extends CVariable implements IExpression {
/** /**
* Constructor for CExpression. * Constructor for CExpression.
*/ */
public CExpression( CStackFrame frame, ICDIExpression cdiExpression, ICDIVariableObject varObject ) { public CExpression( CStackFrame frame, ICDIExpression cdiExpression, ICDIVariableDescriptor varObject ) {
super( frame, varObject ); super( frame, varObject );
setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ))) ; setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ))) ;
fCDIExpression = cdiExpression; fCDIExpression = cdiExpression;
@ -146,7 +146,7 @@ public class CExpression extends CVariable implements IExpression {
public void dispose() { public void dispose() {
if ( fCDIExpression != null ) { if ( fCDIExpression != null ) {
try { try {
getCDITarget().destroyExpressions( new ICDIExpression[] { fCDIExpression } ); fCDIExpression.dispose();
fCDIExpression = null; fCDIExpression = null;
} }
catch( CDIException e ) { catch( CDIException e ) {

View file

@ -385,8 +385,7 @@ public class CFormattedMemoryBlock extends CDebugElement
{ {
try try
{ {
ICDIExpression[] expressions = { fAddressExpression }; fAddressExpression.dispose();
((CDebugTarget)getDebugTarget()).getCDITarget().destroyExpressions( expressions );
} }
catch( CDIException e ) catch( CDIException e )
{ {

View file

@ -14,7 +14,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.ICGlobalVariable; import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
@ -28,7 +28,7 @@ public class CGlobalVariable extends CVariable implements ICGlobalVariable {
/** /**
* Constructor for CGlobalVariable. * Constructor for CGlobalVariable.
*/ */
protected CGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableObject cdiVariableObject ) { protected CGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableDescriptor cdiVariableObject ) {
super( parent, cdiVariableObject ); super( parent, cdiVariableObject );
fDescriptor = descriptor; fDescriptor = descriptor;
} }
@ -36,7 +36,7 @@ public class CGlobalVariable extends CVariable implements ICGlobalVariable {
/** /**
* Constructor for CGlobalVariable. * Constructor for CGlobalVariable.
*/ */
protected CGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableObject cdiVariableObject, String message ) { protected CGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableDescriptor cdiVariableObject, String message ) {
super( parent, cdiVariableObject, message ); super( parent, cdiVariableObject, message );
fDescriptor = descriptor; fDescriptor = descriptor;
} }

View file

@ -13,8 +13,7 @@ package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
import org.eclipse.cdt.debug.core.model.CVariableFormat; import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -29,15 +28,15 @@ public class CRegister extends CGlobalVariable implements IRegister {
/** /**
* Constructor for CRegister. * Constructor for CRegister.
*/ */
protected CRegister( CRegisterGroup parent, ICDIRegister cdiRegister ) { protected CRegister( CRegisterGroup parent, ICDIRegisterDescriptor cdiRegisterDescriptor ) {
super( parent, null, cdiRegister ); super( parent, null, cdiRegisterDescriptor );
setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) ); setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
} }
/** /**
* Constructor for CRegister. * Constructor for CRegister.
*/ */
protected CRegister( CRegisterGroup parent, ICDIRegisterObject registerObject, String message ) { protected CRegister( CRegisterGroup parent, ICDIRegisterDescriptor registerObject, String message ) {
super( parent, null, registerObject, message ); super( parent, null, registerObject, message );
setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) ); setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup;
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget; import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -24,9 +24,7 @@ import org.eclipse.debug.core.model.IRegisterGroup;
*/ */
public class CRegisterGroup extends CDebugElement implements IRegisterGroup, IEnableDisableTarget { public class CRegisterGroup extends CDebugElement implements IRegisterGroup, IEnableDisableTarget {
private String fName; private ICDIRegisterGroup fCDIRegisterGroup;
private ICDIRegisterObject[] fRegisterObjects;
private IRegister[] fRegisters; private IRegister[] fRegisters;
@ -35,35 +33,34 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup, IEn
/** /**
* Constructor for CRegisterGroup. * Constructor for CRegisterGroup.
*/ */
public CRegisterGroup( CDebugTarget target, String name, ICDIRegisterObject[] regObjects ) { public CRegisterGroup( CDebugTarget target, ICDIRegisterGroup regGroup ) {
super( target ); super( target );
fName = name; fCDIRegisterGroup = regGroup;
fRegisterObjects = regObjects;
fRegisters = new IRegister[regObjects.length];
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.IRegisterGroup#getName() * @see org.eclipse.debug.core.model.IRegisterGroup#getName()
*/ */
public String getName() throws DebugException { public String getName() throws DebugException {
return fName; return fCDIRegisterGroup.getName();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.IRegisterGroup#getRegisters() * @see org.eclipse.debug.core.model.IRegisterGroup#getRegisters()
*/ */
public IRegister[] getRegisters() throws DebugException { public IRegister[] getRegisters() throws DebugException {
for ( int i = 0; i < fRegisters.length; ++i ) { if (fRegisters == null) {
if ( fRegisters[i] == null ) { try {
try { ICDIRegisterDescriptor[] regDescs = fCDIRegisterGroup.getRegisterDescriptors();
fRegisters[i] = new CRegister( this, getCDIRegister( fRegisterObjects[i] ) ); fRegisters = new IRegister[regDescs.length];
} for ( int i = 0; i < fRegisters.length; ++i ) {
catch( DebugException e ) { fRegisters[i] = new CRegister( this, regDescs[i] );
fRegisters[i] = new CRegister( this, fRegisterObjects[i], e.getMessage() ); if ( ((CRegister)fRegisters[i]).isEnabled() ) {
} ((CRegister)fRegisters[i]).setEnabled( isEnabled() );
if ( ((CRegister)fRegisters[i]).isEnabled() ) { }
((CRegister)fRegisters[i]).setEnabled( isEnabled() );
} }
} catch (CDIException e) {
requestFailed( e.getMessage(), null );
} }
} }
return fRegisters; return fRegisters;
@ -73,10 +70,13 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup, IEn
* @see org.eclipse.debug.core.model.IRegisterGroup#hasRegisters() * @see org.eclipse.debug.core.model.IRegisterGroup#hasRegisters()
*/ */
public boolean hasRegisters() throws DebugException { public boolean hasRegisters() throws DebugException {
return fRegisterObjects.length > 0; return getRegisters().length > 0;
} }
public void dispose() { public void dispose() {
if (fRegisters == null) {
return;
}
for ( int i = 0; i < fRegisters.length; ++i ) { for ( int i = 0; i < fRegisters.length; ++i ) {
if ( fRegisters[i] != null ) { if ( fRegisters[i] != null ) {
((CRegister)fRegisters[i]).dispose(); ((CRegister)fRegisters[i]).dispose();
@ -85,18 +85,10 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup, IEn
} }
} }
private ICDIRegister getCDIRegister( ICDIRegisterObject ro ) throws DebugException {
ICDIRegister register = null;
try {
register = ((CDebugTarget)getDebugTarget()).getCDISession().getRegisterManager().createRegister( ro );
}
catch( CDIException e ) {
requestFailed( e.getMessage(), null );
}
return register;
}
public void targetSuspended() { public void targetSuspended() {
if (fRegisters == null) {
return;
}
for ( int i = 0; i < fRegisters.length; ++i ) { for ( int i = 0; i < fRegisters.length; ++i ) {
if ( fRegisters[i] != null && ((CRegister)fRegisters[i]).hasErrors() ) { if ( fRegisters[i] != null && ((CRegister)fRegisters[i]).hasErrors() ) {
((CRegister)fRegisters[i]).dispose(); ((CRegister)fRegisters[i]).dispose();

View file

@ -25,7 +25,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.ICGlobalVariable; import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.IRestart; import org.eclipse.cdt.debug.core.model.IRestart;
@ -116,7 +116,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
fVariables = new ArrayList( vars.size() ); fVariables = new ArrayList( vars.size() );
Iterator it = vars.iterator(); Iterator it = vars.iterator();
while( it.hasNext() ) { while( it.hasNext() ) {
fVariables.add( CVariableFactory.createVariable( this, (ICDIVariableObject)it.next() ) ); fVariables.add( CVariableFactory.createVariable( this, (ICDIVariableDescriptor)it.next() ) );
} }
} }
else if ( refreshVariables() ) { else if ( refreshVariables() ) {
@ -134,7 +134,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
List locals = getAllCDIVariableObjects(); List locals = getAllCDIVariableObjects();
int index = 0; int index = 0;
while( index < fVariables.size() ) { while( index < fVariables.size() ) {
ICDIVariableObject varObject = findVariable( locals, (CVariable)fVariables.get( index ) ); ICDIVariableDescriptor varObject = findVariable( locals, (CVariable)fVariables.get( index ) );
if ( varObject != null ) { if ( varObject != null ) {
locals.remove( varObject ); locals.remove( varObject );
index++; index++;
@ -147,7 +147,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
// add any new locals // add any new locals
Iterator newOnes = locals.iterator(); Iterator newOnes = locals.iterator();
while( newOnes.hasNext() ) { while( newOnes.hasNext() ) {
fVariables.add( CVariableFactory.createVariable( this, (ICDIVariableObject)newOnes.next() ) ); fVariables.add( CVariableFactory.createVariable( this, (ICDIVariableDescriptor)newOnes.next() ) );
} }
} }
@ -489,7 +489,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
protected List getCDILocalVariableObjects() throws DebugException { protected List getCDILocalVariableObjects() throws DebugException {
List list = new ArrayList(); List list = new ArrayList();
try { try {
list.addAll( Arrays.asList( getCDISession().getVariableManager().getLocalVariableObjects( getCDIStackFrame() ) ) ); list.addAll( Arrays.asList( getCDIStackFrame().getLocalVariableDescriptors( ) ) );
} }
catch( CDIException e ) { catch( CDIException e ) {
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
@ -504,7 +504,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
protected List getCDIArgumentObjects() throws DebugException { protected List getCDIArgumentObjects() throws DebugException {
List list = new ArrayList(); List list = new ArrayList();
try { try {
list.addAll( Arrays.asList( getCDISession().getVariableManager().getArgumentObjects( getCDIStackFrame() ) ) ); list.addAll( Arrays.asList( getCDIStackFrame().getArgumentDescriptors() ) );
} }
catch( CDIException e ) { catch( CDIException e ) {
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
@ -607,10 +607,10 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
} }
} }
protected ICDIVariableObject findVariable( List list, CVariable var ) { protected ICDIVariableDescriptor findVariable( List list, CVariable var ) {
Iterator it = list.iterator(); Iterator it = list.iterator();
while( it.hasNext() ) { while( it.hasNext() ) {
ICDIVariableObject newVarObject = (ICDIVariableObject)it.next(); ICDIVariableDescriptor newVarObject = (ICDIVariableDescriptor)it.next();
if ( var.sameVariable( newVarObject ) ) if ( var.sameVariable( newVarObject ) )
return newVarObject; return newVarObject;
} }

View file

@ -33,6 +33,7 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortValue;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharValue; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharValue;
import org.eclipse.cdt.debug.core.model.CVariableFormat; import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType; import org.eclipse.cdt.debug.core.model.ICType;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.core.model.IVariable;
@ -85,7 +86,9 @@ public class CValue extends AbstractCValue {
public String getValueString() throws DebugException { public String getValueString() throws DebugException {
if ( fValueString == null && getUnderlyingValue() != null ) { if ( fValueString == null && getUnderlyingValue() != null ) {
resetStatus(); resetStatus();
if ( getParentVariable().getStackFrame().isSuspended() ) { ICStackFrame cframe = getParentVariable().getStackFrame();
boolean isSuspended = (cframe == null) ? getCDITarget().isSuspended() : cframe.isSuspended();
if ( isSuspended ) {
try { try {
fValueString = processUnderlyingValue( getUnderlyingValue() ); fValueString = processUnderlyingValue( getUnderlyingValue() );
} }

View file

@ -19,12 +19,12 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; 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.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.CVariableFormat; import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICType; import org.eclipse.cdt.debug.core.model.ICType;
@ -52,7 +52,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
/** /**
* The CDI variable object this variable is based on. * The CDI variable object this variable is based on.
*/ */
private ICDIVariableObject fCDIVariableObject; private ICDIVariableDescriptor fCDIVariableObject;
/** /**
* The underlying CDI variable. * The underlying CDI variable.
@ -82,7 +82,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
/** /**
* Constructor for InternalVariable. * Constructor for InternalVariable.
*/ */
InternalVariable( CVariable var, ICDIVariableObject varObject ) { InternalVariable( CVariable var, ICDIVariableDescriptor varObject ) {
setVariable( var ); setVariable( var );
setCDIVariableObject( varObject ); setCDIVariableObject( varObject );
setCDIVariable( (varObject instanceof ICDIVariable) ? (ICDIVariable)varObject : null ); setCDIVariable( (varObject instanceof ICDIVariable) ? (ICDIVariable)varObject : null );
@ -91,7 +91,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
InternalVariable createShadow( int start, int length ) throws DebugException { InternalVariable createShadow( int start, int length ) throws DebugException {
InternalVariable iv = null; InternalVariable iv = null;
try { try {
iv = new InternalVariable( getVariable(), getCDISession().getVariableManager().getVariableObjectAsArray( getCDIVariableObject(), start, length ) ); iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsArray( start, length ) );
} }
catch( CDIException e ) { catch( CDIException e ) {
requestFailed( e.getMessage(), null ); requestFailed( e.getMessage(), null );
@ -102,7 +102,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
InternalVariable createShadow( String type ) throws DebugException { InternalVariable createShadow( String type ) throws DebugException {
InternalVariable iv = null; InternalVariable iv = null;
try { try {
iv = new InternalVariable( getVariable(), getCDISession().getVariableManager().getVariableObjectAsType( getCDIVariableObject(), type ) ); iv = new InternalVariable( getVariable(), getCDIVariableObject().getVariableDescriptorAsType( type ) );
} }
catch( CDIException e ) { catch( CDIException e ) {
requestFailed( e.getMessage(), null ); requestFailed( e.getMessage(), null );
@ -113,10 +113,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
private synchronized ICDIVariable getCDIVariable() throws DebugException { private synchronized ICDIVariable getCDIVariable() throws DebugException {
if ( fCDIVariable == null ) { if ( fCDIVariable == null ) {
try { try {
if ( getCDIVariableObject() instanceof ICDIArgumentObject ) fCDIVariable = getCDIVariableObject().createVariable( );
fCDIVariable = getCDISession().getVariableManager().createArgument( (ICDIArgumentObject)getCDIVariableObject() );
else
fCDIVariable = getCDISession().getVariableManager().createVariable( getCDIVariableObject() );
} }
catch( CDIException e ) { catch( CDIException e ) {
requestFailed( e.getMessage(), null ); requestFailed( e.getMessage(), null );
@ -129,11 +126,11 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
fCDIVariable = variable; fCDIVariable = variable;
} }
private ICDIVariableObject getCDIVariableObject() { private ICDIVariableDescriptor getCDIVariableObject() {
return fCDIVariableObject; return fCDIVariableObject;
} }
private void setCDIVariableObject( ICDIVariableObject variableObject ) { private void setCDIVariableObject( ICDIVariableDescriptor variableObject ) {
fCDIVariableObject = variableObject; fCDIVariableObject = variableObject;
} }
@ -151,7 +148,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
CType getType() throws DebugException { CType getType() throws DebugException {
if ( fType == null ) { if ( fType == null ) {
ICDIVariableObject varObject = getCDIVariableObject(); ICDIVariableDescriptor varObject = getCDIVariableObject();
if ( varObject != null ) { if ( varObject != null ) {
synchronized( this ) { synchronized( this ) {
if ( fType == null ) { if ( fType == null ) {
@ -171,7 +168,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
synchronized void invalidate() { synchronized void invalidate() {
try { try {
if ( fCDIVariable != null ) if ( fCDIVariable != null )
getCDISession().getVariableManager().destroyVariable( fCDIVariable ); fCDIVariable.dispose();
} }
catch( CDIException e ) { catch( CDIException e ) {
logError( e.getMessage() ); logError( e.getMessage() );
@ -203,7 +200,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
} }
boolean isArgument() { boolean isArgument() {
return ( getCDIVariableObject() instanceof ICDIArgumentObject ); return ( getCDIVariableObject() instanceof ICDIArgumentDescriptor );
} }
void setValue( String expression ) throws DebugException { void setValue( String expression ) throws DebugException {
@ -308,7 +305,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
return false; return false;
} }
boolean sameVariable( ICDIVariableObject vo ) { boolean sameVariable( ICDIVariableDescriptor vo ) {
return getCDIVariableObject().equals( vo ); return getCDIVariableObject().equals( vo );
} }
} }
@ -341,7 +338,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
/** /**
* Constructor for CVariable. * Constructor for CVariable.
*/ */
protected CVariable( CDebugElement parent, ICDIVariableObject cdiVariableObject ) { protected CVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject ) {
super( parent ); super( parent );
if ( cdiVariableObject != null ) { if ( cdiVariableObject != null ) {
fName = cdiVariableObject.getName(); fName = cdiVariableObject.getName();
@ -354,7 +351,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
/** /**
* Constructor for CVariable. * Constructor for CVariable.
*/ */
protected CVariable( CDebugElement parent, ICDIVariableObject cdiVariableObject, String errorMessage ) { protected CVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject, String errorMessage ) {
super( parent ); super( parent );
if ( cdiVariableObject != null ) { if ( cdiVariableObject != null ) {
fName = cdiVariableObject.getName(); fName = cdiVariableObject.getName();
@ -724,7 +721,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
return result; return result;
} }
private void createOriginal( ICDIVariableObject vo ) { private void createOriginal( ICDIVariableDescriptor vo ) {
if ( vo != null ) if ( vo != null )
fName = vo.getName(); fName = vo.getName();
setOriginal( new InternalVariable( this, vo ) ); setOriginal( new InternalVariable( this, vo ) );
@ -784,7 +781,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
return false; return false;
} }
protected boolean sameVariable( ICDIVariableObject vo ) { protected boolean sameVariable( ICDIVariableDescriptor vo ) {
InternalVariable iv = getOriginal(); InternalVariable iv = getOriginal();
return ( iv != null && iv.sameVariable( vo ) ); return ( iv != null && iv.sameVariable( vo ) );
} }

View file

@ -16,7 +16,7 @@ import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.IBinaryParser.ISymbol; import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.core.model.IBinaryModule; import org.eclipse.cdt.core.model.IBinaryModule;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor; import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
@ -26,11 +26,11 @@ import org.eclipse.core.runtime.Path;
*/ */
public class CVariableFactory { public class CVariableFactory {
public static CVariable createVariable( CDebugElement parent, ICDIVariableObject cdiVariableObject ) { public static CVariable createVariable( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject ) {
return new CVariable( parent, cdiVariableObject ); return new CVariable( parent, cdiVariableObject );
} }
public static CVariable createVariableWithError( CDebugElement parent, ICDIVariableObject cdiVariableObject, String message ) { public static CVariable createVariableWithError( CDebugElement parent, ICDIVariableDescriptor cdiVariableObject, String message ) {
return new CVariable( parent, cdiVariableObject, message ); return new CVariable( parent, cdiVariableObject, message );
} }
@ -69,7 +69,7 @@ public class CVariableFactory {
} }
public static CGlobalVariable createGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableObject cdiVariableObject ) { public static CGlobalVariable createGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableDescriptor cdiVariableObject ) {
return new CGlobalVariable( parent, descriptor, cdiVariableObject ); return new CGlobalVariable( parent, descriptor, cdiVariableObject );
} }
} }

View file

@ -1,3 +1,13 @@
2004-10-31 Alain Magloire
Refactor ICDIVariableObject --> ICDIVariableDescriptor
Refactor ICDIArgumentObject --> ICDIArgumentDescriptor
Refactor ICDIRegisterObject --> ICDIRegisterDescriptor
Addition ICDIThreadStorageDescriptor, ICDIThreadStorage
Addition ICDILocalVariableDescriptor, ICDILocalVariable
Addition ICDIGlobalVariableDescriptor, ICDIGlovalVariable
Adjust the classes to the changes.
2004-10-29 Alain Magloire 2004-10-29 Alain Magloire
Remove of ICDISharedLibraryManager Remove of ICDISharedLibraryManager
* cdi/org/eclipse/cdt/debug/core/cdi/Session.java * cdi/org/eclipse/cdt/debug/core/cdi/Session.java

View file

@ -23,7 +23,6 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.event.ChangedEvent; import org.eclipse.cdt.debug.mi.core.cdi.event.ChangedEvent;
@ -149,7 +148,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
// Something change we do not know what // Something change we do not know what
// Let the signal manager handle it with an update(). // Let the signal manager handle it with an update().
try { try {
SignalManager sMgr = (SignalManager)session.getSignalManager(); SignalManager sMgr = session.getSignalManager();
sMgr.update(currentTarget); sMgr.update(currentTarget);
} catch (CDIException e) { } catch (CDIException e) {
} }
@ -265,12 +264,6 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
Session session = (Session)getSession(); Session session = (Session)getSession();
MISession miSession = stopped.getMISession(); MISession miSession = stopped.getMISession();
Target currentTarget = session.getTarget(miSession); Target currentTarget = session.getTarget(miSession);
try {
session.setCurrentTarget(currentTarget);
} catch (CDIException e) {
//TODO: Should not ignore this.
}
if (processSharedLibEvent(stopped)) { if (processSharedLibEvent(stopped)) {
// Event was consumed by the shared lib processing bailout // Event was consumed by the shared lib processing bailout
return false; return false;
@ -284,7 +277,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
int threadId = threadId = stopped.getThreadId(); int threadId = threadId = stopped.getThreadId();
currentTarget.updateState(threadId); currentTarget.updateState(threadId);
try { try {
ICDIThread cthread = currentTarget.getCurrentThread(); Thread cthread = (Thread)currentTarget.getCurrentThread();
if (cthread != null) { if (cthread != null) {
cthread.getCurrentStackFrame(); cthread.getCurrentStackFrame();
} else { } else {
@ -297,14 +290,14 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
// Update the managers. // Update the managers.
// For the Variable/Expression Managers call only the updateManager. // For the Variable/Expression Managers call only the updateManager.
VariableManager varMgr = (VariableManager)session.getVariableManager(); VariableManager varMgr = session.getVariableManager();
ExpressionManager expMgr = session.getExpressionManager(); ExpressionManager expMgr = session.getExpressionManager();
RegisterManager regMgr = (RegisterManager)session.getRegisterManager(); RegisterManager regMgr = session.getRegisterManager();
MemoryManager memMgr = session.getMemoryManager(); MemoryManager memMgr = session.getMemoryManager();
BreakpointManager bpMgr = session.getBreakpointManager(); BreakpointManager bpMgr = session.getBreakpointManager();
SignalManager sigMgr = (SignalManager)session.getSignalManager(); SignalManager sigMgr = session.getSignalManager();
SourceManager srcMgr = (SourceManager)session.getSourceManager(); SourceManager srcMgr = session.getSourceManager();
SharedLibraryManager libMgr = (SharedLibraryManager)session.getSharedLibraryManager(); SharedLibraryManager libMgr = session.getSharedLibraryManager();
try { try {
if (varMgr.isAutoUpdate()) { if (varMgr.isAutoUpdate()) {
varMgr.update(currentTarget); varMgr.update(currentTarget);
@ -434,14 +427,12 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
int miLevel = 0; int miLevel = 0;
int tid = 0; int tid = 0;
ICDIThread currentThread = null; Thread currentThread = null;
try { try {
currentThread = currentTarget.getCurrentThread(); currentThread = (Thread)currentTarget.getCurrentThread();
} catch (CDIException e1) { } catch (CDIException e1) {
} }
if (currentThread instanceof Thread) { tid = currentThread.getId();
tid = ((Thread)currentThread).getId();
}
// Select the old thread now. // Select the old thread now.
if (tid > 0) { if (tid > 0) {
MIThreadSelect selectThread = factory.createMIThreadSelect(tid); MIThreadSelect selectThread = factory.createMIThreadSelect(tid);

View file

@ -18,14 +18,14 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Expression; import org.eclipse.cdt.debug.mi.core.cdi.model.Expression;
import org.eclipse.cdt.debug.mi.core.cdi.model.LocalVariable;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.cdi.model.Thread;
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; 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.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIVarCreate; import org.eclipse.cdt.debug.mi.core.command.MIVarCreate;
import org.eclipse.cdt.debug.mi.core.command.MIVarDelete; import org.eclipse.cdt.debug.mi.core.command.MIVarDelete;
@ -151,12 +151,12 @@ public class ExpressionManager extends Manager {
return null; return null;
} }
public Variable createVariable(ICDIStackFrame frame, String code) throws CDIException { public Variable createVariable(StackFrame frame, String code) throws CDIException {
Target target = (Target)frame.getTarget(); Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread(); Thread currentThread = (Thread)target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame(); StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false); target.setCurrentThread(frame.getThread(), false);
frame.getThread().setCurrentStackFrame(frame, false); ((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
try { try {
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
@ -166,8 +166,7 @@ public class ExpressionManager extends Manager {
if (info == null) { if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
} }
VariableObject varObj = new VariableObject(target, code, frame, 0, 0); Variable variable = new LocalVariable(target, null, frame, code, null, 0, 0, info.getMIVar());
Variable variable = new Variable(varObj, info.getMIVar());
variableList.add(variable); variableList.add(variable);
return variable; return variable;
} catch (MIException e) { } catch (MIException e) {

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.debug.mi.core.cdi; package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIManager;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
@ -21,7 +20,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
* Manager * Manager
* *
*/ */
public abstract class Manager extends SessionObject implements ICDIManager { public abstract class Manager extends SessionObject {
boolean autoUpdate; boolean autoUpdate;

View file

@ -19,7 +19,6 @@ public class ProcessManager extends Manager {
static final Target[] EMPTY_TARGETS = new Target[0]; static final Target[] EMPTY_TARGETS = new Target[0];
Vector debugTargetList; Vector debugTargetList;
Target currentTarget;
public ProcessManager(Session session) { public ProcessManager(Session session) {
super(session, true); super(session, true);
@ -37,7 +36,7 @@ public class ProcessManager extends Manager {
return (ICDITarget[]) debugTargetList.toArray(new ICDITarget[debugTargetList.size()]); return (ICDITarget[]) debugTargetList.toArray(new ICDITarget[debugTargetList.size()]);
} }
public void addTargets(Target[] targets, Target current) { public void addTargets(Target[] targets) {
EventManager eventManager = (EventManager)getSession().getEventManager(); EventManager eventManager = (EventManager)getSession().getEventManager();
for (int i = 0; i < targets.length; ++i) { for (int i = 0; i < targets.length; ++i) {
Target target = targets[i]; Target target = targets[i];
@ -50,9 +49,6 @@ public class ProcessManager extends Manager {
} }
} }
} }
if (current != null && debugTargetList.contains(current)) {
currentTarget = current;
}
debugTargetList.trimToSize(); debugTargetList.trimToSize();
} }
@ -64,9 +60,6 @@ public class ProcessManager extends Manager {
if (miSession != null) { if (miSession != null) {
miSession.deleteObserver(eventManager); miSession.deleteObserver(eventManager);
} }
if (currentTarget != null && currentTarget.equals(target)) {
currentTarget = null;
}
debugTargetList.remove(target); debugTargetList.remove(target);
} }
debugTargetList.trimToSize(); debugTargetList.trimToSize();
@ -86,20 +79,6 @@ public class ProcessManager extends Manager {
return null; return null;
} }
/**
* @return
*/
public Target getCurrentTarget() {
return currentTarget;
}
/**
* @param current
*/
public void setCurrentTarget(Target current) {
currentTarget = current;
}
public void update(Target target) throws CDIException { public void update(Target target) throws CDIException {
} }

View file

@ -17,13 +17,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Register; import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
import org.eclipse.cdt.debug.mi.core.cdi.model.RegisterObject; import org.eclipse.cdt.debug.mi.core.cdi.model.RegisterDescriptor;
import org.eclipse.cdt.debug.mi.core.cdi.model.RegisterGroup;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
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.MIDataListChangedRegisters; import org.eclipse.cdt.debug.mi.core.command.MIDataListChangedRegisters;
@ -35,14 +35,13 @@ import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent; import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
import org.eclipse.cdt.debug.mi.core.output.MIDataListChangedRegistersInfo; import org.eclipse.cdt.debug.mi.core.output.MIDataListChangedRegistersInfo;
import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterNamesInfo; import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterNamesInfo;
import org.eclipse.cdt.debug.mi.core.output.MIVar;
import org.eclipse.cdt.debug.mi.core.output.MIVarChange; import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo; import org.eclipse.cdt.debug.mi.core.output.MIVarCreateInfo;
import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo; import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
/** /**
*/ */
public class RegisterManager extends Manager implements ICDIRegisterManager { public class RegisterManager extends Manager {
Map regsMap; Map regsMap;
MIVarChange[] noChanges = new MIVarChange[0]; MIVarChange[] noChanges = new MIVarChange[0];
@ -60,14 +59,17 @@ public class RegisterManager extends Manager implements ICDIRegisterManager {
} }
return regsList; return regsList;
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterObjects() public ICDIRegisterGroup[] getRegisterGroups(Target target) throws CDIException {
*/ RegisterGroup group = new RegisterGroup(target, "Main"); //$NON-NLS-1$
public ICDIRegisterObject[] getRegisterObjects() throws CDIException { return new ICDIRegisterGroup[] { group };
Target target = ((Session)getSession()).getCurrentTarget();
return getRegisterObjects(target);
} }
public ICDIRegisterObject[] getRegisterObjects(Target target) throws CDIException {
public ICDIRegisterDescriptor[] getRegisterDescriptors(RegisterGroup group) throws CDIException {
Target target = (Target)group.getTarget();
return getRegisterDescriptors(target);
}
public ICDIRegisterDescriptor[] getRegisterDescriptors(Target target) throws CDIException {
Session session = (Session)getSession(); Session session = (Session)getSession();
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
@ -83,66 +85,42 @@ public class RegisterManager extends Manager implements ICDIRegisterManager {
List regsList = new ArrayList(names.length); List regsList = new ArrayList(names.length);
for (int i = 0; i < names.length; i++) { for (int i = 0; i < names.length; i++) {
if (names[i].length() > 0) { if (names[i].length() > 0) {
regsList.add(new RegisterObject(target, names[i], i)); regsList.add(new RegisterDescriptor(target, null, null, names[i], null, i, 0));
} }
} }
return (ICDIRegisterObject[])regsList.toArray(new ICDIRegisterObject[0]); return (ICDIRegisterDescriptor[])regsList.toArray(new ICDIRegisterDescriptor[0]);
} catch (MIException e) { } catch (MIException e) {
throw new MI2CDIException(e); throw new MI2CDIException(e);
} finally { } finally {
} }
} }
/** public Register createRegister(RegisterDescriptor regDesc) throws CDIException {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createRegister() Register reg = getRegister(regDesc);
*/ if (reg == null) {
public ICDIRegister createRegister(ICDIRegisterObject regObject) throws CDIException { try {
RegisterObject regObj = null; String name = "$" + regDesc.getName(); //$NON-NLS-1$
if (regObject instanceof RegisterObject) { Target target = (Target)regDesc.getTarget();
regObj = (RegisterObject)regObject; MISession mi = target.getMISession();
} CommandFactory factory = mi.getCommandFactory();
if (regObj != null) { MIVarCreate var = factory.createMIVarCreate(name);
Register reg = getRegister(regObject); mi.postCommand(var);
if (reg == null) { MIVarCreateInfo info = var.getMIVarCreateInfo();
try { if (info == null) {
String name = "$" + regObj.getName(); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
Target target = (Target)regObj.getTarget();
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarCreate var = factory.createMIVarCreate(name);
mi.postCommand(var);
MIVarCreateInfo info = var.getMIVarCreateInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
reg = new Register(regObj, info.getMIVar());
List regList = getRegistersList(target);
regList.add(reg);
} catch (MIException e) {
throw new MI2CDIException(e);
} }
reg = new Register(regDesc, info.getMIVar());
List regList = getRegistersList(target);
regList.add(reg);
} catch (MIException e) {
throw new MI2CDIException(e);
} }
return reg;
} }
throw new CDIException(CdiResources.getString("cdi.RegisterManager.Wrong_register_type")); //$NON-NLS-1$
}
public Register createRegister(RegisterObject v, MIVar mivar) throws CDIException {
Register reg = new Register(v, mivar);
Target target = (Target)v.getTarget();
List regList = (List) regsMap.get(target);
if (regList == null) {
regList = Collections.synchronizedList(new ArrayList());
regsMap.put(target, regList);
}
regList.add(reg);
return reg; return reg;
//throw new CDIException(CdiResources.getString("cdi.RegisterManager.Wrong_register_type")); //$NON-NLS-1$
} }
/** public void destroyRegister(Register reg) {
* @see org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager#destroyRegister(ICDIRegister)
*/
public void destroyRegister(ICDIRegister reg) {
Target target = (Target)reg.getTarget(); Target target = (Target)reg.getTarget();
List regList = (List)regsMap.get(target); List regList = (List)regsMap.get(target);
if (regList != null) { if (regList != null) {
@ -248,13 +226,11 @@ public class RegisterManager extends Manager implements ICDIRegisterManager {
} }
return new Register[0]; return new Register[0];
} }
private Register getRegister(RegisterDescriptor regDesc) throws CDIException {
private Register getRegister(ICDIRegisterObject regObject) throws CDIException { Register[] regs = getRegisters((Target)regDesc.getTarget());
Register[] regs = getRegisters((Target)regObject.getTarget());
for (int i = 0; i < regs.length; i++) { for (int i = 0; i < regs.length; i++) {
if (regObject.getName().equals(regs[i].getName())) { if (regDesc.getName().equals(regs[i].getName())) {
return regs[i]; return regs[i];
} }
} }

View file

@ -16,10 +16,8 @@ import java.util.Properties;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager;
import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
@ -53,7 +51,7 @@ public class Session implements ICDISession, ICDISessionObject {
setConfiguration(new Configuration(miSession, attach)); setConfiguration(new Configuration(miSession, attach));
Target target = new Target(this, miSession); Target target = new Target(this, miSession);
addTargets(new Target[] { target }, target); addTargets(new Target[] { target });
} }
public Session(MISession miSession) { public Session(MISession miSession) {
@ -61,7 +59,7 @@ public class Session implements ICDISession, ICDISessionObject {
setConfiguration(new CoreFileConfiguration()); setConfiguration(new CoreFileConfiguration());
Target target = new Target(this, miSession); Target target = new Target(this, miSession);
addTargets(new Target[] { target }, target); addTargets(new Target[] { target });
} }
public Session() { public Session() {
@ -84,9 +82,9 @@ public class Session implements ICDISession, ICDISessionObject {
sharedLibraryManager = new SharedLibraryManager(this); sharedLibraryManager = new SharedLibraryManager(this);
} }
public void addTargets(Target[] targets, Target current) { public void addTargets(Target[] targets) {
ProcessManager pMgr = getProcessManager(); ProcessManager pMgr = getProcessManager();
pMgr.addTargets(targets, current); pMgr.addTargets(targets);
} }
public void removeTargets(Target[] targets) { public void removeTargets(Target[] targets) {
@ -99,15 +97,6 @@ public class Session implements ICDISession, ICDISessionObject {
return pMgr.getTarget(miSession); return pMgr.getTarget(miSession);
} }
/**
* @deprecated
* @return
*/
public Target getCurrentTarget() {
ProcessManager pMgr = getProcessManager();
return pMgr.getCurrentTarget();
}
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getAttribute(String) * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getAttribute(String)
*/ */
@ -119,9 +108,6 @@ public class Session implements ICDISession, ICDISessionObject {
return processManager; return processManager;
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getBreakpointManager()
*/
public BreakpointManager getBreakpointManager() { public BreakpointManager getBreakpointManager() {
return breakpointManager; return breakpointManager;
} }
@ -133,24 +119,15 @@ public class Session implements ICDISession, ICDISessionObject {
return eventManager; return eventManager;
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getExpressionManager()
*/
public ExpressionManager getExpressionManager() { public ExpressionManager getExpressionManager() {
return expressionManager; return expressionManager;
} }
/** public VariableManager getVariableManager() {
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getVariableManager()
*/
public ICDIVariableManager getVariableManager() {
return variableManager; return variableManager;
} }
/** public RegisterManager getRegisterManager() {
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getRegisterManager()
*/
public ICDIRegisterManager getRegisterManager() {
return registerManager; return registerManager;
} }
@ -179,15 +156,6 @@ public class Session implements ICDISession, ICDISessionObject {
} }
/** /**
* @deprecated
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#setCurrentTarget()
*/
public void setCurrentTarget(Target target) throws CDIException {
ProcessManager pMgr = getProcessManager();
pMgr.setCurrentTarget(target);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#setAttribute(String, String) * @see org.eclipse.cdt.debug.core.cdi.ICDISession#setAttribute(String, String)
*/ */
public void setAttribute(String key, String value) { public void setAttribute(String key, String value) {
@ -262,7 +230,11 @@ public class Session implements ICDISession, ICDISessionObject {
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getSessionProcess() * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getSessionProcess()
*/ */
public Process getSessionProcess() throws CDIException { public Process getSessionProcess() throws CDIException {
return getSessionProcess(getCurrentTarget()); ICDITarget[] targets = getTargets();
if (targets != null && targets.length > 0) {
return getSessionProcess(targets[0]);
}
return null;
} }
public Process getSessionProcess(ICDITarget target) { public Process getSessionProcess(ICDITarget target) {

View file

@ -16,8 +16,6 @@ import java.util.StringTokenizer;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; 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.ICDIMixedInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.mi.core.GDBTypeParser; import org.eclipse.cdt.debug.mi.core.GDBTypeParser;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
@ -25,7 +23,9 @@ import org.eclipse.cdt.debug.mi.core.GDBTypeParser.GDBDerivedType;
import org.eclipse.cdt.debug.mi.core.GDBTypeParser.GDBType; import org.eclipse.cdt.debug.mi.core.GDBTypeParser.GDBType;
import org.eclipse.cdt.debug.mi.core.cdi.model.Instruction; import org.eclipse.cdt.debug.mi.core.cdi.model.Instruction;
import org.eclipse.cdt.debug.mi.core.cdi.model.MixedInstruction; import org.eclipse.cdt.debug.mi.core.cdi.model.MixedInstruction;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.cdi.model.Thread;
import org.eclipse.cdt.debug.mi.core.cdi.model.type.ArrayType; import org.eclipse.cdt.debug.mi.core.cdi.model.type.ArrayType;
import org.eclipse.cdt.debug.mi.core.cdi.model.type.BoolType; import org.eclipse.cdt.debug.mi.core.cdi.model.type.BoolType;
import org.eclipse.cdt.debug.mi.core.cdi.model.type.CharType; import org.eclipse.cdt.debug.mi.core.cdi.model.type.CharType;
@ -184,7 +184,7 @@ public class SourceManager extends Manager {
public void update(Target target) throws CDIException { public void update(Target target) throws CDIException {
} }
public Type getType(ICDIStackFrame frame, String name) throws CDIException { public Type getType(StackFrame frame, String name) throws CDIException {
if (name == null) { if (name == null) {
name = new String(); name = new String();
} }
@ -234,7 +234,7 @@ public class SourceManager extends Manager {
throw new CDIException(CdiResources.getString("cdi.SourceManager.Unknown_type")); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.SourceManager.Unknown_type")); //$NON-NLS-1$
} }
Type toCDIType(ICDIStackFrame frame, String name) throws CDIException { Type toCDIType(StackFrame frame, String name) throws CDIException {
// Check the derived types and agregate types // Check the derived types and agregate types
if (name == null) { if (name == null) {
name = new String(); name = new String();
@ -399,13 +399,13 @@ public class SourceManager extends Manager {
throw new CDIException(CdiResources.getString("cdi.SourceManager.Unknown_type")); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.SourceManager.Unknown_type")); //$NON-NLS-1$
} }
public String getDetailTypeName(ICDIStackFrame frame, String typename) throws CDIException { public String getDetailTypeName(StackFrame frame, String typename) throws CDIException {
Session session = (Session)getSession(); Session session = (Session)getSession();
Target target = (Target)frame.getTarget(); Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread(); Thread currentThread = (Thread)target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame(); StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false); target.setCurrentThread(frame.getThread(), false);
frame.getThread().setCurrentStackFrame(frame, false); ((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
try { try {
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
@ -424,16 +424,16 @@ public class SourceManager extends Manager {
} }
} }
public String getTypeName(ICDIStackFrame frame, String variable) throws CDIException { public String getTypeName(StackFrame frame, String variable) throws CDIException {
Session session = (Session)getSession(); Session session = (Session)getSession();
Target target = (Target)frame.getTarget(); Target target = (Target)frame.getTarget();
ICDIThread currentThread = null; Thread currentThread = null;
ICDIStackFrame currentFrame = null; StackFrame currentFrame = null;
if (frame != null) { if (frame != null) {
currentThread = target.getCurrentThread(); currentThread = (Thread)target.getCurrentThread();
currentFrame = currentThread.getCurrentStackFrame(); currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false); target.setCurrentThread(frame.getThread(), false);
frame.getThread().setCurrentStackFrame(frame, false); ((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
} }
try { try {
MISession mi = target.getMISession(); MISession mi = target.getMISession();

View file

@ -17,21 +17,29 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorageDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Argument; import org.eclipse.cdt.debug.mi.core.cdi.model.Argument;
import org.eclipse.cdt.debug.mi.core.cdi.model.ArgumentObject; import org.eclipse.cdt.debug.mi.core.cdi.model.ArgumentDescriptor;
import org.eclipse.cdt.debug.mi.core.cdi.model.GlobalVariable;
import org.eclipse.cdt.debug.mi.core.cdi.model.GlobalVariableDescriptor;
import org.eclipse.cdt.debug.mi.core.cdi.model.LocalVariable;
import org.eclipse.cdt.debug.mi.core.cdi.model.LocalVariableDescriptor;
import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
import org.eclipse.cdt.debug.mi.core.cdi.model.RegisterDescriptor;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame; import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.cdi.model.Thread;
import org.eclipse.cdt.debug.mi.core.cdi.model.ThreadStorage;
import org.eclipse.cdt.debug.mi.core.cdi.model.ThreadStorageDescriptor;
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; 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.cdi.model.VariableDescriptor;
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.MIPType; 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.MIStackListArguments;
@ -54,7 +62,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
/** /**
*/ */
public class VariableManager extends Manager implements ICDIVariableManager { public class VariableManager extends Manager {
static final ICDIVariable[] EMPTY_VARIABLES = {}; static final ICDIVariable[] EMPTY_VARIABLES = {};
// We put a restriction on how deep we want to // We put a restriction on how deep we want to
@ -101,12 +109,13 @@ public class VariableManager extends Manager implements ICDIVariableManager {
} }
/** /**
* Return the Element with this stackframe, and with this name. * Return the Element with this thread/stackframe, and with this name.
* null is return if the element is not in the cache. * null is return if the element is not in the cache.
*/ */
Variable findVariable(VariableObject v) throws CDIException { Variable findVariable(VariableDescriptor v) throws CDIException {
Target target = (Target)v.getTarget(); Target target = (Target)v.getTarget();
ICDIStackFrame stack = v.getStackFrame(); ICDIStackFrame vstack = v.getStackFrame();
ICDIThread vthread = v.getThread();
String name = v.getName(); String name = v.getName();
int position = v.getPosition(); int position = v.getPosition();
int depth = v.getStackDepth(); int depth = v.getStackDepth();
@ -119,13 +128,19 @@ public class VariableManager extends Manager implements ICDIVariableManager {
|| (vars[i].getCastingType() != null || (vars[i].getCastingType() != null
&& v.getCastingType() != null && v.getCastingType() != null
&& vars[i].getCastingType().equals(v.getCastingType())))) { && vars[i].getCastingType().equals(v.getCastingType())))) {
ICDIStackFrame frame = vars[i].getStackFrame(); // check threads
if (stack == null && frame == null) { ICDIThread thread = vars[i].getThread();
return vars[i]; if ((vthread == null && thread == null) ||
} else if (frame != null && stack != null && frame.equals(stack)) { (vthread != null && thread != null && thread.equals(vthread))) {
if (vars[i].getPosition() == position) { // check stackframes
if (vars[i].getStackDepth() == depth) { ICDIStackFrame frame = vars[i].getStackFrame();
return vars[i]; if (vstack == null && frame == null) {
return vars[i];
} else if (frame != null && vstack != null && frame.equals(vstack)) {
if (vars[i].getPosition() == position) {
if (vars[i].getStackDepth() == depth) {
return vars[i];
}
} }
} }
} }
@ -152,10 +167,10 @@ public class VariableManager extends Manager implements ICDIVariableManager {
if (type != null && type.length() > 0) { if (type != null && type.length() > 0) {
Session session = (Session)getSession(); Session session = (Session)getSession();
Target target = (Target)frame.getTarget(); Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread(); Thread currentThread = (Thread)target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame(); StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false); target.setCurrentThread(frame.getThread(), false);
frame.getThread().setCurrentStackFrame(frame, false); ((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
try { try {
MISession miSession = target.getMISession(); MISession miSession = target.getMISession();
CommandFactory factory = miSession.getCommandFactory(); CommandFactory factory = miSession.getCommandFactory();
@ -212,76 +227,138 @@ public class VariableManager extends Manager implements ICDIVariableManager {
} }
} }
/** public VariableDescriptor getVariableDescriptorAsArray(VariableDescriptor varDesc, int start, int length)
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#createArgument(ICDIArgumentObject) throws CDIException {
*/ Target target = (Target)varDesc.getTarget();
public ICDIArgument createArgument(ICDIArgumentObject a) throws CDIException { Thread thread = (Thread)varDesc.getThread();
ArgumentObject argObj = null; StackFrame frame = (StackFrame)varDesc.getStackFrame();
if (a instanceof ArgumentObject) { String name = varDesc.getName();
argObj = (ArgumentObject) a; String fullName = varDesc.getFullName();
int pos = varDesc.getPosition();
int depth = varDesc.getStackDepth();
VariableDescriptor vo = null;
if (varDesc instanceof ArgumentDescriptor || varDesc instanceof Argument) {
vo = new ArgumentDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof LocalVariableDescriptor || varDesc instanceof LocalVariable) {
vo = new LocalVariableDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof GlobalVariableDescriptor || varDesc instanceof GlobalVariable) {
vo = new GlobalVariableDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof RegisterDescriptor || varDesc instanceof Register) {
vo = new RegisterDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof ThreadStorageDescriptor || varDesc instanceof ThreadStorage) {
vo = new ThreadStorageDescriptor(target, thread, frame, name, fullName, pos, depth);
} else {
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$
} }
if (argObj != null) {
Variable variable = findVariable(argObj); vo.setCastingArrayStart(varDesc.getCastingArrayStart() + start);
Argument argument = null; vo.setCastingArrayEnd(length);
if (variable != null && variable instanceof Argument) { return vo;
argument = (Argument) variable;
}
if (argument == null) {
String name = argObj.getQualifiedName();
ICDIStackFrame stack = argObj.getStackFrame();
Session session = (Session) getSession();
ICDIThread currentThread = null;
ICDIStackFrame currentFrame = null;
Target target = (Target)argObj.getTarget();
if (stack != null) {
currentThread = target.getCurrentThread();
currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(stack.getThread(), false);
stack.getThread().setCurrentStackFrame(stack, false);
}
try {
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarCreate var = factory.createMIVarCreate(name);
mi.postCommand(var);
MIVarCreateInfo info = var.getMIVarCreateInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
argument = new Argument(argObj, info.getMIVar());
List variablesList = getVariablesList(target);
variablesList.add(argument);
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
if (currentThread != null) {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
}
}
}
return argument;
}
throw new CDIException(CdiResources.getString("cdi.VariableManager.Wrong_variable_type")); //$NON-NLS-1$
} }
/** public VariableDescriptor getVariableDescriptorAsType(VariableDescriptor varDesc, String type) throws CDIException {
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getArgumentObjects(ICDIStackFrame) // throw an exception if not a good type.
*/ Target target = (Target)varDesc.getTarget();
public ICDIArgumentObject[] getArgumentObjects(ICDIStackFrame frame) throws CDIException { Thread thread = (Thread)varDesc.getThread();
StackFrame frame = (StackFrame)varDesc.getStackFrame();
String name = varDesc.getName();
String fullName = varDesc.getFullName();
int pos = varDesc.getPosition();
int depth = varDesc.getStackDepth();
checkType(frame, type);
VariableDescriptor vo = null;
if (varDesc instanceof ArgumentDescriptor || varDesc instanceof Argument) {
vo = new ArgumentDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof LocalVariableDescriptor || varDesc instanceof LocalVariable) {
vo = new LocalVariableDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof GlobalVariableDescriptor || varDesc instanceof GlobalVariable) {
vo = new GlobalVariableDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof ThreadStorageDescriptor || varDesc instanceof ThreadStorage) {
vo = new ThreadStorageDescriptor(target, thread, frame, name, fullName, pos, depth);
} else if (varDesc instanceof RegisterDescriptor || varDesc instanceof Register) {
vo = new RegisterDescriptor(target, thread, frame, name, fullName, pos, depth);
} else {
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$
}
String casting = varDesc.getCastingType();
if (casting != null && casting.length() > 0) {
type = "(" + type + ")" + "(" + casting + " )"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
vo.setCastingType(type);
return vo;
}
public ICDIVariable createVariable(VariableDescriptor varDesc) throws CDIException {
if (varDesc instanceof ArgumentDescriptor) {
return createArgument((ArgumentDescriptor)varDesc);
} else if (varDesc instanceof LocalVariableDescriptor) {
return createLocalVariable((LocalVariableDescriptor)varDesc);
} else if (varDesc instanceof GlobalVariableDescriptor) {
return createGlobalVariable((GlobalVariableDescriptor)varDesc);
} else if (varDesc instanceof RegisterDescriptor) {
RegisterManager regMgr = ((Session)getSession()).getRegisterManager();
return regMgr.createRegister((RegisterDescriptor)varDesc);
} else if (varDesc instanceof ThreadStorageDescriptor) {
return createThreadStorage((ThreadStorageDescriptor)varDesc);
}
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$
}
public Argument createArgument(ArgumentDescriptor argDesc) throws CDIException {
Variable variable = findVariable(argDesc);
Argument argument = null;
if (variable != null && variable instanceof Argument) {
argument = (Argument) variable;
}
if (argument == null) {
String name = argDesc.getQualifiedName();
StackFrame stack = (StackFrame)argDesc.getStackFrame();
Session session = (Session) getSession();
Target target = (Target)argDesc.getTarget();
Thread currentThread = (Thread)target.getCurrentThread();
StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(stack.getThread(), false);
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
try {
MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory();
MIVarCreate var = factory.createMIVarCreate(name);
mi.postCommand(var);
MIVarCreateInfo info = var.getMIVarCreateInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
argument = new Argument(argDesc, info.getMIVar());
List variablesList = getVariablesList(target);
variablesList.add(argument);
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
}
}
return argument;
}
public ICDIArgumentDescriptor[] getArgumentDescriptors(StackFrame frame) throws CDIException {
List argObjects = new ArrayList(); List argObjects = new ArrayList();
Session session = (Session) getSession(); Session session = (Session) getSession();
Target target = (Target)frame.getTarget(); Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread(); Thread currentThread = (Thread)target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame(); StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false); target.setCurrentThread(frame.getThread(), false);
frame.getThread().setCurrentStackFrame(frame, false); ((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
try { try {
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
int depth = frame.getThread().getStackFrameCount(); int depth = frame.getThread().getStackFrameCount();
int level = frame.getLevel(); int level = frame.getLevel();
// Need the GDB/MI view of leve which the reverse i.e. Highest frame is 0 // Need the GDB/MI view of level which the reverse i.e. Highest frame is 0
int miLevel = depth - level; int miLevel = depth - level;
MIStackListArguments listArgs = factory.createMIStackListArguments(false, miLevel, miLevel); MIStackListArguments listArgs = factory.createMIStackListArguments(false, miLevel, miLevel);
MIArg[] args = null; MIArg[] args = null;
@ -296,7 +373,7 @@ public class VariableManager extends Manager implements ICDIVariableManager {
} }
if (args != null) { if (args != null) {
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
ArgumentObject arg = new ArgumentObject(target, args[i].getName(), frame, args.length - i, level); ArgumentDescriptor arg = new ArgumentDescriptor(target, null, frame, args[i].getName(), null, args.length - i, level);
argObjects.add(arg); argObjects.add(arg);
} }
} }
@ -306,18 +383,10 @@ public class VariableManager extends Manager implements ICDIVariableManager {
target.setCurrentThread(currentThread, false); target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false); currentThread.setCurrentStackFrame(currentFrame, false);
} }
return (ICDIArgumentObject[]) argObjects.toArray(new ICDIArgumentObject[0]); return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
} }
/** public GlobalVariableDescriptor getGlobalVariableDescriptor(Target target, String filename, String function, String name) throws CDIException {
* @deprecated
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getGlobalVariableObject(String, String, String)
*/
public ICDIVariableObject getGlobalVariableObject(String filename, String function, String name) throws CDIException {
Target target = ((Session)getSession()).getCurrentTarget();
return getGlobalVariableObject(target, filename, function, name);
}
public ICDIVariableObject getGlobalVariableObject(Target target, String filename, String function, String name) throws CDIException {
if (filename == null) { if (filename == null) {
filename = new String(); filename = new String();
} }
@ -335,75 +404,46 @@ public class VariableManager extends Manager implements ICDIVariableManager {
buffer.append(function).append("::"); //$NON-NLS-1$ buffer.append(function).append("::"); //$NON-NLS-1$
} }
buffer.append(name); buffer.append(name);
return new VariableObject(target, buffer.toString(), null, 0, 0); return new GlobalVariableDescriptor(target, null, null, buffer.toString(), null, 0, 0);
} }
/** public GlobalVariable createGlobalVariable(GlobalVariableDescriptor varDesc) throws CDIException {
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjectAsArray(ICDIVariableObject, int, int) Variable variable = findVariable(varDesc);
*/ GlobalVariable global = null;
public ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject object, int start, int length) if (variable instanceof GlobalVariable) {
throws CDIException { global = (GlobalVariable)variable;
VariableObject obj = null;
if (object instanceof VariableObject) {
obj = (VariableObject) object;
} }
if (obj != null) { if (global == null) {
VariableObject vo = String name = varDesc.getQualifiedName();
new VariableObject( Session session = (Session) getSession();
(Target)obj.getTarget(), Target target = (Target)varDesc.getTarget();
obj.getName(), try {
obj.getFullName(), MISession mi = target.getMISession();
obj.getStackFrame(), CommandFactory factory = mi.getCommandFactory();
obj.getPosition(), MIVarCreate var = factory.createMIVarCreate(name);
obj.getStackDepth()); mi.postCommand(var);
vo.setCastingArrayStart(obj.getCastingArrayStart() + start); MIVarCreateInfo info = var.getMIVarCreateInfo();
vo.setCastingArrayEnd(length); if (info == null) {
return vo; throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
} }
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$ global = new GlobalVariable(varDesc, info.getMIVar());
} List variablesList = getVariablesList(target);
variablesList.add(global);
/** } catch (MIException e) {
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjectAsArray(ICDIVariableObject, String, int, int) throw new MI2CDIException(e);
*/
public ICDIVariableObject getVariableObjectAsType(ICDIVariableObject object, String type) throws CDIException {
VariableObject obj = null;
if (object instanceof VariableObject) {
obj = (VariableObject) object;
}
if (obj != null) {
// throw an exception if not a good type.
Target target = (Target)obj.getTarget();
checkType((StackFrame)obj.getStackFrame(), type);
VariableObject vo =
new VariableObject(
target,
obj.getName(),
obj.getFullName(),
obj.getStackFrame(),
obj.getPosition(),
obj.getStackDepth());
String casting = obj.getCastingType();
if (casting != null && casting.length() > 0) {
type = "(" + type + ")" + "(" + casting + " )"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} }
vo.setCastingType(type);
return vo;
} }
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$ return global;
} }
/** public ICDILocalVariableDescriptor[] getLocalVariableDescriptors(StackFrame frame) throws CDIException {
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjects(ICDIStackFrame)
*/
public ICDIVariableObject[] getLocalVariableObjects(ICDIStackFrame frame) throws CDIException {
List varObjects = new ArrayList(); List varObjects = new ArrayList();
Session session = (Session) getSession(); Session session = (Session) getSession();
Target target = (Target)frame.getTarget(); Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread(); Thread currentThread = (Thread)target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame(); StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false); target.setCurrentThread(frame.getThread(), false);
frame.getThread().setCurrentStackFrame(frame, false); ((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
try { try {
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
@ -418,7 +458,7 @@ public class VariableManager extends Manager implements ICDIVariableManager {
args = info.getLocals(); args = info.getLocals();
if (args != null) { if (args != null) {
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
VariableObject varObj = new VariableObject(target, args[i].getName(), frame, args.length - i, level); LocalVariableDescriptor varObj = new LocalVariableDescriptor(target, null, frame, args[i].getName(), null, args.length - i, level);
varObjects.add(varObj); varObjects.add(varObj);
} }
} }
@ -428,82 +468,60 @@ public class VariableManager extends Manager implements ICDIVariableManager {
target.setCurrentThread(currentThread, false); target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false); currentThread.setCurrentStackFrame(currentFrame, false);
} }
return (ICDIVariableObject[]) varObjects.toArray(new ICDIVariableObject[0]); return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
} }
/** public LocalVariable createLocalVariable(LocalVariableDescriptor varDesc) throws CDIException {
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjects(ICDIStackFrame) Variable variable = findVariable(varDesc);
*/ LocalVariable local = null;
public ICDIVariableObject[] getVariableObjects(ICDIStackFrame frame) throws CDIException { if (variable instanceof LocalVariable) {
ICDIVariableObject[] locals = getLocalVariableObjects(frame); local = (LocalVariable)variable;
ICDIVariableObject[] args = getArgumentObjects(frame);
ICDIVariableObject[] vars = new ICDIVariableObject[locals.length + args.length];
System.arraycopy(locals, 0, vars, 0, locals.length);
System.arraycopy(args, 0, vars, locals.length, args.length);
return vars;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#createVariable(ICDIVariableObject)
*/
public ICDIVariable createVariable(ICDIVariableObject v) throws CDIException {
VariableObject varObj = null;
if (v instanceof VariableObject) {
varObj = (VariableObject) v;
} }
if (varObj != null) { if (local == null) {
Variable variable = findVariable(varObj); String name = varDesc.getQualifiedName();
if (variable == null) { Session session = (Session) getSession();
String name = varObj.getQualifiedName(); StackFrame stack = (StackFrame)varDesc.getStackFrame();
Session session = (Session) getSession(); Target target = (Target)varDesc.getTarget();
ICDIStackFrame stack = varObj.getStackFrame(); Thread currentThread = (Thread)target.getCurrentThread();
ICDIThread currentThread = null; StackFrame currentFrame = currentThread.getCurrentStackFrame();
ICDIStackFrame currentFrame = null; target.setCurrentThread(stack.getThread(), false);
Target target = (Target)varObj.getTarget(); ((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
if (stack != null) { try {
currentThread = target.getCurrentThread(); MISession mi = target.getMISession();
currentFrame = currentThread.getCurrentStackFrame(); CommandFactory factory = mi.getCommandFactory();
target.setCurrentThread(stack.getThread(), false); MIVarCreate var = factory.createMIVarCreate(name);
stack.getThread().setCurrentStackFrame(stack, false); mi.postCommand(var);
} MIVarCreateInfo info = var.getMIVarCreateInfo();
try { if (info == null) {
MISession mi = target.getMISession(); throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
CommandFactory factory = mi.getCommandFactory();
MIVarCreate var = factory.createMIVarCreate(name);
mi.postCommand(var);
MIVarCreateInfo info = var.getMIVarCreateInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
variable = new Variable(varObj, info.getMIVar());
List variablesList = getVariablesList(target);
variablesList.add(variable);
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
if (currentThread != null) {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
}
} }
local = new LocalVariable(varDesc, info.getMIVar());
List variablesList = getVariablesList(target);
variablesList.add(local);
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} }
return variable;
} }
throw new CDIException(CdiResources.getString("cdi.VariableManager.Wrong_variable_type")); //$NON-NLS-1$ return local;
} }
/** public ICDIThreadStorageDescriptor[] getThreadStorageDescriptors(Thread thread) throws CDIException {
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#destroyVariable(ICDIVariable) return new ICDIThreadStorageDescriptor[0];
*/ }
public void destroyVariable(ICDIVariable var) throws CDIException {
if (var instanceof Variable) { public ThreadStorage createThreadStorage(ThreadStorageDescriptor desc) throws CDIException {
// Fire a destroyEvent ? throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_variable_object")); //$NON-NLS-1$
Variable variable = (Variable) var; }
Target target = (Target)variable.getTarget();
MISession mi = target.getMISession(); public void destroyVariable(Variable variable) throws CDIException {
MIVarDeletedEvent del = new MIVarDeletedEvent(mi, variable.getMIVar().getVarName()); // Fire a destroyEvent ?
mi.fireEvent(del); Target target = (Target)variable.getTarget();
} MISession mi = target.getMISession();
MIVarDeletedEvent del = new MIVarDeletedEvent(mi, variable.getMIVar().getVarName());
mi.fireEvent(del);
} }
/** /**
@ -524,8 +542,8 @@ public class VariableManager extends Manager implements ICDIVariableManager {
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
Variable[] vars = getVariables(target); Variable[] vars = getVariables(target);
ICDIStackFrame[] frames = null; ICDIStackFrame[] frames = null;
ICDIStackFrame currentStack = null; StackFrame currentStack = null;
ICDIThread currentThread = target.getCurrentThread(); Thread currentThread = (Thread)target.getCurrentThread();
if (currentThread != null) { if (currentThread != null) {
currentStack = currentThread.getCurrentStackFrame(); currentStack = currentThread.getCurrentStackFrame();
if (currentStack != null) { if (currentStack != null) {
@ -614,4 +632,5 @@ public class VariableManager extends Manager implements ICDIVariableManager {
// need to call -var-delete. // need to call -var-delete.
return !inScope; return !inScope;
} }
} }

View file

@ -42,7 +42,7 @@ public class ChangedEvent implements ICDIChangedEvent {
session = s; session = s;
// Try the Variable manager. // Try the Variable manager.
VariableManager mgr = (VariableManager)session.getVariableManager(); VariableManager mgr = session.getVariableManager();
String varName = var.getVarName(); String varName = var.getVarName();
MISession miSession = var.getMISession(); MISession miSession = var.getMISession();
source = mgr.getVariable(miSession, varName); source = mgr.getVariable(miSession, varName);
@ -55,7 +55,7 @@ public class ChangedEvent implements ICDIChangedEvent {
// Try the Register manager // Try the Register manager
if (source == null) { if (source == null) {
RegisterManager regMgr = (RegisterManager)session.getRegisterManager(); RegisterManager regMgr = session.getRegisterManager();
source = regMgr.getRegister(miSession, varName); source = regMgr.getRegister(miSession, varName);
} }
@ -68,7 +68,7 @@ public class ChangedEvent implements ICDIChangedEvent {
public ChangedEvent(Session s, MIRegisterChangedEvent reg) { public ChangedEvent(Session s, MIRegisterChangedEvent reg) {
session = s; session = s;
RegisterManager mgr = (RegisterManager)session.getRegisterManager(); RegisterManager mgr = session.getRegisterManager();
MISession miSession = reg.getMISession(); MISession miSession = reg.getMISession();
int regno = reg.getNumber(); int regno = reg.getNumber();
source = mgr.getRegister(miSession, regno); source = mgr.getRegister(miSession, regno);

View file

@ -51,7 +51,7 @@ public class CreatedEvent implements ICDICreatedEvent {
public CreatedEvent(Session s, MIVarCreatedEvent var) { public CreatedEvent(Session s, MIVarCreatedEvent var) {
session = s; session = s;
VariableManager mgr = (VariableManager)session.getVariableManager(); VariableManager mgr = session.getVariableManager();
MISession miSession = var.getMISession(); MISession miSession = var.getMISession();
String varName = var.getVarName(); String varName = var.getVarName();
source = mgr.getVariable(miSession, varName); source = mgr.getVariable(miSession, varName);
@ -63,7 +63,7 @@ public class CreatedEvent implements ICDICreatedEvent {
public CreatedEvent(Session s, MIRegisterCreatedEvent reg) { public CreatedEvent(Session s, MIRegisterCreatedEvent reg) {
session = s; session = s;
RegisterManager mgr = (RegisterManager)session.getRegisterManager(); RegisterManager mgr = session.getRegisterManager();
MISession miSession = reg.getMISession(); MISession miSession = reg.getMISession();
int regno = reg.getNumber(); int regno = reg.getNumber();
source = mgr.getRegister(miSession, regno); source = mgr.getRegister(miSession, regno);

View file

@ -45,7 +45,7 @@ public class DestroyedEvent implements ICDIDestroyedEvent {
public DestroyedEvent(Session s, MIVarDeletedEvent var) { public DestroyedEvent(Session s, MIVarDeletedEvent var) {
session = s; session = s;
VariableManager varMgr = (VariableManager)session.getVariableManager(); VariableManager varMgr = session.getVariableManager();
MISession miSession = var.getMISession(); MISession miSession = var.getMISession();
String varName = var.getVarName(); String varName = var.getVarName();
Variable variable = varMgr.getVariable(miSession, varName); Variable variable = varMgr.getVariable(miSession, varName);

View file

@ -17,8 +17,20 @@ import org.eclipse.cdt.debug.mi.core.output.MIVar;
*/ */
public class Argument extends Variable implements ICDIArgument { public class Argument extends Variable implements ICDIArgument {
public Argument(ArgumentObject obj, MIVar var) { public Argument(Target target, Thread thread, StackFrame frame,
String n, String q, int pos, int depth, MIVar v) {
super(target, thread, frame, n, q, pos, depth, v);
}
public Argument(ArgumentDescriptor obj, MIVar var) {
super(obj, var); super(obj, var);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.core.cdi.model.ICDIThread, org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame, java.lang.String, java.lang.String, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar)
*/
protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name, String fullName, int pos, int depth, MIVar miVar) {
return new Argument(target, thread, frame, name, fullName, pos, depth, miVar);
}
} }

View file

@ -11,15 +11,15 @@
package org.eclipse.cdt.debug.mi.core.cdi.model; package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
/** /**
*/ */
public class ArgumentObject extends VariableObject implements ICDIArgumentObject { public class ArgumentDescriptor extends LocalVariableDescriptor implements ICDIArgumentDescriptor {
public ArgumentObject(Target target, String name, ICDIStackFrame frame, int pos, int depth) { public ArgumentDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn,
super(target, name, frame, pos, depth); int pos, int depth) {
super(target, thread, frame, n, fn, pos, depth);
} }
} }

View file

@ -63,28 +63,28 @@ public class Expression extends CObject implements ICDIExpression {
Target target = (Target)getTarget(); Target target = (Target)getTarget();
Session session = (Session) (target.getSession()); Session session = (Session) (target.getSession());
SourceManager sourceMgr = session.getSourceManager(); SourceManager sourceMgr = session.getSourceManager();
String nametype = sourceMgr.getTypeName(frame, getExpressionText()); String nametype = sourceMgr.getTypeName((StackFrame)frame, getExpressionText());
try { try {
type = sourceMgr.getType(frame, nametype); type = sourceMgr.getType((StackFrame)frame, nametype);
} catch (CDIException e) { } catch (CDIException e) {
// Try with ptype. // Try with ptype.
try { try {
String ptype = sourceMgr.getDetailTypeName(frame, nametype); String ptype = sourceMgr.getDetailTypeName((StackFrame)frame, nametype);
type = sourceMgr.getType(frame, ptype); type = sourceMgr.getType((StackFrame)frame, ptype);
} catch (CDIException ex) { } catch (CDIException ex) {
// Some version of gdb does not work with the name of the class // Some version of gdb does not work with the name of the class
// ex: class data foo --> ptype data --> fails // ex: class data foo --> ptype data --> fails
// ex: class data foo --> ptype foo --> succeed // ex: class data foo --> ptype foo --> succeed
try { try {
String ptype = sourceMgr.getDetailTypeName(frame, getExpressionText()); String ptype = sourceMgr.getDetailTypeName((StackFrame)frame, getExpressionText());
type = sourceMgr.getType(frame, ptype); type = sourceMgr.getType((StackFrame)frame, ptype);
} catch (CDIException e2) { } catch (CDIException e2) {
// give up. // give up.
} }
} }
} }
if (type == null) { if (type == null) {
type = new IncompleteType(frame, nametype); type = new IncompleteType((StackFrame)frame, nametype);
} }
return type; return type;
@ -96,8 +96,17 @@ public class Expression extends CObject implements ICDIExpression {
public ICDIValue getValue(ICDIStackFrame context) throws CDIException { public ICDIValue getValue(ICDIStackFrame context) throws CDIException {
Session session = (Session)getTarget().getSession(); Session session = (Session)getTarget().getSession();
ExpressionManager mgr = session.getExpressionManager(); ExpressionManager mgr = session.getExpressionManager();
Variable var = mgr.createVariable(context, getExpressionText()); Variable var = mgr.createVariable((StackFrame)context, getExpressionText());
return var.getValue(); return var.getValue();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExpression#dispose()
*/
public void dispose() throws CDIException {
Session session = (Session)getTarget().getSession();
ExpressionManager mgr = session.getExpressionManager();
mgr.destroyExpressions((Target)getTarget(), new Expression[] {this});
}
} }

View file

@ -0,0 +1,51 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable;
import org.eclipse.cdt.debug.mi.core.output.MIVar;
/**
* GlobalVariable
*/
public class GlobalVariable extends Variable implements ICDIGlobalVariable {
/**
* @param obj
* @param v
*/
public GlobalVariable(VariableDescriptor obj, MIVar v) {
super(obj, v);
}
/**
* @param target
* @param n
* @param q
* @param thread
* @param stack
* @param pos
* @param depth
* @param v
*/
public GlobalVariable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar v) {
super(target, thread, frame, n, q, pos, depth, v);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, java.lang.String, java.lang.String, org.eclipse.cdt.debug.core.cdi.model.ICDIThread, org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar)
*/
protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name, String fullName, int pos, int depth, MIVar miVar) {
return new GlobalVariable(target, thread, frame, name, fullName, pos, depth, miVar);
}
}

View file

@ -0,0 +1,35 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariableDescriptor;
/**
* GlobalVariableDescriptor
*/
public class GlobalVariableDescriptor extends VariableDescriptor implements ICDIGlobalVariableDescriptor {
/**
* @param target
* @param thread
* @param stack
* @param n
* @param fn
* @param pos
* @param depth
*/
public GlobalVariableDescriptor(Target target, Thread thread,
StackFrame stack, String n, String fn, int pos, int depth) {
super(target, thread, stack, n, fn, pos, depth);
}
}

View file

@ -0,0 +1,45 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariable;
import org.eclipse.cdt.debug.mi.core.output.MIVar;
/**
* LocalVariable
*/
public class LocalVariable extends Variable implements ICDILocalVariable {
/**
* @param obj
* @param v
*/
public LocalVariable(LocalVariableDescriptor obj, MIVar v) {
super(obj, v);
}
/**
*/
public LocalVariable(Target target, Thread thread, StackFrame frame, String n, String q,
int pos, int depth, MIVar v) {
super(target, thread, frame, n, q, pos, depth, v);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, java.lang.String, java.lang.String, org.eclipse.cdt.debug.core.cdi.model.ICDIThread, org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar)
*/
protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name,
String fullName, int pos, int depth, MIVar miVar) {
return new LocalVariable(target, thread, frame, name, fullName, pos, depth, miVar);
}
}

View file

@ -0,0 +1,34 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariableDescriptor;
/**
* LocalVariableDescriptor
*/
public class LocalVariableDescriptor extends VariableDescriptor implements
ICDILocalVariableDescriptor {
/**
* @param target
* @param n
* @param fn
* @param stack
* @param pos
* @param depth
*/
public LocalVariableDescriptor(Target target, Thread thread, StackFrame frame, String n, String fn, int pos, int depth) {
super(target, thread, frame, n, fn, pos, depth);
}
}

View file

@ -10,29 +10,34 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model; 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.ICDIRegister; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIVarListChildren;
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.MIVarListChildrenInfo;
/** /**
*/ */
public class Register extends Variable implements ICDIRegister { public class Register extends Variable implements ICDIRegister {
public Register(RegisterObject obj, MIVar var) { /**
* @param target
* @param thread
* @param frame
* @param n
* @param q
* @param pos
* @param depth
* @param v
*/
public Register(Target target, Thread thread, StackFrame frame,
String n, String q, int pos, int depth, MIVar v) {
super(target, thread, frame, n, q, pos, depth, v);
}
public Register(RegisterDescriptor obj, MIVar var) {
super(obj, var); super(obj, var);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.cdi.model.VariableObject#getFullName() * @see org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor#getFullName()
*/ */
public String getFullName() { public String getFullName() {
if (fullName == null) { if (fullName == null) {
@ -44,40 +49,8 @@ public class Register extends Variable implements ICDIRegister {
return fullName; return fullName;
} }
public ICDIVariable[] getChildren() throws CDIException { protected Variable createVariable(Target target, Thread thread, StackFrame frame, String name, String fullName, int pos, int depth, MIVar miVar) {
Target target = (Target)getTarget(); return new Register(target, thread, frame, name, fullName, pos, depth, miVar);
MISession miSession = target.getMISession();
RegisterManager mgr = (RegisterManager)target.getSession().getRegisterManager();
CommandFactory factory = miSession.getCommandFactory();
MIVarListChildren var =
factory.createMIVarListChildren(getMIVar().getVarName());
try {
miSession.postCommand(var);
MIVarListChildrenInfo info = var.getMIVarListChildrenInfo();
if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
}
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; //$NON-NLS-1$
}
} else {
fn = getFullName() + "." + exp; //$NON-NLS-1$
}
RegisterObject regObj = new RegisterObject(target, exp, fn, getPosition());
children[i] = mgr.createRegister(regObj, vars[i]);
}
} catch (MIException e) {
throw new MI2CDIException(e);
}
return children;
} }
} }

View file

@ -11,22 +11,19 @@
package org.eclipse.cdt.debug.mi.core.cdi.model; package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor;
/** /**
*/ */
public class RegisterObject extends VariableObject implements ICDIRegisterObject { public class RegisterDescriptor extends VariableDescriptor implements ICDIRegisterDescriptor {
public RegisterObject(Target target, String name, int i) {
super(target, name, null, i, 0);
}
public RegisterObject(Target target, String name, String fn, int i) { public RegisterDescriptor(Target target, Thread thread, StackFrame frame, String name, String fn, int pos, int depth) {
super(target, name, fn, null, i, 0); super(target, thread, frame, name, fn, pos, depth);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.cdi.model.VariableObject#getFullName() * @see org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor#getFullName()
*/ */
public String getFullName() { public String getFullName() {
if (fullName == null) { if (fullName == null) {

View file

@ -0,0 +1,52 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
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.ICDIRegisterDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup;
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
/**
* RegisterGroup
*/
public class RegisterGroup extends CObject implements ICDIRegisterGroup {
String fName;
/**
* @param t
*/
public RegisterGroup(Target t, String name) {
super(t);
fName = name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup#getRegisterDescriptors()
*/
public ICDIRegisterDescriptor[] getRegisterDescriptors() throws CDIException {
Target target = (Target)getTarget();
Session session = (Session)target.getSession();
RegisterManager regMgr = session.getRegisterManager();
return regMgr.getRegisterDescriptors(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup#getName()
*/
public String getName() {
return fName;
}
}

View file

@ -73,7 +73,7 @@ public class SharedLibrary extends CObject implements ICDISharedLibrary {
*/ */
public void loadSymbols() throws CDIException { public void loadSymbols() throws CDIException {
Target target = (Target)getTarget(); Target target = (Target)getTarget();
SharedLibraryManager mgr = (SharedLibraryManager)((Session)target.getSession()).getSharedLibraryManager(); SharedLibraryManager mgr = ((Session)target.getSession()).getSharedLibraryManager();
mgr.loadSymbols(target, new ICDISharedLibrary[] { this }); mgr.loadSymbols(target, new ICDISharedLibrary[] { this });
} }

View file

@ -14,13 +14,11 @@ import java.math.BigInteger;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject; import org.eclipse.cdt.debug.core.cdi.model.ICDILocalVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.MIFormat;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
@ -42,8 +40,8 @@ public class StackFrame extends CObject implements ICDIStackFrame {
MIFrame frame; MIFrame frame;
Thread cthread; Thread cthread;
int level; int level;
ICDIArgument[] args; ICDIArgumentDescriptor[] argDescs;
ICDIVariable[] locals; ICDILocalVariableDescriptor[] localDescs;
Location fLocation; Location fLocation;
/* /*
@ -88,45 +86,27 @@ public class StackFrame extends CObject implements ICDIStackFrame {
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArguments() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArgumentDescriptors()
*/ */
public ICDIArgument[] getArguments() throws CDIException { public ICDIArgumentDescriptor[] getArgumentDescriptors() throws CDIException {
if (args == null) { if (argDescs == null) {
Session session = (Session)getTarget().getSession(); Session session = (Session)getTarget().getSession();
VariableManager mgr = (VariableManager)session.getVariableManager(); VariableManager mgr = session.getVariableManager();
ICDIArgumentObject[] argObjs = mgr.getArgumentObjects(this); argDescs = mgr.getArgumentDescriptors(this);
args = new ICDIArgument[argObjs.length];
for (int i = 0; i < args.length; i++) {
try {
args[i] = mgr.createArgument(argObjs[i]);
} catch (CDIException e) {
args = null;
throw e;
}
}
} }
return args; return argDescs;
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariables() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariableDescriptors()
*/ */
public ICDIVariable[] getLocalVariables() throws CDIException { public ICDILocalVariableDescriptor[] getLocalVariableDescriptors() throws CDIException {
if (locals == null) { if (localDescs == null) {
Session session = (Session)getTarget().getSession(); Session session = (Session)getTarget().getSession();
VariableManager mgr = (VariableManager)session.getVariableManager(); VariableManager mgr = session.getVariableManager();
ICDIVariableObject[] varObjs = mgr.getLocalVariableObjects(this); localDescs = mgr.getLocalVariableDescriptors(this);
locals = new ICDIVariable[varObjs.length];
for (int i = 0; i < locals.length; i++) {
try {
locals[i] = mgr.createVariable(varObjs[i]);
} catch (CDIException e) {
locals = null;
throw e;
}
}
} }
return locals; return localDescs;
} }
/** /**

View file

@ -17,19 +17,20 @@ import java.util.List;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions; import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
import org.eclipse.cdt.debug.mi.core.CoreProcess; import org.eclipse.cdt.debug.mi.core.CoreProcess;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
@ -41,6 +42,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager; import org.eclipse.cdt.debug.mi.core.cdi.MemoryManager;
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SessionObject;
import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;
import org.eclipse.cdt.debug.mi.core.cdi.SignalManager; import org.eclipse.cdt.debug.mi.core.cdi.SignalManager;
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager; import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
@ -70,16 +72,15 @@ import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
/** /**
*/ */
public class Target implements ICDITarget { public class Target extends SessionObject implements ICDITarget {
Session session;
MISession miSession; MISession miSession;
Thread[] noThreads = new Thread[0]; Thread[] noThreads = new Thread[0];
Thread[] currentThreads; Thread[] currentThreads;
int currentThreadId; int currentThreadId;
public Target(Session s, MISession mi) { public Target(Session s, MISession mi) {
session = s; super(s);
miSession = mi; miSession = mi;
currentThreads = noThreads; currentThreads = noThreads;
} }
@ -88,13 +89,6 @@ public class Target implements ICDITarget {
return miSession; return miSession;
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getSession()
*/
public ICDISession getSession() {
return session;
}
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getTarget() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIObject#getTarget()
*/ */
@ -154,15 +148,16 @@ public class Target implements ICDITarget {
throw new MI2CDIException(e); throw new MI2CDIException(e);
} }
Session session = (Session)getSession();
// Resetting threads may change the value of // Resetting threads may change the value of
// some variables like Register. Call an update() // some variables like Register. Call an update()
// To generate changeEvents. // To generate changeEvents.
if (doUpdate) { if (doUpdate) {
RegisterManager regMgr = (RegisterManager)session.getRegisterManager(); RegisterManager regMgr = session.getRegisterManager();
if (regMgr.isAutoUpdate()) { if (regMgr.isAutoUpdate()) {
regMgr.update(this); regMgr.update(this);
} }
VariableManager varMgr = (VariableManager)session.getVariableManager(); VariableManager varMgr = session.getVariableManager();
if (varMgr.isAutoUpdate()) { if (varMgr.isAutoUpdate()) {
varMgr.update(this); varMgr.update(this);
} }
@ -636,10 +631,10 @@ public class Target implements ICDITarget {
public String evaluateExpressionToString(ICDIStackFrame frame, String expressionText) throws CDIException { public String evaluateExpressionToString(ICDIStackFrame frame, String expressionText) throws CDIException {
Session session = (Session)getSession(); Session session = (Session)getSession();
Target target = (Target)frame.getTarget(); Target target = (Target)frame.getTarget();
ICDIThread currentThread = target.getCurrentThread(); Thread currentThread = (Thread)target.getCurrentThread();
ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame(); StackFrame currentFrame = currentThread.getCurrentStackFrame();
target.setCurrentThread(frame.getThread(), false); target.setCurrentThread(frame.getThread(), false);
frame.getThread().setCurrentStackFrame(frame, false); ((Thread)frame.getThread()).setCurrentStackFrame((StackFrame)frame, false);
try { try {
CommandFactory factory = miSession.getCommandFactory(); CommandFactory factory = miSession.getCommandFactory();
MIDataEvaluateExpression evaluate = MIDataEvaluateExpression evaluate =
@ -933,4 +928,20 @@ public class Target implements ICDITarget {
return sharedMgr.getSharedLibraries(this); return sharedMgr.getSharedLibraries(this);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getGlobalVariableDescriptors(java.lang.String, java.lang.String, java.lang.String)
*/
public ICDIVariableDescriptor getGlobalVariableDescriptors(String filename, String function, String name) throws CDIException {
VariableManager varMgr = ((Session)getSession()).getVariableManager();
return varMgr.getGlobalVariableDescriptor(this, filename, function, name);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterGroups()
*/
public ICDIRegisterGroup[] getRegisterGroups() throws CDIException {
RegisterManager regMgr = ((Session)getSession()).getRegisterManager();
return regMgr.getRegisterGroups(this);
}
} }

View file

@ -21,6 +21,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorageDescriptor;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
@ -45,7 +46,7 @@ public class Thread extends CObject implements ICDIThread {
static ICDIStackFrame[] noStack = new ICDIStackFrame[0]; static ICDIStackFrame[] noStack = new ICDIStackFrame[0];
int id; int id;
String name; String name;
ICDIStackFrame currentFrame; StackFrame currentFrame;
List currentFrames; List currentFrames;
int stackdepth = 0; int stackdepth = 0;
@ -86,11 +87,11 @@ public class Thread extends CObject implements ICDIThread {
} }
} }
public ICDIStackFrame getCurrentStackFrame() throws CDIException { public StackFrame getCurrentStackFrame() throws CDIException {
if (currentFrame == null) { if (currentFrame == null) {
ICDIStackFrame[] frames = getStackFrames(0, 0); ICDIStackFrame[] frames = getStackFrames(0, 0);
if (frames.length > 0) { if (frames.length > 0) {
currentFrame = frames[0]; currentFrame = (StackFrame)frames[0];
} }
} }
return currentFrame; return currentFrame;
@ -137,7 +138,7 @@ public class Thread extends CObject implements ICDIThread {
for (int i = 0; i < currentFrames.size(); i++) { for (int i = 0; i < currentFrames.size(); i++) {
ICDIStackFrame stack = (ICDIStackFrame) currentFrames.get(i); ICDIStackFrame stack = (ICDIStackFrame) currentFrames.get(i);
if (stack.getLevel() == depth) { if (stack.getLevel() == depth) {
currentFrame = stack; currentFrame = (StackFrame)stack;
} }
} }
} }
@ -244,17 +245,10 @@ public class Thread extends CObject implements ICDIThread {
return (ICDIStackFrame[])list.toArray(noStack); return (ICDIStackFrame[])list.toArray(noStack);
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#setCurrentStackFrame(ICDIStackFrame)
*/
public void setCurrentStackFrame(ICDIStackFrame stackframe) throws CDIException {
setCurrentStackFrame(stackframe, true);
}
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#setCurrentStackFrame(ICDIStackFrame, boolean) * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#setCurrentStackFrame(ICDIStackFrame, boolean)
*/ */
public void setCurrentStackFrame(ICDIStackFrame stackframe, boolean doUpdate) throws CDIException { public void setCurrentStackFrame(StackFrame stackframe, boolean doUpdate) throws CDIException {
// Assert we should assert that the stackframe is one of our frames. // Assert we should assert that the stackframe is one of our frames.
@ -295,11 +289,11 @@ public class Thread extends CObject implements ICDIThread {
// To generate changeEvents. // To generate changeEvents.
if (doUpdate) { if (doUpdate) {
Session session = (Session) target.getSession(); Session session = (Session) target.getSession();
RegisterManager regMgr = (RegisterManager) session.getRegisterManager(); RegisterManager regMgr = session.getRegisterManager();
if (regMgr.isAutoUpdate()) { if (regMgr.isAutoUpdate()) {
regMgr.update(target); regMgr.update(target);
} }
VariableManager varMgr = (VariableManager) session.getVariableManager(); VariableManager varMgr = session.getVariableManager();
if (varMgr.isAutoUpdate()) { if (varMgr.isAutoUpdate()) {
varMgr.update(target); varMgr.update(target);
} }
@ -520,4 +514,13 @@ public class Thread extends CObject implements ICDIThread {
return target.setLocationBreakpoint(type, location, newCondition, deferred); return target.setLocationBreakpoint(type, location, newCondition, deferred);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getThreadStorageDescriptors()
*/
public ICDIThreadStorageDescriptor[] getThreadStorageDescriptors() throws CDIException {
Session session = (Session)getTarget().getSession();
VariableManager varMgr = session.getVariableManager();
return varMgr.getThreadStorageDescriptors(this);
}
} }

View file

@ -0,0 +1,54 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorage;
import org.eclipse.cdt.debug.mi.core.output.MIVar;
/**
* ThreadStorage
*/
public class ThreadStorage extends Variable implements ICDIThreadStorage {
/**
* @param obj
* @param v
*/
public ThreadStorage(VariableDescriptor obj, MIVar v) {
super(obj, v);
}
/**
* @param target
* @param thread
* @param frame
* @param n
* @param q
* @param pos
* @param depth
* @param v
*/
public ThreadStorage(Target target, Thread thread, StackFrame frame,
String n, String q, int pos, int depth, MIVar v) {
super(target, thread, frame, n, q, pos, depth, v);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.cdi.model.Variable#createVariable(org.eclipse.cdt.debug.mi.core.cdi.model.Target, org.eclipse.cdt.debug.mi.core.cdi.model.Thread, org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame, java.lang.String, java.lang.String, int, int, org.eclipse.cdt.debug.mi.core.output.MIVar)
*/
protected Variable createVariable(Target target, Thread thread,
StackFrame frame, String name, String fullName, int pos, int depth,
MIVar miVar) {
return null;
}
}

View file

@ -0,0 +1,36 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThreadStorageDescriptor;
/**
* ThreadStorageDescriptor
*/
public class ThreadStorageDescriptor extends VariableDescriptor implements
ICDIThreadStorageDescriptor {
/**
* @param target
* @param thread
* @param stack
* @param n
* @param fn
* @param pos
* @param depth
*/
public ThreadStorageDescriptor(Target target, Thread thread,
StackFrame stack, String n, String fn, int pos, int depth) {
super(target, thread, stack, n, fn, pos, depth);
}
}

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model; package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
@ -69,7 +69,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIVarShowAttributesInfo;
/** /**
*/ */
public class Variable extends VariableObject implements ICDIVariable { public abstract class Variable extends VariableDescriptor implements ICDIVariable {
MIVar miVar; MIVar miVar;
Value value; Value value;
@ -78,13 +78,13 @@ public class Variable extends VariableObject implements ICDIVariable {
String language; String language;
boolean isFake = false; boolean isFake = false;
public Variable(VariableObject obj, MIVar v) { public Variable(VariableDescriptor obj, MIVar v) {
super(obj); super(obj);
miVar = v; miVar = v;
} }
public Variable(Target target, String n, String q, ICDIStackFrame stack, int pos, int depth, MIVar v) { public Variable(Target target, Thread thread, StackFrame frame, String n, String q, int pos, int depth, MIVar v) {
super(target, n, q, stack, pos, depth); super(target, thread, frame, n, q, pos, depth);
miVar = v; miVar = v;
} }
@ -220,7 +220,8 @@ public class Variable extends VariableObject implements ICDIVariable {
fn = "(" + fn + ")." + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$ fn = "(" + fn + ")." + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }
Variable v = new Variable((Target)getTarget(), childName, fn, getStackFrame(), getPosition(), getStackDepth(), vars[i]); Variable v = createVariable((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(),
childName, fn, getPosition(), getStackDepth(), vars[i]);
if (childType != null) { if (childType != null) {
// Hack to reset the typename to a known value // Hack to reset the typename to a known value
v.type = childType; v.type = childType;
@ -234,6 +235,9 @@ public class Variable extends VariableObject implements ICDIVariable {
return children; return children;
} }
protected abstract Variable createVariable(Target target, Thread thread, StackFrame frame,
String name, String fullName, int pos, int depth, MIVar miVar);
public int getChildrenNumber() throws CDIException { public int getChildrenNumber() throws CDIException {
return miVar.getNumChild(); return miVar.getNumChild();
} }
@ -314,31 +318,29 @@ public class Variable extends VariableObject implements ICDIVariable {
// Changing values may have side effects i.e. affecting other variables // Changing values may have side effects i.e. affecting other variables
// if the manager is on autoupdate check all the other variables. // if the manager is on autoupdate check all the other variables.
// Note: This maybe very costly. // Note: This maybe very costly.
if (this instanceof Register) { // assigning may have side effects i.e. affecting other registers.
// If register was on autoupdate, update all the other registers
// assigning may have side effects i.e. affecting other registers.
RegisterManager mgr = (RegisterManager)target.getSession().getRegisterManager();
if (mgr.isAutoUpdate()) {
mgr.update(target);
}
} else {
// If expression was on autoupdate, update all the other expression
// assigning may have side effects i.e. affecting other expressions.
ExpressionManager expMgr = ((Session)target.getSession()).getExpressionManager();
if (expMgr.isAutoUpdate()) {
expMgr.update(target);
}
// FIXME: Should we always call the Variable Manager ? // If register was on autoupdate, update all the other registers
VariableManager varMgr = (VariableManager)target.getSession().getVariableManager(); RegisterManager regMgr = ((Session)target.getSession()).getRegisterManager();
if (varMgr.isAutoUpdate()) { if (regMgr.isAutoUpdate()) {
varMgr.update(target); regMgr.update(target);
} }
// If expression was on autoupdate, update all the other expression
ExpressionManager expMgr = ((Session)target.getSession()).getExpressionManager();
if (expMgr.isAutoUpdate()) {
expMgr.update(target);
}
// If variable was on autoupdate, update all the variables.
VariableManager varMgr = ((Session)target.getSession()).getVariableManager();
if (varMgr.isAutoUpdate()) {
varMgr.update(target);
} }
} }
/** /**
* Overload the implementation of VariableObject and let gdb * Overload the implementation of VariableDescriptor and let gdb
* handle it. * handle it.
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#isEditable() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#isEditable()
*/ */
@ -391,4 +393,13 @@ public class Variable extends VariableObject implements ICDIVariable {
return super.equals(var); return super.equals(var);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariable#dispose()
*/
public void dispose() throws CDIException {
ICDITarget target = getTarget();
VariableManager varMgr = ((Session)target.getSession()).getVariableManager();
varMgr.destroyVariable(this);
}
} }

View file

@ -12,19 +12,16 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
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.ICDIStructType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIVoidType;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager; import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType; import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType;
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.MIDataEvaluateExpression; import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression;
@ -33,7 +30,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
/** /**
*/ */
public class VariableObject extends CObject implements ICDIVariableObject { public abstract class VariableDescriptor extends CObject implements ICDIVariableDescriptor {
// Casting info. // Casting info.
String castingType; String castingType;
@ -42,7 +39,8 @@ public class VariableObject extends CObject implements ICDIVariableObject {
String name; String name;
int position; int position;
ICDIStackFrame frame; StackFrame fStackFrame;
Thread fThread;
int stackdepth; int stackdepth;
String qualifiedName = null; String qualifiedName = null;
@ -53,34 +51,32 @@ public class VariableObject extends CObject implements ICDIVariableObject {
/** /**
* Copy constructor. * Copy constructor.
* @param obj * @param desc
*/ */
public VariableObject(VariableObject obj) { public VariableDescriptor(VariableDescriptor desc) {
super((Target)obj.getTarget()); super((Target)desc.getTarget());
name = obj.getName(); name = desc.getName();
fullName = obj.fullName; fullName = desc.fullName;
sizeof = obj.sizeof; sizeof = desc.sizeof;
type = obj.type; type = desc.type;
try { try {
frame = obj.getStackFrame(); fStackFrame = (StackFrame)desc.getStackFrame();
fThread = (Thread)desc.getThread();
} catch (CDIException e) { } catch (CDIException e) {
} }
position = obj.getPosition(); position = desc.getPosition();
stackdepth = obj.getStackDepth(); stackdepth = desc.getStackDepth();
castingIndex = obj.getCastingArrayStart(); castingIndex = desc.getCastingArrayStart();
castingLength = obj.getCastingArrayEnd(); castingLength = desc.getCastingArrayEnd();
castingType = obj.getCastingType(); castingType = desc.getCastingType();
} }
public VariableObject(Target target, String n, ICDIStackFrame stack, int pos, int depth) { public VariableDescriptor(Target target, Thread thread, StackFrame stack, String n, String fn, int pos, int depth) {
this(target, n, null, stack, pos, depth);
}
public VariableObject(Target target, String n, String fn, ICDIStackFrame stack, int pos, int depth) {
super(target); super(target);
name = n; name = n;
fullName = fn; fullName = fn;
frame = stack; fStackFrame = stack;
fThread = thread;
position = pos; position = pos;
stackdepth = depth; stackdepth = depth;
} }
@ -149,7 +145,7 @@ public class VariableObject extends CObject implements ICDIVariableObject {
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDIVariableObject#getName() * @see org.eclipse.cdt.debug.core.cdi.ICDIVariableDescriptor#getName()
*/ */
public String getName() { public String getName() {
return name; return name;
@ -162,9 +158,14 @@ public class VariableObject extends CObject implements ICDIVariableObject {
if (type == null) { if (type == null) {
Target target = (Target)getTarget(); Target target = (Target)getTarget();
Session session = (Session) (target.getSession()); Session session = (Session) (target.getSession());
ICDIStackFrame frame = getStackFrame(); StackFrame frame = (StackFrame)getStackFrame();
if (frame == null) { if (frame == null) {
frame = target.getCurrentThread().getCurrentStackFrame(); Thread thread = (Thread)getThread();
if (thread != null) {
frame = thread.getCurrentStackFrame();
} else {
frame = ((Thread)target.getCurrentThread()).getCurrentStackFrame();
}
} }
SourceManager sourceMgr = session.getSourceManager(); SourceManager sourceMgr = session.getSourceManager();
String nametype = sourceMgr.getTypeName(frame, getQualifiedName()); String nametype = sourceMgr.getTypeName(frame, getQualifiedName());
@ -195,12 +196,22 @@ public class VariableObject extends CObject implements ICDIVariableObject {
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#sizeof() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#sizeof()
*/ */
public int sizeof() throws CDIException { public int sizeof() throws CDIException {
if (sizeof == null) { if (sizeof == null) {
Target target = (Target) getTarget(); Target target = (Target) getTarget();
Session session = (Session) (target.getSession()); Session session = (Session) (target.getSession());
Thread currentThread = (Thread)target.getCurrentThread();
StackFrame currentFrame = currentThread.getCurrentStackFrame();
StackFrame frame = (StackFrame)getStackFrame();
Thread thread = (Thread)getThread();
if (frame != null) {
target.setCurrentThread(frame.getThread(), false);
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
} else if (thread != null) {
target.setCurrentThread(thread, false);
}
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
String exp = "sizeof(" + getTypeName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ String exp = "sizeof(" + getTypeName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
@ -209,11 +220,18 @@ public class VariableObject extends CObject implements ICDIVariableObject {
mi.postCommand(evaluate); mi.postCommand(evaluate);
MIDataEvaluateExpressionInfo info = evaluate.getMIDataEvaluateExpressionInfo(); MIDataEvaluateExpressionInfo info = evaluate.getMIDataEvaluateExpressionInfo();
if (info == null) { if (info == null) {
throw new CDIException(CdiResources.getString("cdi.model.VariableObject.Target_not_responding")); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.model.VariableDescriptor.Target_not_responding")); //$NON-NLS-1$
} }
sizeof = info.getExpression(); sizeof = info.getExpression();
} catch (MIException e) { } catch (MIException e) {
throw new MI2CDIException(e); throw new MI2CDIException(e);
} finally {
if (frame != null) {
target.setCurrentThread(currentThread, false);
currentThread.setCurrentStackFrame(currentFrame, false);
} else if (thread != null) {
target.setCurrentThread(currentThread, false);
}
} }
} }
@ -228,28 +246,18 @@ public class VariableObject extends CObject implements ICDIVariableObject {
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#isEdiTable() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getStackFrame()
*/
public boolean isEditable() throws CDIException {
ICDIType t = getType();
if (t instanceof ICDIArrayType
|| t instanceof ICDIStructType
|| t instanceof ICDIVoidType
|| t instanceof ICDIFunctionType) {
return false;
}
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#getStackFrame()
*/ */
public ICDIStackFrame getStackFrame() throws CDIException { public ICDIStackFrame getStackFrame() throws CDIException {
return frame; return fStackFrame;
}
public ICDIThread getThread() throws CDIException {
return fThread;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#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 (typename == null) {
@ -260,31 +268,7 @@ public class VariableObject extends CObject implements ICDIVariableObject {
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#hasChildren() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getQualifiedName()
*/
public boolean hasChildren() throws CDIException {
ICDIType t = getType();
// For reference we need to get the referenced type
// to make a decision.
if (t instanceof ICDIReferenceType) {
t = ((ICDIReferenceType) t).getComponentType();
}
if (t instanceof ICDIArrayType || t instanceof ICDIStructType) {
return true;
} else if (t instanceof ICDIPointerType) {
ICDIType sub = ((ICDIPointerType) t).getComponentType();
if (sub instanceof ICDIVoidType) {
return false;
}
return true;
}
return false;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#getQualifiedName()
*/ */
public String getQualifiedName() throws CDIException { public String getQualifiedName() throws CDIException {
if (qualifiedName == null) { if (qualifiedName == null) {
@ -294,34 +278,78 @@ public class VariableObject extends CObject implements ICDIVariableObject {
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#equals(ICDIVariableObject) * @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#equals(ICDIVariableDescriptor)
*/ */
public boolean equals(ICDIVariableObject varObj) { public boolean equals(ICDIVariableDescriptor varDesc) {
if (varObj instanceof VariableObject) { if (varDesc instanceof VariableDescriptor) {
VariableObject var = (VariableObject) varObj; VariableDescriptor desc = (VariableDescriptor) varDesc;
if (var.getName().equals(getName()) if (desc.getName().equals(getName())
&& var.getCastingArrayStart() == getCastingArrayStart() && desc.getCastingArrayStart() == getCastingArrayStart()
&& var.getCastingArrayEnd() == getCastingArrayEnd() && desc.getCastingArrayEnd() == getCastingArrayEnd()
&& ((var.getCastingType() == null && getCastingType() == null) && ((desc.getCastingType() == null && getCastingType() == null)
|| (var.getCastingType() != null && getCastingType() != null && var.getCastingType().equals(getCastingType())))) { || (desc.getCastingType() != null && getCastingType() != null && desc.getCastingType().equals(getCastingType())))) {
ICDIStackFrame varFrame = null;
ICDIStackFrame ourFrame = null; // Check the threads
ICDIThread varThread = null;
ICDIThread ourThread = null;
try { try {
varFrame = var.getStackFrame(); varThread = desc.getThread();
ourFrame = getStackFrame(); ourThread = getThread();
} catch (CDIException e) { } catch (CDIException e) {
// ignore
} }
if (ourFrame == null && varFrame == null) { if ((ourThread == null && varThread == null) ||
return true; (varThread != null && ourThread != null && varThread.equals(ourThread))) {
} else if (varFrame != null && ourFrame != null && varFrame.equals(ourFrame)) { // check the stackFrames
if (var.getStackDepth() == getStackDepth()) { ICDIStackFrame varFrame = null;
if (var.getPosition() == getPosition()) { ICDIStackFrame ourFrame = null;
return true; try {
varFrame = desc.getStackFrame();
ourFrame = getStackFrame();
} catch (CDIException e) {
// ignore
}
if (ourFrame == null && varFrame == null) {
return true;
} else if (varFrame != null && ourFrame != null && varFrame.equals(ourFrame)) {
if (desc.getStackDepth() == getStackDepth()) {
if (desc.getPosition() == getPosition()) {
return true;
}
} }
} }
} }
return false;
} }
} }
return super.equals(varObj); return super.equals(varDesc);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getVariableDescriptorAsArray(org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor, int, int)
*/
public ICDIVariableDescriptor getVariableDescriptorAsArray(int start, int length) throws CDIException {
Session session = (Session)getTarget().getSession();
VariableManager mgr = session.getVariableManager();
return mgr.getVariableDescriptorAsArray(this, start, length);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getVariableDescriptorAsType(org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor, java.lang.String)
*/
public ICDIVariableDescriptor getVariableDescriptorAsType(String type) throws CDIException {
Session session = (Session)getTarget().getSession();
VariableManager mgr = session.getVariableManager();
return mgr.getVariableDescriptorAsType(this, type);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#createVariable()
*/
public ICDIVariable createVariable() throws CDIException {
Session session = (Session)getTarget().getSession();
VariableManager mgr = session.getVariableManager();
return mgr.createVariable(this);
}
} }

View file

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

View file

@ -11,9 +11,9 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType; 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.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -24,7 +24,7 @@ public class ArrayType extends DerivedType implements ICDIArrayType {
/** /**
* @param typename * @param typename
*/ */
public ArrayType(ICDIStackFrame frame, String typename,int dim) { public ArrayType(StackFrame frame, String typename,int dim) {
super(frame, typename); super(frame, typename);
dimension = dim; dimension = dim;
} }

View file

@ -12,14 +12,15 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIVariableManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; 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.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue; 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.Session;
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
import org.eclipse.cdt.debug.mi.core.cdi.model.Register; import org.eclipse.cdt.debug.mi.core.cdi.model.Register;
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
import org.eclipse.cdt.debug.mi.core.cdi.model.VariableDescriptor;
/** /**
* Enter type comment. * Enter type comment.
@ -72,8 +73,8 @@ public class ArrayValue extends DerivedValue implements ICDIArrayValue {
//String subarray = "*(" + variable.getName() + "+" + index + ")@" + length; //String subarray = "*(" + variable.getName() + "+" + index + ")@" + length;
ICDITarget target = getTarget(); ICDITarget target = getTarget();
Session session = (Session) (target.getSession()); Session session = (Session) (target.getSession());
ICDIVariableManager mgr = session.getVariableManager(); VariableManager mgr = session.getVariableManager();
ICDIVariableObject vo = mgr.getVariableObjectAsArray(variable, index, length); ICDIVariableDescriptor vo = mgr.getVariableDescriptorAsArray(variable, index, length);
return mgr.createVariable(vo).getValue().getVariables(); return mgr.createVariable((VariableDescriptor)vo).getValue().getVariables();
} }
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class BoolType extends IntegralType implements ICDIBoolType {
/** /**
* @param typename * @param typename
*/ */
public BoolType(ICDIStackFrame frame, String typename) { public BoolType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public BoolType(ICDIStackFrame frame, String typename, boolean usigned) { public BoolType(StackFrame frame, String typename, boolean usigned) {
super(frame, typename, usigned); super(frame, typename, usigned);
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class CharType extends IntegralType implements ICDICharType {
/** /**
* @param typename * @param typename
*/ */
public CharType(ICDIStackFrame frame, String typename) { public CharType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public CharType(ICDIStackFrame frame, String typename, boolean usigned) { public CharType(StackFrame frame, String typename, boolean usigned) {
super(frame, typename, usigned); super(frame, typename, usigned);
} }
} }

View file

@ -12,11 +12,11 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; 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.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SourceManager; import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
/** /**
@ -25,7 +25,7 @@ public abstract class DerivedType extends Type implements ICDIDerivedType {
ICDIType derivedType; ICDIType derivedType;
public DerivedType(ICDIStackFrame frame, String typename) { public DerivedType(StackFrame frame, String typename) {
super(frame, typename); super(frame, typename);
} }
@ -38,17 +38,17 @@ public abstract class DerivedType extends Type implements ICDIDerivedType {
Session session = (Session)target.getSession(); Session session = (Session)target.getSession();
SourceManager sourceMgr = session.getSourceManager(); SourceManager sourceMgr = session.getSourceManager();
try { try {
derivedType = sourceMgr.getType(getStackFrame(), name); derivedType = sourceMgr.getType((StackFrame)getStackFrame(), name);
} catch (CDIException e) { } catch (CDIException e) {
// Try after ptype. // Try after ptype.
try { try {
String ptype = sourceMgr.getDetailTypeName(getStackFrame(), name); String ptype = sourceMgr.getDetailTypeName((StackFrame)getStackFrame(), name);
derivedType = sourceMgr.getType(getStackFrame(), ptype); derivedType = sourceMgr.getType((StackFrame)getStackFrame(), ptype);
} catch (CDIException ex) { } catch (CDIException ex) {
} }
} }
if (derivedType == null) { if (derivedType == null) {
derivedType = new IncompleteType(getStackFrame(), name); derivedType = new IncompleteType((StackFrame)getStackFrame(), name);
} }
} }
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class DoubleType extends FloatingPointType implements ICDIDoubleType {
/** /**
* @param typename * @param typename
*/ */
public DoubleType(ICDIStackFrame frame, String typename) { public DoubleType(StackFrame frame, String typename) {
this(frame, typename, false, false, false); this(frame, typename, false, false, false);
} }
public DoubleType(ICDIStackFrame frame, String typename, boolean isComplex, boolean isImg, boolean isLong) { public DoubleType(StackFrame frame, String typename, boolean isComplex, boolean isImg, boolean isLong) {
super(frame, typename, isComplex, isImg, isLong); super(frame, typename, isComplex, isImg, isLong);
} }
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class EnumType extends IntegralType implements ICDIEnumType {
/** /**
* @param typename * @param typename
*/ */
public EnumType(ICDIStackFrame frame, String typename) { public EnumType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public EnumType(ICDIStackFrame frame, String typename, boolean usigned) { public EnumType(StackFrame frame, String typename, boolean usigned) {
super(frame, typename, usigned); super(frame, typename, usigned);
} }
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class FloatType extends FloatingPointType implements ICDIFloatType {
/** /**
* @param typename * @param typename
*/ */
public FloatType(ICDIStackFrame frame, String typename) { public FloatType(StackFrame frame, String typename) {
this(frame, typename, false, false); this(frame, typename, false, false);
} }
public FloatType(ICDIStackFrame frame, String typename, boolean isComplex, boolean isImg) { public FloatType(StackFrame frame, String typename, boolean isComplex, boolean isImg) {
super(frame, typename, isComplex, isImg, false); super(frame, typename, isComplex, isImg, false);
} }
} }

View file

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

View file

@ -11,9 +11,9 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType; 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.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,7 +21,7 @@ public class FunctionType extends DerivedType implements ICDIFunctionType {
String params = ""; //$NON-NLS-1$ String params = ""; //$NON-NLS-1$
public FunctionType(ICDIStackFrame frame, String typename) { public FunctionType(StackFrame frame, String typename) {
super(frame, typename); super(frame, typename);
} }

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -20,7 +20,7 @@ public class IncompleteType extends Type {
/** /**
* @param name * @param name
*/ */
public IncompleteType(ICDIStackFrame frame, String name) { public IncompleteType(StackFrame frame, String name) {
super(frame, name); super(frame, name);
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class IntType extends IntegralType implements ICDIIntType {
/** /**
* @param typename * @param typename
*/ */
public IntType(ICDIStackFrame frame, String typename) { public IntType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public IntType(ICDIStackFrame frame, String typename, boolean isUnsigned) { public IntType(StackFrame frame, String typename, boolean isUnsigned) {
super(frame, typename, isUnsigned); super(frame, typename, isUnsigned);
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -20,7 +20,7 @@ public abstract class IntegralType extends Type implements ICDIIntegralType {
boolean unSigned; boolean unSigned;
public IntegralType(ICDIStackFrame frame, String typename, boolean isUnsigned) { public IntegralType(StackFrame frame, String typename, boolean isUnsigned) {
super(frame, typename); super(frame, typename);
unSigned = isUnsigned; unSigned = isUnsigned;
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class LongLongType extends IntegralType implements ICDILongLongType {
/** /**
* @param typename * @param typename
*/ */
public LongLongType(ICDIStackFrame frame, String typename) { public LongLongType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public LongLongType(ICDIStackFrame frame, String typename, boolean usigned) { public LongLongType(StackFrame frame, String typename, boolean usigned) {
super(frame, typename, usigned); super(frame, typename, usigned);
} }
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class LongType extends IntegralType implements ICDILongType {
/** /**
* @param typename * @param typename
*/ */
public LongType(ICDIStackFrame frame, String typename) { public LongType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public LongType(ICDIStackFrame frame, String typename, boolean usigned) { public LongType(StackFrame frame, String typename, boolean usigned) {
super(frame, typename, usigned); super(frame, typename, usigned);
} }
} }

View file

@ -11,15 +11,15 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType; 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.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
public class PointerType extends DerivedType implements ICDIPointerType { public class PointerType extends DerivedType implements ICDIPointerType {
public PointerType(ICDIStackFrame frame, String typename) { public PointerType(StackFrame frame, String typename) {
super(frame, typename); super(frame, typename);
} }

View file

@ -11,9 +11,9 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType; 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.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -22,7 +22,7 @@ public class ReferenceType extends DerivedType implements ICDIReferenceType {
/** /**
* @param name * @param name
*/ */
public ReferenceType(ICDIStackFrame frame, String name) { public ReferenceType(StackFrame frame, String name) {
super(frame, name); super(frame, name);
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,11 +21,11 @@ public class ShortType extends IntegralType implements ICDIShortType {
/** /**
* @param typename * @param typename
*/ */
public ShortType(ICDIStackFrame frame, String typename) { public ShortType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public ShortType(ICDIStackFrame frame, String typename, boolean usigned) { public ShortType(StackFrame frame, String typename, boolean usigned) {
super(frame, typename, usigned); super(frame, typename, usigned);
} }
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -21,7 +21,7 @@ public class StructType extends AggregateType implements ICDIStructType {
/** /**
* @param typename * @param typename
*/ */
public StructType(ICDIStackFrame frame, String typename) { public StructType(StackFrame frame, String typename) {
super(frame, typename); super(frame, typename);
} }

View file

@ -14,17 +14,18 @@ package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.mi.core.cdi.model.CObject; import org.eclipse.cdt.debug.mi.core.cdi.model.CObject;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
/** /**
*/ */
public abstract class Type extends CObject implements ICDIType { public abstract class Type extends CObject implements ICDIType {
ICDIStackFrame fStackFrame; StackFrame fStackFrame;
String typename; String typename;
String detailName; String detailName;
public Type(ICDIStackFrame frame, String name) { public Type(StackFrame frame, String name) {
super((Target)frame.getTarget()); super((Target)frame.getTarget());
typename = name; typename = name;
fStackFrame = frame; fStackFrame = frame;

View file

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

View file

@ -12,8 +12,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIWCharType;
import org.eclipse.cdt.debug.mi.core.cdi.model.StackFrame;
/** /**
*/ */
@ -22,11 +22,11 @@ public class WCharType extends IntegralType implements ICDIWCharType {
/** /**
* @param typename * @param typename
*/ */
public WCharType(ICDIStackFrame frame, String typename) { public WCharType(StackFrame frame, String typename) {
this(frame, typename, false); this(frame, typename, false);
} }
public WCharType(ICDIStackFrame frame, String typename, boolean usigned) { public WCharType(StackFrame frame, String typename, boolean usigned) {
super(frame, typename, usigned); super(frame, typename, usigned);
} }
} }

View file

@ -246,7 +246,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
protected String renderDebuggerProcessLabel() { protected String renderDebuggerProcessLabel() {
String format = "{0} ({1})"; //$NON-NLS-1$ String format = "{0} ({1})"; //$NON-NLS-1$
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis())); String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
String message = MIPlugin.getResourceString("src.GDBDebugger.Debugger_process"); String message = MIPlugin.getResourceString("src.GDBDebugger.Debugger_process"); //$NON-NLS-1$
return MessageFormat.format(format, new String[]{message, timestamp}); //$NON-NLS-1$ return MessageFormat.format(format, new String[]{message, timestamp}); //$NON-NLS-1$
} }

View file

@ -107,7 +107,7 @@ public class GDBServerCDIDebugger extends GDBCDIDebugger {
*/ */
public Session createAttachSession(ILaunchConfiguration config, IBinaryExecutable exe, IProgressMonitor monitor) public Session createAttachSession(ILaunchConfiguration config, IBinaryExecutable exe, IProgressMonitor monitor)
throws CoreException { throws CoreException {
String msg = MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_attaching_unsupported"); String msg = MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_attaching_unsupported"); //$NON-NLS-1$
throw newCoreException(msg, null); throw newCoreException(msg, null);
} }
@ -116,7 +116,7 @@ public class GDBServerCDIDebugger extends GDBCDIDebugger {
*/ */
public Session createCoreSession(ILaunchConfiguration config, IBinaryExecutable exe, IProgressMonitor monitor) public Session createCoreSession(ILaunchConfiguration config, IBinaryExecutable exe, IProgressMonitor monitor)
throws CoreException { throws CoreException {
String msg = MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_corefiles_unsupported"); String msg = MIPlugin.getResourceString("src.GDBServerDebugger.GDBServer_corefiles_unsupported"); //$NON-NLS-1$
throw newCoreException(msg, null); throw newCoreException(msg, null);
} }