1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Use the new expression API of CDI.

This commit is contained in:
Mikhail Khodjaiants 2004-10-29 21:22:18 +00:00
parent 28efe5b06a
commit cbf89ce619
17 changed files with 428 additions and 505 deletions

View file

@ -1,3 +1,19 @@
2004-10-29 Mikhail Khodjaiants
Use the new expression API of CDI.
* CDebugModel.java
* CDIDebugModel.java
* CGlobalVariableManager.java
* AbstractCValue.java
* AbstractCVariable.java
* CArrayPartition.java
* CArrayPartitionValue.java
* CDebugTarget.java
* CExpression.java
* CStackFrame.java
* CValue.java
* CVariable.java
* CExpressionTarget.java: removed
2004-10-29 Alain Magloire 2004-10-29 Alain Magloire
Remove of ICDISharedLibraryManager Remove of ICDISharedLibraryManager
* cdi/org/eclipse/cdt/debug/core/cdi/ICDISession.java * cdi/org/eclipse/cdt/debug/core/cdi/ICDISession.java

View file

@ -13,35 +13,26 @@ package org.eclipse.cdt.debug.core;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.HashMap; import java.util.HashMap;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable; import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
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.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
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.ICDIVariableObject;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
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.CExpression;
import org.eclipse.cdt.debug.internal.core.model.CVariableFactory;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
@ -49,7 +40,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -59,7 +49,6 @@ import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.core.model.IProcess;
/** /**
@ -78,115 +67,78 @@ public class CDIDebugModel {
} }
/** /**
* Creates and returns a debug target for the given CDI target, with the * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
* specified name, and associates it with the given process for console I/O. * target is added to the given launch.
* The debug target is added to the given launch.
* *
* @param launch * @param launch the launch the new debug target will be contained in
* the launch the new debug target will be contained in * @param project the project to use to persist breakpoints.
* @param project * @param cdiTarget the CDI target to create a debug target for
* the project to use to persist breakpoints. * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
* @param cdiTarget * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
* the CDI target to create a debug target for * @param file the executable to debug.
* @param name * @param allowTerminate allow terminate().
* the name to associate with this target, which will be returned * @param allowDisconnect allow disconnect().
* from <code>IDebugTarget.getName</code>. * @param stopInMain place temporary breakpoint at main()
* @param debuggeeProcess * @param resumeTarget resume target.
* the process to associate with the debug target, which will be
* returned from <code>IDebugTarget.getProcess</code>
* @param file
* the executable to debug.
* @param allowTerminate
* allow terminate().
* @param allowDisconnect
* allow disconnect().
* @param stopInMain
* place temporary breakpoint at main()
* @param resumeTarget
* resume target.
* @return a debug target * @return a debug target
* @throws DebugException * @throws DebugException
*
*/ */
public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget, public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryExecutable file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget ) throws DebugException {
final String name, final IProcess debuggeeProcess, final IBinaryExecutable file, final boolean allowTerminate,
final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget) throws DebugException {
final IDebugTarget[] target = new IDebugTarget[1]; final IDebugTarget[] target = new IDebugTarget[1];
IWorkspaceRunnable r = new IWorkspaceRunnable() { IWorkspaceRunnable r = new IWorkspaceRunnable() {
public void run(IProgressMonitor m) throws CoreException { public void run( IProgressMonitor m ) throws CoreException {
boolean stopInMain = launch.getLaunchConfiguration().getAttribute( boolean stop = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false );
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
false);
target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate,
allowDisconnect);
ICDIConfiguration config = cdiTarget.getSession().getConfiguration(); ICDIConfiguration config = cdiTarget.getSession().getConfiguration();
if (config.supportsBreakpoints() && stopInMain) { if ( config.supportsBreakpoints() && stop ) {
stopInMain((CDebugTarget)target[0]); stopInMain( (CDebugTarget)target[0] );
} }
if (config.supportsResume() && resumeTarget) { if ( config.supportsResume() && resumeTarget ) {
target[0].resume(); target[0].resume();
} }
} }
}; };
try { try {
ResourcesPlugin.getWorkspace().run(r, null); ResourcesPlugin.getWorkspace().run( r, null );
} catch (CoreException e) { }
CDebugCorePlugin.log(e); catch( CoreException e ) {
throw new DebugException(e.getStatus()); CDebugCorePlugin.log( e );
throw new DebugException( e.getStatus() );
} }
return target[0]; return target[0];
} }
/** /**
* Creates and returns a debug target for the given CDI target, with the * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
* specified name, and associates it with the given process for console I/O. * target is added to the given launch.
* The debug target is added to the given launch.
* *
* @param launch * @param launch the launch the new debug target will be contained in
* the launch the new debug target will be contained in * @param project the project to use to persist breakpoints.
* @param project * @param cdiTarget the CDI target to create a debug target for
* the project to use to persist breakpoints. * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
* @param cdiTarget * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
* the CDI target to create a debug target for * @param file the executable to debug.
* @param name * @param allowTerminate allow terminate().
* the name to associate with this target, which will be returned * @param allowDisconnect allow disconnect().
* from <code>IDebugTarget.getName</code>. * @param resumeTarget resume target.
* @param debuggeeProcess
* the process to associate with the debug target, which will be
* returned from <code>IDebugTarget.getProcess</code>
* @param file
* the executable to debug.
* @param allowTerminate
* allow terminate().
* @param allowDisconnect
* allow disconnect().
* @param resumeTarget
* resume target.
* @return a debug target * @return a debug target
* @throws DebugException * @throws DebugException
*
*/ */
public static IDebugTarget newDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget, final String name, public static IDebugTarget newDebugTarget( ILaunch launch, IProject project, ICDITarget cdiTarget, final String name, IProcess debuggeeProcess, IBinaryExecutable file, boolean allowTerminate, boolean allowDisconnect, boolean resumeTarget ) throws DebugException {
IProcess debuggeeProcess, IBinaryExecutable file, boolean allowTerminate, boolean allowDisconnect, boolean resumeTarget) return newDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, false, resumeTarget );
throws DebugException {
return newDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, false, resumeTarget);
} }
/** /**
* Creates and returns a line breakpoint for the source defined by the given * Creates and returns a line breakpoint for the source defined by the given source handle, at the given line number. The marker associated with the
* source handle, at the given line number. The marker associated with the
* breakpoint will be created on the specified resource. * breakpoint will be created on the specified resource.
* *
* @param sourceHandle * @param sourceHandle
* the handle to the breakpoint source * the handle to the breakpoint source
* @param resource * @param resource
* the resource on which to create the associated breakpoint * the resource on which to create the associated breakpoint marker
* marker
* @param lineNumber * @param lineNumber
* the line number on which the breakpoint is set - line numbers * the line number on which the breakpoint is set - line numbers are 1 based, associated with the source file in which the breakpoint is set
* are 1 based, associated with the source file in which the
* breakpoint is set
* @param enabled * @param enabled
* whether to enable or disable this breakpoint * whether to enable or disable this breakpoint
* @param ignoreCount * @param ignoreCount
@ -199,21 +151,18 @@ public class CDIDebugModel {
* @throws CoreException * @throws CoreException
* if this method fails. Reasons include: * if this method fails. Reasons include:
* <ul> * <ul>
* <li>Failure creating underlying marker. The exception's * <li>Failure creating underlying marker. The exception's status contains the underlying exception responsible for the failure.</li>
* status contains the underlying exception responsible for the
* failure.</li>
* </ul> * </ul>
*/ */
public static ICLineBreakpoint createLineBreakpoint(String sourceHandle, IResource resource, int lineNumber, boolean enabled, public static ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
int ignoreCount, String condition, boolean register) throws CoreException { HashMap attributes = new HashMap( 10 );
HashMap attributes = new HashMap(10); attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put(IBreakpoint.ID, getPluginIdentifier()); attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber)); attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put(IBreakpoint.ENABLED, new Boolean(enabled)); attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount)); attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put(ICBreakpoint.CONDITION, condition); attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle); return new CLineBreakpoint( resource, attributes, register );
return new CLineBreakpoint(resource, attributes, register);
} }
/** /**
@ -221,44 +170,34 @@ public class CDIDebugModel {
* given source handle, at the given address. The marker associated with the * given source handle, at the given address. The marker associated with the
* breakpoint will be created on the specified resource. * breakpoint will be created on the specified resource.
* *
* @param sourceHandle * @param sourceHandle the handle to the breakpoint source
* the handle to the breakpoint source * @param resource the resource on which to create the associated breakpoint marker
* @param resource * @param address the address on which the breakpoint is set
* the resource on which to create the associated breakpoint * @param enabled whether to enable or disable this breakpoint
* marker * @param ignoreCount the number of times this breakpoint will be ignored
* @param address * @param condition the breakpoint condition
* the address on which the breakpoint is set * @param register whether to add this breakpoint to the breakpoint manager
* @param enabled
* whether to enable or disable this breakpoint
* @param ignoreCount
* the number of times this breakpoint will be ignored
* @param condition
* the breakpoint condition
* @param register
* whether to add this breakpoint to the breakpoint manager
* @return an address breakpoint * @return an address breakpoint
* @throws CoreException * @throws CoreException if this method fails. Reasons include:
* if this method fails. Reasons include:
* <ul> * <ul>
* <li>Failure creating underlying marker. The exception's * <li>Failure creating underlying marker. The exception's
* status contains the underlying exception responsible for the * status contains the underlying exception responsible for the
* failure.</li> * failure.</li>
* </ul> * </ul>
*/ */
public static ICAddressBreakpoint createAddressBreakpoint(String sourceHandle, IResource resource, IAddress address, public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle, IResource resource, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException { HashMap attributes = new HashMap( 10 );
HashMap attributes = new HashMap(10); attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put(IBreakpoint.ID, getPluginIdentifier()); attributes.put( IMarker.CHAR_START, new Integer( 0 ) );
attributes.put(IMarker.CHAR_START, new Integer(0)); attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
attributes.put(IMarker.CHAR_END, new Integer(0)); attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
attributes.put(IMarker.LINE_NUMBER, new Integer(-1)); attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
attributes.put(IMarker.LINE_NUMBER, new Integer(-1)); attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
attributes.put(ICLineBreakpoint.ADDRESS, address.toHexAddressString()); attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put(IBreakpoint.ENABLED, new Boolean(enabled)); attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount)); attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put(ICBreakpoint.CONDITION, condition); attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle); return new CAddressBreakpoint( resource, attributes, register );
return new CAddressBreakpoint(resource, attributes, register);
} }
/** /**
@ -266,46 +205,34 @@ public class CDIDebugModel {
* source handle, at the given expression. The marker associated with the * source handle, at the given expression. The marker associated with the
* watchpoint will be created on the specified resource. * watchpoint will be created on the specified resource.
* *
* @param sourceHandle * @param sourceHandle the handle to the watchpoint source
* the handle to the watchpoint source * @param resource the resource on which to create the associated watchpoint marker
* @param resource * @param writeAccess whether this is write watchpoint
* the resource on which to create the associated watchpoint * @param readAccess whether this is read watchpoint
* marker * @param expression the expression on which the watchpoint is set
* @param writeAccess * @param enabled whether to enable or disable this breakpoint
* whether this is write watchpoint * @param ignoreCount the number of times this breakpoint will be ignored
* @param readAccess * @param condition the breakpoint condition
* whether this is read watchpoint * @param register whether to add this breakpoint to the breakpoint manager
* @param expression
* the expression on which the watchpoint is set
* @param enabled
* whether to enable or disable this breakpoint
* @param ignoreCount
* the number of times this breakpoint will be ignored
* @param condition
* the breakpoint condition
* @param register
* whether to add this breakpoint to the breakpoint manager
* @return a watchpoint * @return a watchpoint
* @throws CoreException * @throws CoreException if this method fails. Reasons include:
* if this method fails. Reasons include:
* <ul> * <ul>
* <li>Failure creating underlying marker. The exception's * <li>Failure creating underlying marker. The exception's
* status contains the underlying exception responsible for the * status contains the underlying exception responsible for the
* failure.</li> * failure.</li>
* </ul> * </ul>
*/ */
public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
String expression, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException { HashMap attributes = new HashMap( 10 );
HashMap attributes = new HashMap(10); attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put(IBreakpoint.ID, getPluginIdentifier()); attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put(IBreakpoint.ENABLED, new Boolean(enabled)); attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount)); attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put(ICBreakpoint.CONDITION, condition); attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle); attributes.put( ICWatchpoint.EXPRESSION, expression );
attributes.put(ICWatchpoint.EXPRESSION, expression); attributes.put( ICWatchpoint.READ, new Boolean( readAccess ) );
attributes.put(ICWatchpoint.READ, new Boolean(readAccess)); attributes.put( ICWatchpoint.WRITE, new Boolean( writeAccess ) );
attributes.put(ICWatchpoint.WRITE, new Boolean(writeAccess)); return new CWatchpoint( resource, attributes, register );
return new CWatchpoint(resource, attributes, register);
} }
/** /**
@ -313,56 +240,42 @@ public class CDIDebugModel {
* name. The marker associated with the breakpoint will be created on the * name. The marker associated with the breakpoint will be created on the
* specified resource. * specified resource.
* *
* @param sourceHandle * @param sourceHandle the handle to the breakpoint source
* the handle to the breakpoint source * @param resource the resource on which to create the associated breakpoint marker
* @param resource * @param function the name of the function this breakpoint suspends execution in
* the resource on which to create the associated breakpoint * @param charStart the first character index associated with the breakpoint, or
* marker
* @param function
* the name of the function this breakpoint suspends execution in
* @param charStart
* the first character index associated with the breakpoint, or
* -1 if unspecified, in the source file in which the breakpoint * -1 if unspecified, in the source file in which the breakpoint
* is set * is set
* @param charEnd * @param charEnd the last character index associated with the breakpoint, or -1
* the last character index associated with the breakpoint, or -1
* if unspecified, in the source file in which the breakpoint is * if unspecified, in the source file in which the breakpoint is
* set * set
* @param lineNumber * @param lineNumber the lineNumber on which the breakpoint is set, or -1 if
* the lineNumber on which the breakpoint is set, or -1 if
* unspecified - line numbers are 1 based, associated with the * unspecified - line numbers are 1 based, associated with the
* source file in which the breakpoint is set * source file in which the breakpoint is set
* @param enabled * @param enabled whether to enable or disable this breakpoint
* whether to enable or disable this breakpoint * @param ignoreCount the number of times this breakpoint will be ignored
* @param ignoreCount * @param condition the breakpoint condition
* the number of times this breakpoint will be ignored * @param register whether to add this breakpoint to the breakpoint manager
* @param condition
* the breakpoint condition
* @param register
* whether to add this breakpoint to the breakpoint manager
* @return an address breakpoint * @return an address breakpoint
* @throws CoreException * @throws CoreException if this method fails. Reasons include:
* if this method fails. Reasons include:
* <ul> * <ul>
* <li>Failure creating underlying marker. The exception's * <li>Failure creating underlying marker. The exception's
* status contains the underlying exception responsible for the * status contains the underlying exception responsible for the
* failure.</li> * failure.</li>
* </ul> * </ul>
*/ */
public static ICFunctionBreakpoint createFunctionBreakpoint(String sourceHandle, IResource resource, String function, public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register) HashMap attributes = new HashMap( 10 );
throws CoreException { attributes.put( IBreakpoint.ID, getPluginIdentifier() );
HashMap attributes = new HashMap(10); attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
attributes.put(IBreakpoint.ID, getPluginIdentifier()); attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
attributes.put(IMarker.CHAR_START, new Integer(charStart)); attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put(IMarker.CHAR_END, new Integer(charEnd)); attributes.put( ICLineBreakpoint.FUNCTION, function );
attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber)); attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put(ICLineBreakpoint.FUNCTION, function); attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put(IBreakpoint.ENABLED, new Boolean(enabled)); attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount)); attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
attributes.put(ICBreakpoint.CONDITION, condition); return new CFunctionBreakpoint( resource, attributes, register );
attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
return new CFunctionBreakpoint(resource, attributes, register);
} }
/** /**
@ -370,32 +283,26 @@ public class CDIDebugModel {
* breakpoint manager for a source with the given handle and the given * breakpoint manager for a source with the given handle and the given
* resource at the given line number. * resource at the given line number.
* *
* @param sourceHandle * @param sourceHandle the source handle
* the source handle * @param resource the breakpoint resource
* @param resource * @param lineNumber the line number
* the breakpoint resource
* @param lineNumber
* the line number
* @return the line breakpoint that is already registered with the * @return the line breakpoint that is already registered with the
* breakpoint manager or <code>null</code> if no such breakpoint * breakpoint manager or <code>null</code> if no such breakpoint
* is registered * is registered
* @exception CoreException * @exception CoreException if unable to retrieve the associated marker attributes (line number).
* if unable to retrieve the associated marker attributes
* (line number).
*/ */
public static ICLineBreakpoint lineBreakpointExists(String sourceHandle, IResource resource, int lineNumber) public static ICLineBreakpoint lineBreakpointExists( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
throws CoreException {
String modelId = getPluginIdentifier(); String modelId = getPluginIdentifier();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints(modelId); IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for (int i = 0; i < breakpoints.length; i++) { for( int i = 0; i < breakpoints.length; i++ ) {
if (! (breakpoints[i] instanceof ICLineBreakpoint)) { if ( !(breakpoints[i] instanceof ICLineBreakpoint) ) {
continue; continue;
} }
ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i]; ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
if (sourceHandle != null && sourceHandle.equals(breakpoint.getSourceHandle())) { if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
if (breakpoint.getMarker().getResource().equals(resource)) { if ( breakpoint.getMarker().getResource().equals( resource ) ) {
if (breakpoint.getLineNumber() == lineNumber) { if ( breakpoint.getLineNumber() == lineNumber ) {
return breakpoint; return breakpoint;
} }
} }
@ -409,33 +316,28 @@ public class CDIDebugModel {
* manager for a source with the given handle and the given resource at the * manager for a source with the given handle and the given resource at the
* given expression. * given expression.
* *
* @param sourceHandle * @param sourceHandle the source handle
* the source handle * @param resource the breakpoint resource
* @param resource * @param expression the expression
* the breakpoint resource
* @param expression
* the expression
* @return the watchpoint that is already registered with the breakpoint * @return the watchpoint that is already registered with the breakpoint
* manager or <code>null</code> if no such watchpoint is * manager or <code>null</code> if no such watchpoint is
* registered * registered
* @exception CoreException * @exception CoreException if unable to retrieve the associated marker attributes (line number).
* if unable to retrieve the associated marker attributes
* (line number).
*/ */
public static ICWatchpoint watchpointExists(String sourceHandle, IResource resource, String expression) throws CoreException { public static ICWatchpoint watchpointExists( String sourceHandle, IResource resource, String expression ) throws CoreException {
String modelId = getPluginIdentifier(); String modelId = getPluginIdentifier();
String markerType = CWatchpoint.getMarkerType(); String markerType = CWatchpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints(modelId); IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for (int i = 0; i < breakpoints.length; i++) { for( int i = 0; i < breakpoints.length; i++ ) {
if (! (breakpoints[i] instanceof ICWatchpoint)) { if ( !(breakpoints[i] instanceof ICWatchpoint) ) {
continue; continue;
} }
ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i]; ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i];
if (breakpoint.getMarker().getType().equals(markerType)) { if ( breakpoint.getMarker().getType().equals( markerType ) ) {
if (sourceHandle != null && sourceHandle.equals(breakpoint.getSourceHandle())) { if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
if (breakpoint.getMarker().getResource().equals(resource)) { if ( breakpoint.getMarker().getResource().equals( resource ) ) {
if (breakpoint.getExpression().equals(expression)) { if ( breakpoint.getExpression().equals( expression ) ) {
return breakpoint; return breakpoint;
} }
} }
@ -450,34 +352,28 @@ public class CDIDebugModel {
* breakpoint manager for a source with the given handle and the given * breakpoint manager for a source with the given handle and the given
* resource with the given function name. * resource with the given function name.
* *
* @param sourceHandle * @param sourceHandle the source handle
* the source handle * @param resource the breakpoint resource
* @param resource * @param function the fully qualified function name
* the breakpoint resource
* @param function
* the fully qualified function name
* @return the breakpoint that is already registered with the breakpoint * @return the breakpoint that is already registered with the breakpoint
* manager or <code>null</code> if no such breakpoint is * manager or <code>null</code> if no such breakpoint is
* registered * registered
* @exception CoreException * @exception CoreException if unable to retrieve the associated marker attributes (line number).
* if unable to retrieve the associated marker attributes
* (line number).
*/ */
public static ICFunctionBreakpoint functionBreakpointExists(String sourceHandle, IResource resource, String function) public static ICFunctionBreakpoint functionBreakpointExists( String sourceHandle, IResource resource, String function ) throws CoreException {
throws CoreException {
String modelId = getPluginIdentifier(); String modelId = getPluginIdentifier();
String markerType = CFunctionBreakpoint.getMarkerType(); String markerType = CFunctionBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints(modelId); IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for (int i = 0; i < breakpoints.length; i++) { for( int i = 0; i < breakpoints.length; i++ ) {
if (! (breakpoints[i] instanceof ICFunctionBreakpoint)) { if ( !(breakpoints[i] instanceof ICFunctionBreakpoint) ) {
continue; continue;
} }
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i]; ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
if (breakpoint.getMarker().getType().equals(markerType)) { if ( breakpoint.getMarker().getType().equals( markerType ) ) {
if (sourceHandle != null && sourceHandle.equals(breakpoint.getSourceHandle())) { if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
if (breakpoint.getMarker().getResource().equals(resource)) { if ( breakpoint.getMarker().getResource().equals( resource ) ) {
if (breakpoint.getFunction() != null && breakpoint.getFunction().equals(function)) { if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( function ) ) {
return breakpoint; return breakpoint;
} }
} }
@ -487,136 +383,59 @@ public class CDIDebugModel {
return null; return null;
} }
public static IExpression createExpression(IDebugTarget target, String text) throws DebugException { protected static void stopInMain( CDebugTarget target ) throws DebugException {
if (target != null && target instanceof CDebugTarget) { ICDILocation location = target.getCDITarget().createLocation( "", "main", 0 ); //$NON-NLS-1$ //$NON-NLS-2$
try {
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));
}
}
return null;
}
public static IExpression createExpressionForGlobalVariable(IDebugTarget target, IPath fileName, String name)
throws DebugException {
if (target != null && target instanceof CDebugTarget) {
ICDIVariableObject vo = null;
try {
vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject(fileName.lastSegment(),
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$
}
}
return null;
}
public static ICGlobalVariable createGlobalVariable(IDebugTarget target, IGlobalVariableDescriptor info) throws DebugException {
if (target != null && target instanceof CDebugTarget) {
ICDIVariableObject vo = null;
try {
vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject(
info.getPath().lastSegment(),
null, info.getName());
return CVariableFactory.createGlobalVariable((CDebugTarget)target, info, 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$
}
}
return null;
}
protected static void stopInMain(CDebugTarget target) throws DebugException {
ICDILocation location = target.getCDITarget().createLocation("", "main", 0); //$NON-NLS-1$ //$NON-NLS-2$
try { try {
target.setInternalTemporaryBreakpoint(location); target.setInternalTemporaryBreakpoint( location );
} catch (DebugException e) { }
String message = MessageFormat.format( catch( DebugException e ) {
DebugCoreMessages.getString("CDebugModel.0"), new String[]{e.getStatus().getMessage()}); //$NON-NLS-1$ String message = MessageFormat.format( DebugCoreMessages.getString( "CDebugModel.0" ), new String[]{ e.getStatus().getMessage() } ); //$NON-NLS-1$
IStatus newStatus = new Status(IStatus.WARNING, e.getStatus().getPlugin(), IStatus newStatus = new Status( IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null );
ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null); if ( !CDebugUtils.question( newStatus, target ) ) {
if (!CDebugUtils.question(newStatus, target)) {
target.terminate(); target.terminate();
throw new DebugException(new Status(IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), throw new DebugException( new Status( IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null ) );
e.getStatus().getMessage(), null));
} }
} }
} }
/** /**
* @param launch
* @param target
* @param string
* @param iprocess
* @param debuggerProcess
* @param exeFile
* @param b
* @param c
* @param stopInMain
* @throws CoreException
* @deprecated * @deprecated
*/ */
public static IDebugTarget newDebugTarget(ILaunch launch, ICDITarget target, String name, IProcess iprocess, public static IDebugTarget newDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess iprocess, IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain ) throws CoreException {
IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain) IBinaryExecutable exeFile = getBinary( file );
throws CoreException { return newDebugTarget( launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, allowDisconnect, stopInMain, true );
IBinaryExecutable exeFile = getBinary(file);
return newDebugTarget(launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, allowDisconnect,
stopInMain, true);
} }
/** /**
* @param launch
* @param target
* @param name
* @param debuggerProcess
* @param exeFile
* @throws CoreException
* @deprecated * @deprecated
*/ */
public static IDebugTarget newAttachDebugTarget(ILaunch launch, ICDITarget target, String name, IProcess debuggerProcess, public static IDebugTarget newAttachDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess debuggerProcess, IFile file ) throws CoreException {
IFile file) throws CoreException { IBinaryExecutable exeFile = getBinary( file );
IBinaryExecutable exeFile = getBinary(file); return newDebugTarget( launch, file.getProject(), target, name, null, exeFile, true, true, false );
return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, true, false);
} }
/** /**
* @param launch
* @param currentTarget
* @param string
* @param iprocess
* @param exeFile
* @throws CoreException
* @deprecated * @deprecated
*/ */
public static IDebugTarget newCoreFileDebugTarget(final ILaunch launch, final ICDITarget target, final String name, public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, final ICDITarget target, final String name, final IProcess debuggerProcess, final IFile file ) throws CoreException {
final IProcess debuggerProcess, final IFile file) throws CoreException { IBinaryExecutable exeFile = getBinary( file );
IBinaryExecutable exeFile = getBinary(file); return newDebugTarget( launch, file.getProject(), target, name, null, exeFile, true, false, false );
return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, false, false);
} }
private static IBinaryExecutable getBinary(IFile file) throws CoreException { private static IBinaryExecutable getBinary( IFile file ) throws CoreException {
IProject project = file.getProject(); IProject project = file.getProject();
ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions(project); ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions( project );
for (int i = 0; i < binaryParsersExt.length; i++) { for( int i = 0; i < binaryParsersExt.length; i++ ) {
IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension(); IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension();
try { try {
IBinaryFile exe = parser.getBinary(file.getLocation()); IBinaryFile exe = parser.getBinary( file.getLocation() );
if (exe instanceof IBinaryExecutable) { if ( exe instanceof IBinaryExecutable ) {
return (IBinaryExecutable)exe; return (IBinaryExecutable)exe;
} }
} catch (IOException e) { }
catch( IOException e ) {
} }
} }
throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, throw new CoreException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, DebugCoreMessages.getString( "CDIDebugModel.0" ), null ) ); //$NON-NLS-1$
DebugCoreMessages.getString("CDIDebugModel.0"), null)); //$NON-NLS-1$
} }
} }

View file

@ -77,22 +77,6 @@ public class CDebugModel {
return CDIDebugModel.newCoreFileDebugTarget( launch, cdiTarget, name, debuggerProcess, file ); return CDIDebugModel.newCoreFileDebugTarget( launch, cdiTarget, name, debuggerProcess, file );
} }
/**
* @deprecated
* Use {@link CDIDebugModel#createExpression(IDebugTarget, String)}.
*/
public static IExpression createExpression( IDebugTarget target, String text ) throws DebugException {
return CDIDebugModel.createExpression( target, text );
}
/**
* @deprecated
* Use {@link CDIDebugModel#createExpressionForGlobalVariable(IDebugTarget, IPath, String)}.
*/
public static IExpression createExpressionForGlobalVariable( IDebugTarget target, IPath fileName, String name ) throws DebugException {
return CDIDebugModel.createExpressionForGlobalVariable( target, fileName, name );
}
public static IFormattedMemoryBlock createFormattedMemoryBlock( IDebugTarget target, String addressExpression, int format, int wordSize, int numberOfRows, int numberOfColumns, char paddingChar ) throws DebugException { 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 ) { if ( target != null && target instanceof CDebugTarget ) {
try { try {

View file

@ -1,58 +0,0 @@
/**********************************************************************
* Copyright (c) 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.internal.core;
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;
import org.eclipse.debug.core.model.IValue;
/**
* Implements the expression evaluation target.
*/
public class CExpressionTarget {
private CDebugTarget fDebugTarget;
private Map fExpressions = null;
public CExpressionTarget( CDebugTarget target ) {
fDebugTarget = target;
fExpressions = new HashMap( 10 );
}
public CDebugTarget getDebugTarget() {
return fDebugTarget;
}
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(context);
}
public void dispose() {
Iterator it = fExpressions.values().iterator();
while( it.hasNext() ) {
((CExpression)it.next()).dispose();
}
fExpressions.clear();
}
}

View file

@ -20,7 +20,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerException;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
@ -102,7 +101,7 @@ public class CGlobalVariableManager implements ICGlobalVariableManager {
ArrayList globals = new ArrayList( descriptors.length ); ArrayList globals = new ArrayList( descriptors.length );
for ( int i = 0; i < descriptors.length; ++i ) { for ( int i = 0; i < descriptors.length; ++i ) {
try { try {
globals.add( CDIDebugModel.createGlobalVariable( getDebugTarget(), descriptors[i] ) ); globals.add( getDebugTarget().createGlobalVariable( descriptors[i] ) );
} }
catch( DebugException e ) { catch( DebugException e ) {
ms.add( e.getStatus() ); ms.add( e.getStatus() );

View file

@ -60,4 +60,6 @@ public abstract class AbstractCValue extends CDebugElement implements ICValue {
abstract public void dispose(); abstract public void dispose();
abstract protected void reset(); abstract protected void reset();
abstract protected void preserve();
} }

View file

@ -75,4 +75,6 @@ public abstract class AbstractCVariable extends CDebugElement implements ICVaria
protected abstract void resetValue(); protected abstract void resetValue();
protected abstract void setChanged( boolean changed ); protected abstract void setChanged( boolean changed );
protected abstract void preserve();
} }

View file

@ -339,4 +339,15 @@ public class CArrayPartition extends AbstractCVariable {
fArrayPartitionValue.setChanged( changed ); fArrayPartitionValue.setChanged( changed );
} }
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#preserve()
*/
protected void preserve() {
setChanged( false );
resetStatus();
if ( fArrayPartitionValue != null ) {
fArrayPartitionValue.preserve();
}
}
} }

View file

@ -155,4 +155,15 @@ public class CArrayPartitionValue extends AbstractCValue {
public ICType getType() throws DebugException { public ICType getType() throws DebugException {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#preserve()
*/
protected void preserve() {
resetStatus();
Iterator it = fVariables.iterator();
while( it.hasNext() ) {
((AbstractCVariable)it.next()).preserve();
}
}
} }

View file

@ -22,6 +22,7 @@ import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable; import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; 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.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugModel; import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.CDebugUtils;
@ -58,6 +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.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;
@ -65,6 +67,7 @@ import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICDebugElement; import org.eclipse.cdt.debug.core.model.ICDebugElement;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICSharedLibrary; import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
import org.eclipse.cdt.debug.core.model.ICSignal; import org.eclipse.cdt.debug.core.model.ICSignal;
@ -78,7 +81,6 @@ import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.CBreakpointManager; import org.eclipse.cdt.debug.internal.core.CBreakpointManager;
import org.eclipse.cdt.debug.internal.core.CExpressionTarget;
import org.eclipse.cdt.debug.internal.core.CExtendedMemoryBlockRetrieval; import org.eclipse.cdt.debug.internal.core.CExtendedMemoryBlockRetrieval;
import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager; import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager;
import org.eclipse.cdt.debug.internal.core.CMemoryManager; import org.eclipse.cdt.debug.internal.core.CMemoryManager;
@ -184,11 +186,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*/ */
private CBreakpointManager fBreakpointManager; private CBreakpointManager fBreakpointManager;
/**
* The expression evaluation target.
*/
private CExpressionTarget fExpressionTarget;
/** /**
* The global variable manager for this target. * The global variable manager for this target.
*/ */
@ -860,8 +857,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return getSignalManager(); return getSignalManager();
if ( adapter.equals( ICRegisterManager.class ) ) if ( adapter.equals( ICRegisterManager.class ) )
return getRegisterManager(); return getRegisterManager();
if ( adapter.equals( CExpressionTarget.class ) )
return getExpressionTarget();
if ( adapter.equals( ICGlobalVariableManager.class ) ) if ( adapter.equals( ICGlobalVariableManager.class ) )
return getGlobalVariableManager(); return getGlobalVariableManager();
if ( adapter.equals( ICDISession.class ) ) if ( adapter.equals( ICDISession.class ) )
@ -1046,7 +1041,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
disposeDisassembly(); disposeDisassembly();
disposeSourceManager(); disposeSourceManager();
disposeBreakpointManager(); disposeBreakpointManager();
disposeExpresionTarget();
removeAllExpressions(); removeAllExpressions();
disposePreferences(); disposePreferences();
} }
@ -1648,13 +1642,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
} }
} }
private void disposeExpresionTarget() {
if ( fExpressionTarget != null ) {
fExpressionTarget.dispose();
fExpressionTarget = null;
}
}
public IFile getCurrentBreakpointFile() { public IFile getCurrentBreakpointFile() {
Object info = getCurrentStateInfo(); Object info = getCurrentStateInfo();
if ( info instanceof ICDIBreakpointHit ) { if ( info instanceof ICDIBreakpointHit ) {
@ -1822,13 +1809,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
fPreferences.removePropertyChangeListener( listener ); fPreferences.removePropertyChangeListener( listener );
} }
protected CExpressionTarget getExpressionTarget() {
if ( fExpressionTarget == null ) {
fExpressionTarget = new CExpressionTarget( this );
}
return fExpressionTarget;
}
protected CGlobalVariableManager getGlobalVariableManager() { protected CGlobalVariableManager getGlobalVariableManager() {
return fGlobalVariableManager; return fGlobalVariableManager;
} }
@ -1890,4 +1870,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
private void handleSymbolsLoaded( ICDISharedLibrary library ) { private void handleSymbolsLoaded( ICDISharedLibrary library ) {
getSharedLibraryManager().symbolsLoaded( library ); getSharedLibraryManager().symbolsLoaded( library );
} }
public ICGlobalVariable createGlobalVariable( IGlobalVariableDescriptor info ) throws DebugException {
ICDIVariableObject vo = null;
try {
vo = getCDISession().getVariableManager().getGlobalVariableObject( info.getPath().lastSegment(), null, info.getName() );
}
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$
}
return CVariableFactory.createGlobalVariable( this, info, vo );
}
} }

View file

@ -17,13 +17,11 @@ 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.ICDIExpression; 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.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.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.ICDIVariableObject;
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.cdt.debug.core.model.ICType;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IExpression; import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IValue;
@ -33,15 +31,20 @@ import org.eclipse.debug.core.model.IValue;
*/ */
public class CExpression extends CVariable implements IExpression { public class CExpression extends CVariable implements IExpression {
ICDIExpression fCDIExpression; private ICDIExpression fCDIExpression;
private CStackFrame fStackFrame;
private IValue fValue;
/** /**
* Constructor for CExpression. * Constructor for CExpression.
*/ */
public CExpression( CDebugTarget target, ICDIExpression cdiExpression, ICDIVariableObject varObject ) { public CExpression( CStackFrame frame, ICDIExpression cdiExpression, ICDIVariableObject varObject ) {
super( target, 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;
fStackFrame = frame;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -63,6 +66,7 @@ public class CExpression extends CVariable implements IExpression {
ICDITarget cdiTarget = source.getTarget(); ICDITarget cdiTarget = source.getTarget();
if ( getCDITarget().equals( cdiTarget ) ) { if ( getCDITarget().equals( cdiTarget ) ) {
setChanged( false ); setChanged( false );
resetValue();
} }
} }
} }
@ -96,17 +100,62 @@ public class CExpression extends CVariable implements IExpression {
*/ */
public IValue getValue() { public IValue getValue() {
CStackFrame frame = (CStackFrame)getStackFrame(); CStackFrame frame = (CStackFrame)getStackFrame();
return getValue(frame.getCDIStackFrame());
}
public IValue getValue(ICDIStackFrame context) {
try { try {
ICDIValue value = fCDIExpression.getValue(context); return getValue( frame );
return CValueFactory.createValue(this, value); }
} catch (CDIException e) { catch( DebugException e ) {
// TODO Auto-generated catch block
} }
return null; return null;
} }
protected synchronized IValue getValue( CStackFrame context ) throws DebugException {
if ( fValue == null ) {
if ( context.isSuspended() ) {
try {
ICDIValue value = fCDIExpression.getValue( context.getCDIStackFrame() );
fValue = CValueFactory.createValue( this, value );
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), null );
}
}
}
return fValue;
}
protected ICStackFrame getStackFrame() {
return fStackFrame;
}
protected void resetValue() {
if ( fValue instanceof AbstractCValue ) {
((AbstractCValue)fValue).reset();
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#getExpressionString()
*/
public String getExpressionString() throws DebugException {
return getExpressionText();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#dispose()
*/
public void dispose() {
if ( fCDIExpression != null ) {
try {
getCDITarget().destroyExpressions( new ICDIExpression[] { fCDIExpression } );
fCDIExpression = null;
}
catch( CDIException e ) {
}
}
if ( fValue instanceof AbstractCValue ) {
((AbstractCValue)fValue).dispose();
fValue = null;
}
super.dispose();
}
} }

View file

@ -17,13 +17,13 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.core.IAddressFactory;
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.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.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.ICDIVariableObject;
import org.eclipse.cdt.debug.core.model.ICGlobalVariable; import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
@ -33,7 +33,6 @@ import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IRunToAddress; import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.CExpressionTarget;
import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager; import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -75,6 +74,11 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
*/ */
private boolean fRefreshVariables = true; private boolean fRefreshVariables = true;
/**
* List of watch expressions evaluating in the context of this frame.
*/
private List fExpressions;
/** /**
* Constructor for CStackFrame. * Constructor for CStackFrame.
*/ */
@ -475,6 +479,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
protected void dispose() { protected void dispose() {
getCDISession().getEventManager().removeEventListener( this ); getCDISession().getEventManager().removeEventListener( this );
disposeAllVariables(); disposeAllVariables();
disposeExpressions();
} }
/** /**
@ -526,9 +531,21 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
while( it.hasNext() ) { while( it.hasNext() ) {
((CVariable)it.next()).dispose(); ((CVariable)it.next()).dispose();
} }
fVariables.clear();
fVariables = null; fVariables = null;
} }
protected void disposeExpressions() {
if ( fExpressions != null ) {
Iterator it = fExpressions.iterator();
while( it.hasNext() ) {
((CExpression)it.next()).dispose();
}
fExpressions.clear();
}
fExpressions = null;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress() * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress()
*/ */
@ -567,6 +584,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
protected synchronized void preserve() { protected synchronized void preserve() {
preserveVariables(); preserveVariables();
preserveExpressions();
} }
private void preserveVariables() { private void preserveVariables() {
@ -574,7 +592,18 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return; return;
Iterator it = fVariables.iterator(); Iterator it = fVariables.iterator();
while( it.hasNext() ) { while( it.hasNext() ) {
((AbstractCVariable)it.next()).setChanged( false ); AbstractCVariable av = (AbstractCVariable)it.next();
av.preserve();
}
}
private void preserveExpressions() {
if ( fExpressions == null )
return;
Iterator it = fExpressions.iterator();
while( it.hasNext() ) {
CExpression exp = (CExpression)it.next();
exp.preserve();
} }
} }
@ -631,9 +660,12 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String)
*/ */
public IValue evaluateExpression( String expression ) throws DebugException { public IValue evaluateExpression( String expressionText ) throws DebugException {
CExpressionTarget target = (CExpressionTarget)getDebugTarget().getAdapter( CExpressionTarget.class ); CExpression expression = getExpression( expressionText );
return (target != null) ? target.evaluateExpression( getCDIStackFrame(), expression ) : null; if ( expression != null ) {
return expression.getValue( this );
}
return null;
} }
private ICGlobalVariable[] getGlobals() { private ICGlobalVariable[] getGlobals() {
@ -685,4 +717,27 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
} }
private CExpression getExpression( String expressionText ) throws DebugException {
if ( fExpressions == null ) {
fExpressions = new ArrayList( 5 );
}
CExpression expression = null;
Iterator it = fExpressions.iterator();
while( it.hasNext() ) {
expression = (CExpression)it.next();
if ( expression.getExpressionText().compareTo( expressionText ) == 0 ) {
return expression;
}
}
try {
ICDIExpression cdiExpression = ((CDebugTarget)getDebugTarget()).getCDITarget().createExpression( expressionText );
expression = new CExpression( this, cdiExpression, null );
fExpressions.add( expression );
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), null );
}
return expression;
}
} }

View file

@ -84,12 +84,14 @@ 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 ) {
try { resetStatus();
fValueString = processUnderlyingValue( getUnderlyingValue() ); if ( getParentVariable().getStackFrame().isSuspended() ) {
resetStatus(); try {
} fValueString = processUnderlyingValue( getUnderlyingValue() );
catch( CDIException e ) { }
setStatus( ICDebugElementStatus.ERROR, e.getMessage() ); catch( CDIException e ) {
setStatus( ICDebugElementStatus.ERROR, e.getMessage() );
}
} }
} }
return fValueString; return fValueString;
@ -430,6 +432,7 @@ public class CValue extends AbstractCValue {
* Invalidates the string cache. * Invalidates the string cache.
*/ */
protected void reset() { protected void reset() {
resetStatus();
fValueString = null; fValueString = null;
Iterator it = fVariables.iterator(); Iterator it = fVariables.iterator();
while( it.hasNext() ) { while( it.hasNext() ) {
@ -441,4 +444,16 @@ public class CValue extends AbstractCValue {
AbstractCVariable var = getParentVariable(); AbstractCVariable var = getParentVariable();
return ( var instanceof CVariable ) ? ((CVariable)var).getType() : null; return ( var instanceof CVariable ) ? ((CVariable)var).getType() : null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.AbstractCValue#preserve()
*/
protected void preserve() {
setChanged( false );
resetStatus();
Iterator it = fVariables.iterator();
while( it.hasNext() ) {
((AbstractCVariable)it.next()).preserve();
}
}
} }

View file

@ -276,6 +276,13 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
fChanged = changed; fChanged = changed;
} }
synchronized void preserve() {
setChanged( false );
if ( fValue instanceof AbstractCValue ) {
((AbstractCValue)fValue).preserve();
}
}
CVariable getVariable() { CVariable getVariable() {
return fVariable; return fVariable;
} }
@ -737,6 +744,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
protected void resetValue() { protected void resetValue() {
InternalVariable iv = getCurrentInternalVariable(); InternalVariable iv = getCurrentInternalVariable();
if ( iv != null ) { if ( iv != null ) {
resetStatus();
iv.resetValue(); iv.resetValue();
fireChangeEvent( DebugEvent.STATE ); fireChangeEvent( DebugEvent.STATE );
} }
@ -792,4 +800,14 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
InternalVariable iv = getCurrentInternalVariable(); InternalVariable iv = getCurrentInternalVariable();
return ( iv != null ) ? iv.getQualifiedName() : null; return ( iv != null ) ? iv.getQualifiedName() : null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#preserve()
*/
protected void preserve() {
resetStatus();
InternalVariable iv = getCurrentInternalVariable();
if ( iv != null )
iv.preserve();
}
} }

View file

@ -1,3 +1,8 @@
2004-10-29 Mikhail Khodjaiants
Use the new expression API of CDI.
* CDebugUIMessages.properties
* CDTDebugModelPresentation.java
2004-10-18 Mikhail Khodjaiants 2004-10-18 Mikhail Khodjaiants
Corrupted plugin.xml. Corrupted plugin.xml.
* plugin.xml * plugin.xml

View file

@ -507,7 +507,7 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
} }
} }
if ( expression.isEnabled() ) { if ( expression.isEnabled() ) {
String valueString = DebugUIPlugin.getModelPresentation().getText( value ); String valueString = getValueText( value );
if ( valueString.length() > 0 ) { if ( valueString.length() > 0 ) {
result.append( " = " ).append( valueString ); //$NON-NLS-1$ result.append( " = " ).append( valueString ); //$NON-NLS-1$
} }
@ -542,7 +542,7 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
label.append( name.trim() ); label.append( name.trim() );
IValue value = var.getValue(); IValue value = var.getValue();
if ( value != null ) { if ( value != null ) {
String valueString = DebugUIPlugin.getModelPresentation().getText( value ); String valueString = getValueText( value );
if ( !isEmpty( valueString ) ) { if ( !isEmpty( valueString ) ) {
label.append( " = " ); //$NON-NLS-1$ label.append( " = " ); //$NON-NLS-1$
label.append( valueString ); label.append( valueString );
@ -552,7 +552,7 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
return label.toString(); return label.toString();
} }
protected String getValueText( IValue value ) throws DebugException { protected String getValueText( IValue value )/* throws DebugException*/ {
StringBuffer label = new StringBuffer(); StringBuffer label = new StringBuffer();
if ( value instanceof ICDebugElementStatus && !((ICDebugElementStatus)value).isOK() ) { if ( value instanceof ICDebugElementStatus && !((ICDebugElementStatus)value).isOK() ) {
label.append( getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.4" ), ((ICDebugElementStatus)value).getMessage() ) ); //$NON-NLS-1$ label.append( getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.4" ), ((ICDebugElementStatus)value).getMessage() ) ); //$NON-NLS-1$
@ -564,30 +564,34 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
} }
catch( DebugException e ) { catch( DebugException e ) {
} }
String valueString = value.getValueString(); try {
if ( valueString != null ) { String valueString = value.getValueString();
valueString = valueString.trim(); if ( valueString != null ) {
if ( type != null && type.isCharacter() ) { valueString = valueString.trim();
if ( valueString.length() == 0 ) if ( type != null && type.isCharacter() ) {
valueString = "."; //$NON-NLS-1$ if ( valueString.length() == 0 )
label.append( valueString ); valueString = "."; //$NON-NLS-1$
}
else if ( type != null && type.isFloatingPointType() ) {
Number floatingPointValue = CDebugUtils.getFloatingPointValue( (ICValue)value );
if ( CDebugUtils.isNaN( floatingPointValue ) )
valueString = "NAN"; //$NON-NLS-1$
if ( CDebugUtils.isPositiveInfinity( floatingPointValue ) )
valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.23" ); //$NON-NLS-1$
if ( CDebugUtils.isNegativeInfinity( floatingPointValue ) )
valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.24" ); //$NON-NLS-1$
label.append( valueString );
}
else if ( type == null || (!type.isArray() && !type.isStructure()) ) {
if ( valueString.length() > 0 ) {
label.append( valueString ); label.append( valueString );
} }
else if ( type != null && type.isFloatingPointType() ) {
Number floatingPointValue = CDebugUtils.getFloatingPointValue( (ICValue)value );
if ( CDebugUtils.isNaN( floatingPointValue ) )
valueString = "NAN"; //$NON-NLS-1$
if ( CDebugUtils.isPositiveInfinity( floatingPointValue ) )
valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.23" ); //$NON-NLS-1$
if ( CDebugUtils.isNegativeInfinity( floatingPointValue ) )
valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.24" ); //$NON-NLS-1$
label.append( valueString );
}
else if ( type == null || (!type.isArray() && !type.isStructure()) ) {
if ( valueString.length() > 0 ) {
label.append( valueString );
}
}
} }
} }
catch( DebugException e1 ) {
}
} }
return label.toString(); return label.toString();
} }

View file

@ -21,7 +21,7 @@ CDTDebugModelPresentation.6=Exit code = {0}.
CDTDebugModelPresentation.7={0} (Suspended) CDTDebugModelPresentation.7={0} (Suspended)
CDTDebugModelPresentation.8=Thread [{0}] CDTDebugModelPresentation.8=Thread [{0}]
CDTDebugModelPresentation.9=Thread [{0}] (Terminated) CDTDebugModelPresentation.9=Thread [{0}] (Terminated)
CDTDebugModelPresentation.4=\ = <Error. {0}> CDTDebugModelPresentation.4=<Error. {0}>
CDTDebugModelPresentation.10=Thread [{0}] (Stepping) CDTDebugModelPresentation.10=Thread [{0}] (Stepping)
CDTDebugModelPresentation.11=Thread [{0}] (Running) CDTDebugModelPresentation.11=Thread [{0}] (Running)
CDTDebugModelPresentation.13=: Signal ''{0}'' received. Description: {1}. CDTDebugModelPresentation.13=: Signal ''{0}'' received. Description: {1}.