mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 16:05:25 +02:00
More implementation of breakpoints.
This commit is contained in:
parent
dccf5a3e6a
commit
c52732cf99
2 changed files with 96 additions and 2 deletions
|
@ -192,4 +192,34 @@ public abstract class CBreakpoint extends Breakpoint
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increments the install count of this breakpoint
|
||||||
|
*/
|
||||||
|
public void incrementInstallCount() throws CoreException
|
||||||
|
{
|
||||||
|
int count = getInstallCount();
|
||||||
|
setAttribute( INSTALL_COUNT, count + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the <code>INSTALL_COUNT</code> attribute of this breakpoint
|
||||||
|
* or 0 if the attribute is not set.
|
||||||
|
*/
|
||||||
|
public int getInstallCount() throws CoreException
|
||||||
|
{
|
||||||
|
return ensureMarker().getAttribute( INSTALL_COUNT, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrements the install count of this breakpoint.
|
||||||
|
*/
|
||||||
|
public void decrementInstallCount() throws CoreException
|
||||||
|
{
|
||||||
|
int count = getInstallCount();
|
||||||
|
if ( count > 0 )
|
||||||
|
{
|
||||||
|
setAttribute( INSTALL_COUNT, count - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -557,6 +557,15 @@ public class CDebugTarget extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public void breakpointRemoved( IBreakpoint breakpoint, IMarkerDelta delta )
|
public void breakpointRemoved( IBreakpoint breakpoint, IMarkerDelta delta )
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( breakpoint instanceof CBreakpoint )
|
||||||
|
removeBreakpoint( (CBreakpoint)breakpoint );
|
||||||
|
}
|
||||||
|
catch( DebugException e )
|
||||||
|
{
|
||||||
|
CDebugCorePlugin.log( e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -946,7 +955,14 @@ public class CDebugTarget extends CDebugElement
|
||||||
getCDISession().getEventManager().removeEventListener( this );
|
getCDISession().getEventManager().removeEventListener( this );
|
||||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( this );
|
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( this );
|
||||||
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( this );
|
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( this );
|
||||||
removeAllBreakpoints();
|
try
|
||||||
|
{
|
||||||
|
removeAllBreakpoints();
|
||||||
|
}
|
||||||
|
catch( DebugException e )
|
||||||
|
{
|
||||||
|
CDebugCorePlugin.log( e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -969,8 +985,50 @@ public class CDebugTarget extends CDebugElement
|
||||||
* Removes all breakpoints from this target.
|
* Removes all breakpoints from this target.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void removeAllBreakpoints()
|
protected void removeAllBreakpoints() throws DebugException
|
||||||
{
|
{
|
||||||
|
ICDIBreakpoint[] cdiBreakpoints = (ICDIBreakpoint[])getBreakpoints().values().toArray( new ICDIBreakpoint[0] );
|
||||||
|
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bm.deleteBreakpoints( cdiBreakpoints );
|
||||||
|
Iterator it = getBreakpoints().keySet().iterator();
|
||||||
|
while( it.hasNext() )
|
||||||
|
{
|
||||||
|
((CBreakpoint)it.next()).decrementInstallCount();
|
||||||
|
}
|
||||||
|
getBreakpoints().clear();
|
||||||
|
}
|
||||||
|
catch( CoreException ce )
|
||||||
|
{
|
||||||
|
requestFailed( "Operation failed. Reason: ", ce );
|
||||||
|
}
|
||||||
|
catch( CDIException e )
|
||||||
|
{
|
||||||
|
requestFailed( "Operation failed. Reason: ", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeBreakpoint( CBreakpoint breakpoint ) throws DebugException
|
||||||
|
{
|
||||||
|
ICDIBreakpoint cdiBreakpoint = findCDIBreakpoint( breakpoint );
|
||||||
|
if ( cdiBreakpoint == null )
|
||||||
|
return;
|
||||||
|
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bm.deleteBreakpoints( new ICDIBreakpoint[] { cdiBreakpoint } );
|
||||||
|
getBreakpoints().remove( breakpoint );
|
||||||
|
breakpoint.decrementInstallCount();
|
||||||
|
}
|
||||||
|
catch( CoreException ce )
|
||||||
|
{
|
||||||
|
requestFailed( "Operation failed. Reason: ", ce );
|
||||||
|
}
|
||||||
|
catch( CDIException e )
|
||||||
|
{
|
||||||
|
requestFailed( "Operation failed. Reason: ", e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1370,6 +1428,7 @@ public class CDebugTarget extends CDebugElement
|
||||||
if ( !getBreakpoints().containsKey( breakpoint ) )
|
if ( !getBreakpoints().containsKey( breakpoint ) )
|
||||||
{
|
{
|
||||||
getBreakpoints().put( breakpoint, cdiBreakpoint );
|
getBreakpoints().put( breakpoint, cdiBreakpoint );
|
||||||
|
((CBreakpoint)breakpoint).incrementInstallCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( CoreException ce )
|
catch( CoreException ce )
|
||||||
|
@ -1381,4 +1440,9 @@ public class CDebugTarget extends CDebugElement
|
||||||
requestFailed( "Operation failed. Reason: ", e );
|
requestFailed( "Operation failed. Reason: ", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint )
|
||||||
|
{
|
||||||
|
return (ICDIBreakpoint)getBreakpoints().get( breakpoint );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue