diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml index 4d330fafa17..35aca2f7481 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.core/plugin.xml @@ -19,4 +19,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICAddressBreakpoint.java new file mode 100644 index 00000000000..45aecd34ef7 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICAddressBreakpoint.java @@ -0,0 +1,35 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.core; + +import org.eclipse.core.runtime.CoreException; + +/** + * + * A breakpoint that suspend execution when a particular address is reached. + * + * @since Aug 21, 2002 + */ +public interface ICAddressBreakpoint extends ICLineBreakpoint +{ + /** + * Returns the address this breakpoint suspends execution at. + * + * @return the address this breakpoint suspends execution at + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public String getAddress() throws CoreException; + + /** + * Sets the address this breakpoint suspends execution at. + * + * @param address the address this breakpoint suspends execution at + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public void setAddress( String address ) throws CoreException; +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICBreakpoint.java new file mode 100644 index 00000000000..df43e3095fa --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICBreakpoint.java @@ -0,0 +1,91 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ + +package org.eclipse.cdt.debug.core; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.model.IBreakpoint; + +/** + * + * A breakpoint specific to the C/C++ debug model. A C/C++ breakpoint supports: + * + * + * @since Aug 21, 2002 + */ +public interface ICBreakpoint extends IBreakpoint +{ + /** + * Returns whether this breakpoint is installed in at least + * one debug target. + * + * @return whether this breakpoint is installed + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public boolean isInstalled() throws CoreException; + + /** + * Returns the conditional expression associated with this breakpoint. + * + * @return this breakpoint's conditional expression + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public String getCondition() throws CoreException; + + /** + * Sets the condition associated with this breakpoint. + * + * @param condition the conditional expression + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public void setCondition( String condition ) throws CoreException; + + /** + * Returns the ignore count used by this breakpoint. + * + * @return the ignore count used by this breakpoint + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public int getIgnoreCount() throws CoreException; + + /** + * Sets the ignore count attribute for this breakpoint. + * + * @param ignoreCount the new ignore count + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public void setIgnoreCount( int ignoreCount ) throws CoreException; + + /** + * Returns the identifier of the thread this breakpoint is restricted in. + * + * @return the thread identifier + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public String getThreadId() throws CoreException; + + /** + * Restricts this breakpoint to suspend only in the given thread + * when encounterd in the given thread's target. + * + * @param threadId the thread identifier + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public void setThreadId( String threadId ) throws CoreException; +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICFunctionBreakpoint.java new file mode 100644 index 00000000000..fd2e6bdf2e2 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICFunctionBreakpoint.java @@ -0,0 +1,35 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.core; + +import org.eclipse.core.runtime.CoreException; + +/** + * + * A breakpoint that suspend execution when a function is entered. + * + * @since Aug 21, 2002 + */ +public interface ICFunctionBreakpoint extends ICLineBreakpoint +{ + /** + * Returns the function this breakpoint suspends execution in. + * + * @return the function this breakpoint suspends execution in + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public String getFunction() throws CoreException; + + /** + * Sets the function this breakpoint suspends execution in. + * + * @param function the function this breakpoint suspends execution in + * @exception CoreException if unable to access the property + * on this breakpoint's underlying marker + */ + public void setFunction( String function ) throws CoreException; +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICLineBreakpoint.java new file mode 100644 index 00000000000..1efa30a9b3e --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICLineBreakpoint.java @@ -0,0 +1,20 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ + +package org.eclipse.cdt.debug.core; + +import org.eclipse.debug.core.model.ILineBreakpoint; + +/** + * + * A breakpoint that suspend execution when a particular line of code + * is reached. + * + * @since Aug 21, 2002 + */ +public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint +{ +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java new file mode 100644 index 00000000000..a01f0f1c89a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java @@ -0,0 +1,74 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.internal.core.breakpoints; + +import org.eclipse.cdt.debug.core.ICAddressBreakpoint; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; + +/** + * + * Enter type comment. + * + * @since Aug 21, 2002 + */ +public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoint +{ + /** + * Breakpoint attribute storing the address this breakpoint suspends + * execution at (value "org.eclipse.cdt.debug.core.address"). + * This attribute is a String. + */ + protected static final String ADDRESS = "org.eclipse.cdt.debug.core.address"; //$NON-NLS-1$ + + /** + * Constructor for CAddressBreakpoint. + */ + public CAddressBreakpoint() + { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#getAddress() + */ + public String getAddress() throws CoreException + { + return ensureMarker().getAttribute( ADDRESS, null ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#setAddress(long) + */ + public void setAddress( String address ) throws CoreException + { + setAttribute( ADDRESS, address ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber() + */ + public int getLineNumber() throws CoreException + { + return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart() + */ + public int getCharStart() throws CoreException + { + return ensureMarker().getAttribute( IMarker.CHAR_START, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd() + */ + public int getCharEnd() throws CoreException + { + return ensureMarker().getAttribute( IMarker.CHAR_END, -1 ); + } +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java new file mode 100644 index 00000000000..54820fb4fe8 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java @@ -0,0 +1,132 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ + +package org.eclipse.cdt.debug.internal.core.breakpoints; + +import org.eclipse.cdt.debug.core.CDebugModel; +import org.eclipse.cdt.debug.core.ICBreakpoint; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugEvent; +import org.eclipse.debug.core.IDebugEventSetListener; +import org.eclipse.debug.core.model.Breakpoint; + +/** + * + * Enter type comment. + * + * @since Aug 21, 2002 + */ +public abstract class CBreakpoint extends Breakpoint + implements ICBreakpoint, + IDebugEventSetListener +{ + /** + * Breakpoint attribute storing the number of debug targets a + * breakpoint is installed in (value "org.eclipse.cdt.debug.core.installCount"). + * This attribute is a int. + */ + protected static final String INSTALL_COUNT = "org.eclipse.cdt.debug.core.installCount"; //$NON-NLS-1$ + + /** + * Breakpoint attribute storing the the conditional expression + * associated with this breakpoint (value "org.eclipse.cdt.debug.core.condition"). + * This attribute is a String. + */ + protected static final String CONDITION = "org.eclipse.cdt.debug.core.condition"; //$NON-NLS-1$ + + /** + * Breakpoint attribute storing a breakpoint's ignore count value + * (value "org.eclipse.cdt.debug.core.ignoreCount"). + * This attribute is a int. + */ + protected static final String IGNORE_COUNT = "org.eclipse.cdt.debug.core.ignoreCount"; //$NON-NLS-1$ + + /** + * Breakpoint attribute storing an identifier of the thread this + * breakpoint is restricted in (value "org.eclipse.cdt.debug.core.threadId"). + * This attribute is a String. + */ + protected static final String THREAD_ID = "org.eclipse.cdt.debug.core.threadId"; //$NON-NLS-1$ + + /** + * Constructor for CBreakpoint. + */ + public CBreakpoint() + { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier() + */ + public String getModelIdentifier() + { + return CDebugModel.getPluginIdentifier(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICBreakpoint#isInstalled() + */ + public boolean isInstalled() throws CoreException + { + return ensureMarker().getAttribute( INSTALL_COUNT, 0 ) > 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICBreakpoint#getCondition() + */ + public String getCondition() throws CoreException + { + return ensureMarker().getAttribute( CONDITION, "" ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICBreakpoint#setCondition(String) + */ + public void setCondition( String condition ) throws CoreException + { + setAttribute( CONDITION, condition ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICBreakpoint#getIgnoreCount() + */ + public int getIgnoreCount() throws CoreException + { + return ensureMarker().getAttribute( IGNORE_COUNT, 0 ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICBreakpoint#setIgnoreCount(int) + */ + public void setIgnoreCount( int ignoreCount ) throws CoreException + { + setAttribute( IGNORE_COUNT, ignoreCount ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICBreakpoint#getThreadId() + */ + public String getThreadId() throws CoreException + { + return ensureMarker().getAttribute( THREAD_ID, null ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICBreakpoint#setThreadId(String) + */ + public void setThreadId( String threadId ) throws CoreException + { + setAttribute( THREAD_ID, threadId ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(DebugEvent[]) + */ + public void handleDebugEvents( DebugEvent[] events ) + { + } +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java new file mode 100644 index 00000000000..6cda614e8aa --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java @@ -0,0 +1,73 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.internal.core.breakpoints; + +import org.eclipse.cdt.debug.core.ICFunctionBreakpoint; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; + +/** + * + * Enter type comment. + * + * @since Aug 21, 2002 + */ +public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakpoint +{ + /** + * Breakpoint attribute storing the function this breakpoint suspends + * execution in (value "org.eclipse.cdt.debug.core.function"). + * This attribute is a String. + */ + protected static final String FUNCTION = "org.eclipse.cdt.debug.core.function"; //$NON-NLS-1$ + + /** + * Constructor for CFunctionBreakpoint. + */ + public CFunctionBreakpoint() + { + super(); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#getFunction() + */ + public String getFunction() throws CoreException + { + return ensureMarker().getAttribute( FUNCTION, null ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#setFunction(String) + */ + public void setFunction( String function ) throws CoreException + { + setAttribute( FUNCTION, function ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber() + */ + public int getLineNumber() throws CoreException + { + return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart() + */ + public int getCharStart() throws CoreException + { + return ensureMarker().getAttribute( IMarker.CHAR_START, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd() + */ + public int getCharEnd() throws CoreException + { + return ensureMarker().getAttribute( IMarker.CHAR_END, -1 ); + } +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java new file mode 100644 index 00000000000..e3ffa8fad62 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java @@ -0,0 +1,51 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.internal.core.breakpoints; + +import org.eclipse.cdt.debug.core.ICLineBreakpoint; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; + +/** + * + * Enter type comment. + * + * @since Aug 21, 2002 + */ +public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint +{ + /** + * Constructor for CLineBreakpoint. + */ + public CLineBreakpoint() + { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber() + */ + public int getLineNumber() throws CoreException + { + return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart() + */ + public int getCharStart() throws CoreException + { + return ensureMarker().getAttribute( IMarker.CHAR_START, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd() + */ + public int getCharEnd() throws CoreException + { + return ensureMarker().getAttribute( IMarker.CHAR_END, -1 ); + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java index 272f532b05e..6fae7766a44 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java @@ -11,6 +11,7 @@ import java.util.HashMap; import org.eclipse.cdt.debug.core.IStackFrameInfo; import org.eclipse.cdt.debug.core.IState; +import org.eclipse.cdt.debug.core.cdi.ICDIExitInfo; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; @@ -209,10 +210,19 @@ public class CDTDebugModelPresentation extends LabelProvider { if ( target instanceof IState ) { - switch( ((IState)target).getCurrentStateId() ) + IState state = (IState)target; + switch( state.getCurrentStateId() ) { case IState.EXITED: - return getFormattedString( "{0} (Exited)", target.getName() ); + { + Object info = state.getCurrentStateInfo(); + String label = target.getName() + " (Exited"; + if ( info != null && info instanceof ICDIExitInfo ) + { + label += ". Exit code = " + ((ICDIExitInfo)info).getCode(); + } + return label + ")"; + } } } return target.getName(); @@ -248,7 +258,8 @@ public class CDTDebugModelPresentation extends LabelProvider if ( info.getFile() != null ) { IPath path = new Path( info.getFile() ); - label += "at " + ( qualified ? path.toOSString() : path.lastSegment() ) + ":"; + if ( !path.isEmpty() ) + label += "at " + ( qualified ? path.toOSString() : path.lastSegment() ) + ":"; } if ( info.getFrameLineNumber() != 0 ) label += info.getFrameLineNumber();