1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Added breakpoint classes.

This commit is contained in:
Mikhail Khodjaiants 2002-08-21 22:19:12 +00:00
parent 2e532365b8
commit 79098bebfd
10 changed files with 625 additions and 3 deletions

View file

@ -19,4 +19,104 @@
<extension-point id="CDebugger" name="%CDebugger.name"/>
<extension
id="cBreakpointMarker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.debug.core.breakpointMarker">
</super>
<persistent
value="true">
</persistent>
<attribute
name="condition">
</attribute>
<attribute
name="ignoreCount">
</attribute>
<attribute
name="threadId">
</attribute>
<attribute
name="installCount">
</attribute>
</extension>
<extension
id="commonCLineBreakpointMarker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.cdt.debug.core.cBreakpointMarker">
</super>
<super
type="org.eclipse.debug.core.lineBreakpointMarker">
</super>
</extension>
<extension
id="cLineBreakpointMarker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.cdt.debug.core.commonCLineBreakpointMarker">
</super>
<persistent
value="true">
</persistent>
</extension>
<extension
id="cAddressBreakpointMarker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.cdt.debug.core.commonCLineBreakpointMarker">
</super>
<persistent
value="org.eclipse.cdt.debug.core.persistent3">
</persistent>
<attribute
name="address">
</attribute>
</extension>
<extension
id="cFunctionBreakpointMarker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.cdt.debug.core.commonCLineBreakpointMarker">
</super>
<persistent
value="true">
</persistent>
<attribute
name="function">
</attribute>
</extension>
<extension
id="cWatchpointMarker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.cdt.debug.core.cBreakpointMarker">
</super>
<persistent
value="true">
</persistent>
<attribute
name="expression">
</attribute>
</extension>
<extension
point="org.eclipse.debug.core.breakpoints">
<breakpoint
markerType="cLineBreakpointMarker"
class="org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint"
id="cLineBreakpoint">
</breakpoint>
<breakpoint
markerType="cAddressBreakpointMarker"
class="org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint"
id="cAddressBreakpoint">
</breakpoint>
<breakpoint
markerType="cFunctionBreakpointMarker"
class="org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint"
id="cFunctionBreakpoint">
</breakpoint>
</extension>
</plugin>

View file

@ -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;
}

View file

@ -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:
* <ul>
* <li>a condition</li>
* <li>an ignore count</li>
* <li>a thread filter to restrict a breakpoin to a specific thread</li>
* <li>an installed property that indicates a breakpoint was successfully
* installed in debug target</li>
* </ul>
*
* @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;
}

View file

@ -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;
}

View file

@ -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
{
}

View file

@ -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 <code>"org.eclipse.cdt.debug.core.address"</code>).
* This attribute is a <code>String</code>.
*/
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 );
}
}

View file

@ -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 <code>"org.eclipse.cdt.debug.core.installCount"</code>).
* This attribute is a <code>int</code>.
*/
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 <code>"org.eclipse.cdt.debug.core.condition"</code>).
* This attribute is a <code>String</code>.
*/
protected static final String CONDITION = "org.eclipse.cdt.debug.core.condition"; //$NON-NLS-1$
/**
* Breakpoint attribute storing a breakpoint's ignore count value
* (value <code>"org.eclipse.cdt.debug.core.ignoreCount"</code>).
* This attribute is a <code>int</code>.
*/
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 <code>"org.eclipse.cdt.debug.core.threadId"</code>).
* This attribute is a <code>String</code>.
*/
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 )
{
}
}

View file

@ -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 <code>"org.eclipse.cdt.debug.core.function"</code>).
* This attribute is a <code>String</code>.
*/
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 );
}
}

View file

@ -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 );
}
}

View file

@ -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,6 +258,7 @@ public class CDTDebugModelPresentation extends LabelProvider
if ( info.getFile() != null )
{
IPath path = new Path( info.getFile() );
if ( !path.isEmpty() )
label += "at " + ( qualified ? path.toOSString() : path.lastSegment() ) + ":";
}
if ( info.getFrameLineNumber() != 0 )