mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
2004-10-25 Alain Magloire
Remove of the class ICDIExpressionManager. instead new clas ICDIExpressionManagegment that is on the ICDITarget * cdi/org/eclipse/cdt/debug/core/cdi/ICDISession.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpression.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadGroup.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpressionManagement.java * CDebugModel.java * CDIDebugModel.java * CExpression.java * CFormattedMemoryBlock.java * CStackFrame.java
This commit is contained in:
parent
1c05c517d0
commit
20c3099076
12 changed files with 141 additions and 107 deletions
|
@ -1,3 +1,17 @@
|
|||
2004-10-25 Alain Magloire
|
||||
Remove of the class ICDIExpressionManager.
|
||||
instead new clas ICDIExpressionManagegment that is on the ICDITarget
|
||||
* cdi/org/eclipse/cdt/debug/core/cdi/ICDISession.java
|
||||
* cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpression.java
|
||||
* cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIThreadGroup.java
|
||||
* cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIExpressionManagement.java
|
||||
|
||||
* CDebugModel.java
|
||||
* CDIDebugModel.java
|
||||
* CExpression.java
|
||||
* CFormattedMemoryBlock.java
|
||||
* CStackFrame.java
|
||||
|
||||
2004-10-22 Mikhail Khodjaiants
|
||||
Replaced the deprecated "evaluateExpressionTtoString" method of "ICDITarget.
|
||||
* CDebugTarget.java
|
||||
|
|
|
@ -1,50 +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.ICDIExpression;
|
||||
|
||||
/**
|
||||
*
|
||||
* Manages the collection of registered expressions in the
|
||||
* debug session.
|
||||
* Auto update is on by default.
|
||||
* @since Jul 9, 2002
|
||||
*/
|
||||
public interface ICDIExpressionManager extends ICDIManager {
|
||||
|
||||
/**
|
||||
* Returns an expression specified by the given identifier.
|
||||
*
|
||||
* @param expressionId - the expression identifier
|
||||
* @return ICDIExpression an expression specified by the given identifier
|
||||
* @throws CDIException on failure. Reasons include:
|
||||
*/
|
||||
ICDIExpression createExpression(String name) throws CDIException;
|
||||
|
||||
/**
|
||||
* Returns a collection of all registered expressions, possibly empty.
|
||||
*
|
||||
* @return an array of expressions
|
||||
* @throws CDIException on failure. Reasons include:
|
||||
*/
|
||||
ICDIExpression[] getExpressions() throws CDIException;
|
||||
|
||||
/**
|
||||
* Removes the given expression from the expression manager.
|
||||
*
|
||||
* @param expressions - the expression to remove
|
||||
* @throws CDIException on failure. Reasons include:
|
||||
*/
|
||||
void destroyExpression(ICDIExpression expression) throws CDIException;
|
||||
|
||||
}
|
|
@ -59,13 +59,6 @@ public interface ICDISession {
|
|||
*/
|
||||
ICDIVariableManager getVariableManager();
|
||||
|
||||
/**
|
||||
* Returns the expression manager of this debug session.
|
||||
*
|
||||
* @return the expression manager
|
||||
*/
|
||||
ICDIExpressionManager getExpressionManager();
|
||||
|
||||
/**
|
||||
* Returns the register manager of this debug session.
|
||||
*
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
package org.eclipse.cdt.debug.core.cdi.model;
|
||||
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
|
||||
/**
|
||||
* An expression is a snippet of code that can be evaluated to
|
||||
|
@ -19,5 +19,31 @@ package org.eclipse.cdt.debug.core.cdi.model;
|
|||
*
|
||||
* @since Jul 9, 2002
|
||||
*/
|
||||
public interface ICDIExpression extends ICDIVariable {
|
||||
public interface ICDIExpression extends ICDIObject {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the expression snippet of code.
|
||||
*
|
||||
* @return the expression
|
||||
*/
|
||||
String getExpressionText();
|
||||
|
||||
/**
|
||||
* Returns true if the variable Object are the same,
|
||||
* For example event if the name is the same because of
|
||||
* casting this may return false;
|
||||
* @return true if the same
|
||||
*/
|
||||
boolean equals(ICDIExpression expr);
|
||||
|
||||
/**
|
||||
* Returns the value of this expression.
|
||||
*
|
||||
* @param ICDIStackFrame frame context
|
||||
* @return the value of this expression
|
||||
* @throws CDIException if this method fails. Reasons include:
|
||||
*/
|
||||
ICDIValue getValue(ICDIStackFrame context) throws CDIException;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/**********************************************************************
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* ICDIExpressionManagement
|
||||
*/
|
||||
public interface ICDIExpressionManagement {
|
||||
|
||||
/**
|
||||
* Create an expression for code snippet
|
||||
* @param code
|
||||
* @return ICDIExpression
|
||||
* @throws CDIException
|
||||
*/
|
||||
ICDIExpression createExpression(String code) throws CDIException;
|
||||
|
||||
/**
|
||||
* Return all expressions for this target
|
||||
* @return
|
||||
* @throws CDIException
|
||||
*/
|
||||
ICDIExpression[] getExpressions() throws CDIException;
|
||||
|
||||
/**
|
||||
* Remove expressions for this target
|
||||
*
|
||||
* @param expressions
|
||||
*/
|
||||
void destroyExpressions(ICDIExpression[] expressions) throws CDIException;
|
||||
|
||||
/**
|
||||
* Remove all expressions on this target
|
||||
*
|
||||
*/
|
||||
void destroyAllExpressions() throws CDIException;
|
||||
}
|
|
@ -14,13 +14,9 @@ package org.eclipse.cdt.debug.core.cdi.model;
|
|||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
|
||||
/**
|
||||
* @author User
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public interface ICDIThreadGroup extends ICDIBreakpointManagement, ICDIExecuteStep, ICDIExecuteResume,
|
||||
ICDISuspend, ICDIObject {
|
||||
ICDISuspend, ICDIExpressionManagement, ICDIObject {
|
||||
|
||||
/**
|
||||
* Returns the threads contained in this target.
|
||||
|
|
|
@ -490,8 +490,9 @@ public class CDIDebugModel {
|
|||
public static IExpression createExpression(IDebugTarget target, String text) throws DebugException {
|
||||
if (target != null && target instanceof CDebugTarget) {
|
||||
try {
|
||||
ICDIExpression cdiExpression = ((CDebugTarget)target).getCDISession().getExpressionManager().createExpression(text);
|
||||
return new CExpression((CDebugTarget)target, cdiExpression);
|
||||
ICDIVariableObject vo = null;//((CDebugTarget)target).getCDISession().getVariableManager().getVariableObject(text);
|
||||
ICDIExpression cdiExpression = ((CDebugTarget)target).getCDITarget().createExpression(text);
|
||||
return new CExpression( (CDebugTarget)target, cdiExpression, vo );
|
||||
} catch (CDIException e) {
|
||||
throw new DebugException(new Status(IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED,
|
||||
e.getMessage(), null));
|
||||
|
@ -506,9 +507,10 @@ public class CDIDebugModel {
|
|||
ICDIVariableObject vo = null;
|
||||
try {
|
||||
vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject(fileName.lastSegment(),
|
||||
null, name);
|
||||
ICDIVariable cdiVariable = ((CDebugTarget)target).getCDISession().getVariableManager().createVariable(vo);
|
||||
return new CExpression((CDebugTarget)target, cdiVariable);
|
||||
null, name);
|
||||
//ICDIVariable cdiVariable = ((CDebugTarget)target).getCDISession().getVariableManager().createVariable(vo);
|
||||
ICDIExpression cdiExpression = ((CDebugTarget)target).getCDITarget().createExpression(name);
|
||||
return new CExpression((CDebugTarget)target, cdiExpression, vo);
|
||||
} catch (CDIException e) {
|
||||
throw new DebugException(new Status(IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED,
|
||||
(vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null)); //$NON-NLS-1$
|
||||
|
|
|
@ -96,8 +96,8 @@ public class CDebugModel {
|
|||
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target, String addressExpression, int format, int wordSize, int numberOfRows, int numberOfColumns, char paddingChar ) throws DebugException {
|
||||
if ( target != null && target instanceof CDebugTarget ) {
|
||||
try {
|
||||
ICDIExpression expression = ((CDebugTarget)target).getCDISession().getExpressionManager().createExpression( addressExpression );
|
||||
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession().getMemoryManager().createMemoryBlock( expression.getName(), wordSize * numberOfRows * numberOfColumns );
|
||||
ICDIExpression expression = ((CDebugTarget)target).getCDITarget().createExpression( addressExpression );
|
||||
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession().getMemoryManager().createMemoryBlock( expression.getExpressionText(), wordSize * numberOfRows * numberOfColumns );
|
||||
return new CFormattedMemoryBlock( (CDebugTarget)target, cdiMemoryBlock, expression, format, wordSize, numberOfRows, numberOfColumns, paddingChar );
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
|
@ -110,8 +110,8 @@ public class CDebugModel {
|
|||
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target, String addressExpression, int format, int wordSize, int numberOfRows, int numberOfColumns ) throws DebugException {
|
||||
if ( target != null && target instanceof CDebugTarget ) {
|
||||
try {
|
||||
ICDIExpression expression = ((CDebugTarget)target).getCDISession().getExpressionManager().createExpression( addressExpression );
|
||||
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession().getMemoryManager().createMemoryBlock( expression.getName(), wordSize * numberOfRows * numberOfColumns );
|
||||
ICDIExpression expression = ((CDebugTarget)target).getCDITarget().createExpression( addressExpression );
|
||||
ICDIMemoryBlock cdiMemoryBlock = ((CDebugTarget)target).getCDISession().getMemoryManager().createMemoryBlock( expression.getExpressionText(), wordSize * numberOfRows * numberOfColumns );
|
||||
return new CFormattedMemoryBlock( (CDebugTarget)target, cdiMemoryBlock, expression, format, wordSize, numberOfRows, numberOfColumns );
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CExpression;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
@ -36,14 +37,15 @@ public class CExpressionTarget {
|
|||
return fDebugTarget;
|
||||
}
|
||||
|
||||
public IValue evaluateExpression( String expressionText ) throws DebugException {
|
||||
public IValue evaluateExpression( ICDIStackFrame context, String expressionText ) throws DebugException {
|
||||
CExpression expression = (CExpression)fExpressions.remove( expressionText );
|
||||
if ( expression != null ) {
|
||||
expression.dispose();
|
||||
}
|
||||
expression = (CExpression)CDIDebugModel.createExpression( getDebugTarget(), expressionText );
|
||||
fExpressions.put( expressionText, expression );
|
||||
return expression.getValue();
|
||||
return expression.getValue(context);
|
||||
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
|
|
@ -12,13 +12,18 @@ package org.eclipse.cdt.debug.internal.core.model;
|
|||
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
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.model.ICDIExpression;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
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.ICDIVariableObject;
|
||||
import org.eclipse.cdt.debug.core.model.CVariableFormat;
|
||||
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
||||
import org.eclipse.cdt.debug.core.model.ICType;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IExpression;
|
||||
import org.eclipse.debug.core.model.IValue;
|
||||
|
@ -28,44 +33,22 @@ import org.eclipse.debug.core.model.IValue;
|
|||
*/
|
||||
public class CExpression extends CVariable implements IExpression {
|
||||
|
||||
/**
|
||||
* Constructor for CExpression.
|
||||
*/
|
||||
public CExpression( CDebugTarget target, ICDIExpression cdiExpression ) {
|
||||
super( target, cdiExpression );
|
||||
setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
||||
}
|
||||
ICDIExpression fCDIExpression;
|
||||
|
||||
/**
|
||||
* Constructor for CExpression.
|
||||
*/
|
||||
public CExpression( CDebugTarget target, ICDIVariableObject cdiVariableObject ) {
|
||||
super( target, cdiVariableObject );
|
||||
setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
||||
public CExpression( CDebugTarget target, ICDIExpression cdiExpression, ICDIVariableObject varObject ) {
|
||||
super( target, varObject );
|
||||
setFormat( CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ))) ;
|
||||
fCDIExpression = cdiExpression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.IExpression#getExpressionText()
|
||||
*/
|
||||
public String getExpressionText() {
|
||||
try {
|
||||
return getName();
|
||||
}
|
||||
catch( DebugException e ) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.IVariable#getValue()
|
||||
*/
|
||||
public IValue getValue() {
|
||||
try {
|
||||
return super.getValue();
|
||||
}
|
||||
catch( DebugException e ) {
|
||||
}
|
||||
return null;
|
||||
return fCDIExpression.getExpressionText();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -98,7 +81,7 @@ public class CExpression extends CVariable implements IExpression {
|
|||
* @see org.eclipse.cdt.debug.core.model.ICVariable#canEnableDisable()
|
||||
*/
|
||||
public boolean canEnableDisable() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -107,4 +90,23 @@ public class CExpression extends CVariable implements IExpression {
|
|||
protected boolean isBookkeepingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.core.model.IExpression#getValue()
|
||||
*/
|
||||
public IValue getValue() {
|
||||
CStackFrame frame = (CStackFrame)getStackFrame();
|
||||
return getValue(frame.getCDIStackFrame());
|
||||
}
|
||||
|
||||
public IValue getValue(ICDIStackFrame context) {
|
||||
try {
|
||||
ICDIValue value = fCDIExpression.getValue(context);
|
||||
return CValueFactory.createValue(this, value);
|
||||
} catch (CDIException e) {
|
||||
// TODO Auto-generated catch block
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -385,7 +385,8 @@ public class CFormattedMemoryBlock extends CDebugElement
|
|||
{
|
||||
try
|
||||
{
|
||||
((CDebugTarget)getDebugTarget()).getCDISession().getExpressionManager().destroyExpression( fAddressExpression );
|
||||
ICDIExpression[] expressions = { fAddressExpression };
|
||||
((CDebugTarget)getDebugTarget()).getCDITarget().destroyExpressions( expressions );
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
|
@ -402,7 +403,7 @@ public class CFormattedMemoryBlock extends CDebugElement
|
|||
*/
|
||||
public String getAddressExpression()
|
||||
{
|
||||
return fAddressExpression.getName();
|
||||
return fAddressExpression.getExpressionText();
|
||||
}
|
||||
|
||||
private String[] createData( byte[] bytes, int offset, int length )
|
||||
|
|
|
@ -633,7 +633,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
*/
|
||||
public IValue evaluateExpression( String expression ) throws DebugException {
|
||||
CExpressionTarget target = (CExpressionTarget)getDebugTarget().getAdapter( CExpressionTarget.class );
|
||||
return (target != null) ? target.evaluateExpression( expression ) : null;
|
||||
return (target != null) ? target.evaluateExpression( getCDIStackFrame(), expression ) : null;
|
||||
}
|
||||
|
||||
private ICGlobalVariable[] getGlobals() {
|
||||
|
|
Loading…
Add table
Reference in a new issue