1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Managing breakpoints from the gdb console (fixes).

This commit is contained in:
Mikhail Khodjaiants 2003-01-29 22:19:59 +00:00
parent 8eb09aca12
commit 58c356def4
8 changed files with 110 additions and 178 deletions

View file

@ -1,3 +1,13 @@
2003-01-29 Mikhail Khodjaiants
Managing breakpoints from the gdb console (fixes).
* CDebugModel.java
* CAddressBreakpoint.java
* CBreakpoint.java
* CFunctionBreakpoint.java
* CLineBreakpoint.java
* CWatchpoint.java
* CDebugTarget.java
2003-01-29 Alain Magloire 2003-01-29 Alain Magloire
* src/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibraryManger.java (getSharedLibraryPaths): * src/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibraryManger.java (getSharedLibraryPaths):

View file

@ -14,12 +14,10 @@ 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.ICDISessionObject; import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
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.ICDIMemoryBlock; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
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.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
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.ICDebugTargetType; import org.eclipse.cdt.debug.core.model.ICDebugTargetType;
@ -309,23 +307,6 @@ public class CDebugModel
return new CLineBreakpoint( resource, attributes, add ); return new CLineBreakpoint( resource, attributes, add );
} }
public static ICLineBreakpoint createLineBreakpoint( IResource resource,
int lineNumber,
boolean enabled,
int ignoreCount,
String condition,
ICDIBreakpoint cdiBreakpoint,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( ICBreakpoint.ID, getPluginIdentifier() );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put( ICBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
return new CLineBreakpoint( resource, attributes, cdiBreakpoint, add );
}
public static ICAddressBreakpoint addressBreakpointExists( IResource resource, long address ) throws CoreException public static ICAddressBreakpoint addressBreakpointExists( IResource resource, long address ) throws CoreException
{ {
String modelId = getPluginIdentifier(); String modelId = getPluginIdentifier();
@ -378,26 +359,6 @@ public class CDebugModel
return new CAddressBreakpoint( resource, attributes, add ); return new CAddressBreakpoint( resource, attributes, add );
} }
public static ICAddressBreakpoint createAddressBreakpoint( IResource resource,
long address,
boolean enabled,
int ignoreCount,
String condition,
ICDIBreakpoint breakpoint,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( ICBreakpoint.ID, getPluginIdentifier() );
attributes.put( IMarker.CHAR_START, new Integer( 0 ) );
attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
attributes.put( ICAddressBreakpoint.ADDRESS, Long.toString( address ) );
attributes.put( ICBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
return new CAddressBreakpoint( resource, attributes, breakpoint, add );
}
public static ICWatchpoint watchpointExists( IResource resource, boolean write, boolean read, String expression ) throws CoreException public static ICWatchpoint watchpointExists( IResource resource, boolean write, boolean read, String expression ) throws CoreException
{ {
String modelId = getPluginIdentifier(); String modelId = getPluginIdentifier();
@ -443,27 +404,6 @@ public class CDebugModel
return new CWatchpoint( resource, attributes, add ); return new CWatchpoint( resource, attributes, add );
} }
public static ICWatchpoint createWatchpoint( IResource resource,
boolean writeAccess,
boolean readAccess,
String expression,
boolean enabled,
int ignoreCount,
String condition,
ICDIWatchpoint watchpoint,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( ICBreakpoint.ID, getPluginIdentifier() );
attributes.put( ICBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put( ICWatchpoint.EXPRESSION, expression );
attributes.put( ICWatchpoint.READ, new Boolean( readAccess ) );
attributes.put( ICWatchpoint.WRITE, new Boolean( writeAccess ) );
return new CWatchpoint( resource, attributes, watchpoint, add );
}
public static IExpression createExpression( IDebugTarget target, String text ) throws DebugException public static IExpression createExpression( IDebugTarget target, String text ) throws DebugException
{ {
if ( target != null && target instanceof CDebugTarget ) if ( target != null && target instanceof CDebugTarget )

View file

@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -39,14 +38,6 @@ public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoi
super( resource, getMarkerType(), attributes, add ); super( resource, getMarkerType(), attributes, add );
} }
/**
* Constructor for CAddressBreakpoint.
*/
public CAddressBreakpoint( IResource resource, Map attributes, ICDIBreakpoint cdiBreakpoint, boolean add ) throws DebugException
{
super( resource, getMarkerType(), attributes, cdiBreakpoint, add );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#getAddress() * @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#getAddress()
*/ */

View file

@ -9,7 +9,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugModel; import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -33,12 +32,6 @@ public abstract class CBreakpoint extends Breakpoint
implements ICBreakpoint, implements ICBreakpoint,
IDebugEventSetListener IDebugEventSetListener
{ {
/**
* This field is used to pass a CDI breakpoint to the target if the breakpoint
* is created in gdb console.
*/
private ICDIBreakpoint fExternalBreakpoint = null;
/** /**
* Constructor for CBreakpoint. * Constructor for CBreakpoint.
*/ */
@ -71,12 +64,8 @@ public abstract class CBreakpoint extends Breakpoint
run( wr ); run( wr );
} }
/** public void createMarker( final IResource resource, final String markerType, final Map attributes, final boolean add ) throws DebugException
* Constructor for CBreakpoint.
*/
public CBreakpoint( final IResource resource, final String markerType, final Map attributes, final ICDIBreakpoint cdiBreakpoint, final boolean add ) throws DebugException
{ {
setExternalBreakpoint( cdiBreakpoint );
IWorkspaceRunnable wr= new IWorkspaceRunnable() IWorkspaceRunnable wr= new IWorkspaceRunnable()
{ {
public void run( IProgressMonitor monitor ) throws CoreException public void run( IProgressMonitor monitor ) throws CoreException
@ -187,16 +176,18 @@ public abstract class CBreakpoint extends Breakpoint
* Add this breakpoint to the breakpoint manager, * Add this breakpoint to the breakpoint manager,
* or sets it as unregistered. * or sets it as unregistered.
*/ */
protected void register( boolean register ) throws CoreException public void register( boolean register ) throws CoreException
{ {
if ( register ) if ( register )
{ {
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint( this ); DebugPlugin.getDefault().getBreakpointManager().addBreakpoint( this );
} }
/*
else else
{ {
setRegistered( false ); setRegistered( false );
} }
*/
} }
protected String getMarkerMessage() throws CoreException protected String getMarkerMessage() throws CoreException
@ -257,14 +248,4 @@ public abstract class CBreakpoint extends Breakpoint
{ {
super.setAttribute( attributeName, value ); super.setAttribute( attributeName, value );
} }
public ICDIBreakpoint getExternalBreakpoint()
{
return fExternalBreakpoint;
}
public void setExternalBreakpoint( ICDIBreakpoint cdiBreakpoint )
{
fExternalBreakpoint = cdiBreakpoint;
}
} }

View file

@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -46,14 +45,6 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp
super( resource, getMarkerType(), attributes, add ); super( resource, getMarkerType(), attributes, add );
} }
/**
* Constructor for CFunctionBreakpoint.
*/
public CFunctionBreakpoint( IResource resource, Map attributes, ICDIBreakpoint cdiBreakpoint, boolean add ) throws DebugException
{
super( resource, getMarkerType(), attributes, cdiBreakpoint, add );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#getFunction() * @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#getFunction()
*/ */

View file

@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -39,14 +38,6 @@ public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint
super( resource, getMarkerType(), attributes, add ); super( resource, getMarkerType(), attributes, add );
} }
/**
* Constructor for CLineBreakpoint.
*/
public CLineBreakpoint( IResource resource, Map attributes, ICDIBreakpoint cdiBreakpoint, boolean add ) throws DebugException
{
super( resource, getMarkerType(), attributes, cdiBreakpoint, add );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber() * @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/ */

View file

@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -38,14 +37,6 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint
super( resource, getMarkerType(), attributes, add ); super( resource, getMarkerType(), attributes, add );
} }
/**
* Constructor for CWatchpoint.
*/
public CWatchpoint( IResource resource, Map attributes, ICDIWatchpoint watchpoint, boolean add ) throws DebugException
{
super( resource, getMarkerType(), attributes, watchpoint, add );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICWatchpoint#isWriteType() * @see org.eclipse.cdt.debug.core.ICWatchpoint#isWriteType()
*/ */

View file

@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
@ -74,7 +75,6 @@ import org.eclipse.cdt.debug.internal.core.CMemoryManager;
import org.eclipse.cdt.debug.internal.core.CSharedLibraryManager; import org.eclipse.cdt.debug.internal.core.CSharedLibraryManager;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager; import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
@ -264,7 +264,7 @@ public class CDebugTarget extends CDebugElement
setName( name ); setName( name );
setProcesses( debuggeeProcess, debuggerProcess ); setProcesses( debuggeeProcess, debuggerProcess );
setCDITarget( cdiTarget ); setCDITarget( cdiTarget );
initializeBreakpoints( new HashMap( 5 ) ); initializeBreakpointMap( new HashMap( 5 ) );
setExecFile( file ); setExecFile( file );
setConfiguration( cdiTarget.getSession().getConfiguration() ); setConfiguration( cdiTarget.getSession().getConfiguration() );
fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate(); fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
@ -286,13 +286,19 @@ public class CDebugTarget extends CDebugElement
{ {
initializeState(); initializeState();
setSourceSearchPath(); setSourceSearchPath();
setBreakpoints(); initializeBreakpoints();
initializeRegisters(); initializeRegisters();
initializeMemoryManager(); initializeMemoryManager();
getLaunch().addDebugTarget( this ); getLaunch().addDebugTarget( this );
fireCreationEvent(); fireCreationEvent();
} }
private void initializeBreakpoints()
{
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener( this );
setBreakpoints();
}
/** /**
* Adds all of the pre-existing threads to this debug target. * Adds all of the pre-existing threads to this debug target.
* *
@ -322,7 +328,6 @@ public class CDebugTarget extends CDebugElement
if ( getRetryBreakpoints() ) if ( getRetryBreakpoints() )
{ {
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
manager.addBreakpointListener( this );
IBreakpoint[] bps = (IBreakpoint[])manager.getBreakpoints( CDebugModel.getPluginIdentifier() ); IBreakpoint[] bps = (IBreakpoint[])manager.getBreakpoints( CDebugModel.getPluginIdentifier() );
for ( int i = 0; i < bps.length; i++ ) for ( int i = 0; i < bps.length; i++ )
{ {
@ -964,6 +969,10 @@ public class CDebugTarget extends CDebugElement
{ {
getSharedLibraryManager().symbolsLoaded( (ICDISharedLibrary)source ); getSharedLibraryManager().symbolsLoaded( (ICDISharedLibrary)source );
} }
if ( source instanceof ICDIBreakpoint )
{
handleBreakpointChangedEvent( (ICDIBreakpoint)source );
}
} }
else if ( event instanceof ICDIRestartedEvent ) else if ( event instanceof ICDIRestartedEvent )
{ {
@ -1484,49 +1493,50 @@ public class CDebugTarget extends CDebugElement
{ {
doHandleLocationBreakpointCreatedEvent( breakpoint ); doHandleLocationBreakpointCreatedEvent( breakpoint );
} }
}; };
CDebugCorePlugin.getDefault().asyncExec( runnable ); CDebugCorePlugin.getDefault().asyncExec( runnable );
} }
protected void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint breakpoint ) protected void doHandleLocationBreakpointCreatedEvent( final ICDILocationBreakpoint cdiBreakpoint )
{ {
if ( breakpoint.isTemporary() || getBreakpoints().containsValue( breakpoint ) ) if ( cdiBreakpoint.isTemporary() || getBreakpoints().containsValue( cdiBreakpoint ) )
return; return;
try try
{ {
if ( breakpoint.getLocation().getFile() != null && breakpoint.getLocation().getFile().length() > 0 ) if ( cdiBreakpoint.getLocation().getFile() != null && cdiBreakpoint.getLocation().getFile().length() > 0 )
{ {
if ( getSourceLocator() instanceof IAdaptable && ((IAdaptable)getSourceLocator()).getAdapter( ICSourceLocator.class ) != null ) if ( getSourceLocator() instanceof IAdaptable && ((IAdaptable)getSourceLocator()).getAdapter( ICSourceLocator.class ) != null )
{ {
Object sourceElement = ((ICSourceLocator)((IAdaptable)getSourceLocator()).getAdapter( ICSourceLocator.class )).findSourceElement( breakpoint.getLocation().getFile() ); Object sourceElement = ((ICSourceLocator)((IAdaptable)getSourceLocator()).getAdapter( ICSourceLocator.class )).findSourceElement( cdiBreakpoint.getLocation().getFile() );
if ( sourceElement != null && sourceElement instanceof IFile ) if ( sourceElement != null && sourceElement instanceof IFile )
{ {
CDebugModel.createLineBreakpoint( (IFile)sourceElement, ICLineBreakpoint breakpoint = CDebugModel.createLineBreakpoint( (IFile)sourceElement,
breakpoint.getLocation().getLineNumber(), cdiBreakpoint.getLocation().getLineNumber(),
breakpoint.isEnabled(), cdiBreakpoint.isEnabled(),
breakpoint.getCondition().getIgnoreCount(), cdiBreakpoint.getCondition().getIgnoreCount(),
breakpoint.getCondition().getExpression(), cdiBreakpoint.getCondition().getExpression(),
breakpoint, false );
true ); getBreakpoints().put( breakpoint, cdiBreakpoint );
((CBreakpoint)breakpoint).register( true );
} }
} }
} }
else if ( breakpoint.getLocation().getAddress() > 0 ) else if ( cdiBreakpoint.getLocation().getAddress() > 0 )
{ {
CDebugModel.createAddressBreakpoint( getExecFile(), ICAddressBreakpoint breakpoint = CDebugModel.createAddressBreakpoint( getExecFile(),
breakpoint.getLocation().getAddress(), cdiBreakpoint.getLocation().getAddress(),
breakpoint.isEnabled(), cdiBreakpoint.isEnabled(),
breakpoint.getCondition().getIgnoreCount(), cdiBreakpoint.getCondition().getIgnoreCount(),
breakpoint.getCondition().getExpression(), cdiBreakpoint.getCondition().getExpression(),
breakpoint, false );
true ); getBreakpoints().put( breakpoint, cdiBreakpoint );
((CBreakpoint)breakpoint).register( true );
} }
} }
catch( CDIException e ) catch( CDIException e )
{ {
} }
catch( DebugException e ) catch( CoreException e )
{ {
} }
} }
@ -1544,26 +1554,27 @@ public class CDebugTarget extends CDebugElement
CDebugCorePlugin.getDefault().asyncExec( runnable ); CDebugCorePlugin.getDefault().asyncExec( runnable );
} }
protected void doHandleWatchpointCreatedEvent( ICDIWatchpoint watchpoint ) protected void doHandleWatchpointCreatedEvent( ICDIWatchpoint cdiWatchpoint )
{ {
if ( getBreakpoints().containsValue( watchpoint ) ) if ( getBreakpoints().containsValue( cdiWatchpoint ) )
return; return;
try try
{ {
CDebugModel.createWatchpoint( getExecFile().getProject(), ICWatchpoint watchpoint = CDebugModel.createWatchpoint( getExecFile().getProject(),
watchpoint.isWriteType(), cdiWatchpoint.isWriteType(),
watchpoint.isReadType(), cdiWatchpoint.isReadType(),
watchpoint.getWatchExpression(), cdiWatchpoint.getWatchExpression(),
watchpoint.isEnabled(), cdiWatchpoint.isEnabled(),
watchpoint.getCondition().getIgnoreCount(), cdiWatchpoint.getCondition().getIgnoreCount(),
watchpoint.getCondition().getExpression(), cdiWatchpoint.getCondition().getExpression(),
watchpoint, false );
true ); getBreakpoints().put( watchpoint, cdiWatchpoint );
((CBreakpoint)watchpoint).register( true );
} }
catch( CDIException e ) catch( CDIException e )
{ {
} }
catch( DebugException e ) catch( CoreException e )
{ {
} }
} }
@ -1596,6 +1607,41 @@ public class CDebugTarget extends CDebugElement
} }
} }
private void handleBreakpointChangedEvent( final ICDIBreakpoint breakpoint )
{
Runnable runnable = new Runnable()
{
public void run()
{
doHandleBreakpointChangedEvent( breakpoint );
}
};
CDebugCorePlugin.getDefault().asyncExec( runnable );
}
protected void doHandleBreakpointChangedEvent( ICDIBreakpoint cdiBreakpoint )
{
IBreakpoint breakpoint = findBreakpoint( cdiBreakpoint );
if ( breakpoint instanceof ICBreakpoint )
{
try
{
Map attributes = breakpoint.getMarker().getAttributes();
attributes.put( ICBreakpoint.ENABLED, new Boolean( cdiBreakpoint.isEnabled() ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( cdiBreakpoint.getCondition().getIgnoreCount() ) );
attributes.put( ICBreakpoint.CONDITION, cdiBreakpoint.getCondition().getExpression() );
breakpoint.getMarker().setAttributes( attributes );
}
catch( CDIException e )
{
}
catch( CoreException e )
{
}
}
}
/** /**
* Finds and returns the model thread for the associated CDI thread, * Finds and returns the model thread for the associated CDI thread,
* or <code>null</code> if not found. * or <code>null</code> if not found.
@ -1721,7 +1767,7 @@ public class CDebugTarget extends CDebugElement
* *
* @param breakpoints breakpoints map * @param breakpoints breakpoints map
*/ */
private void initializeBreakpoints( HashMap breakpoints ) private void initializeBreakpointMap( HashMap breakpoints )
{ {
fBreakpoints = breakpoints; fBreakpoints = breakpoints;
} }
@ -1750,14 +1796,10 @@ public class CDebugTarget extends CDebugElement
{ {
try try
{ {
ICDIBreakpoint cdiBreakpoint = ((CBreakpoint)breakpoint).getExternalBreakpoint(); ICDIBreakpoint cdiBreakpoint = (ICDIBreakpoint)getBreakpoints().get( breakpoint );
if ( cdiBreakpoint == null ) if ( cdiBreakpoint == null )
{ {
setLineBreakpoint0( breakpoint ); cdiBreakpoint = setLineBreakpoint0( breakpoint );
}
else
{
getBreakpoints().put( breakpoint, cdiBreakpoint );
} }
((CBreakpoint)breakpoint).incrementInstallCount(); ((CBreakpoint)breakpoint).incrementInstallCount();
if ( !breakpoint.isEnabled() ) if ( !breakpoint.isEnabled() )
@ -1775,27 +1817,24 @@ public class CDebugTarget extends CDebugElement
} }
} }
private synchronized void setLineBreakpoint0( ICLineBreakpoint breakpoint ) throws CDIException, CoreException private synchronized ICDIBreakpoint setLineBreakpoint0( ICLineBreakpoint breakpoint ) throws CDIException, CoreException
{ {
ICDIBreakpointManager bm = getCDISession().getBreakpointManager(); ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() ); ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() ); ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null ); ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
getBreakpoints().put( breakpoint, cdiBreakpoint ); getBreakpoints().put( breakpoint, cdiBreakpoint );
return cdiBreakpoint;
} }
private void setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws DebugException private void setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws DebugException
{ {
try try
{ {
ICDIBreakpoint cdiBreakpoint = ((CBreakpoint)breakpoint).getExternalBreakpoint(); ICDIBreakpoint cdiBreakpoint = (ICDIBreakpoint)getBreakpoints().get( breakpoint );
if ( cdiBreakpoint == null ) if ( cdiBreakpoint == null )
{ {
setAddressBreakpoint0( breakpoint ); cdiBreakpoint = setAddressBreakpoint0( breakpoint );
}
else
{
getBreakpoints().put( breakpoint, cdiBreakpoint );
} }
((CBreakpoint)breakpoint).incrementInstallCount(); ((CBreakpoint)breakpoint).incrementInstallCount();
if ( !breakpoint.isEnabled() ) if ( !breakpoint.isEnabled() )
@ -1817,27 +1856,24 @@ public class CDebugTarget extends CDebugElement
} }
} }
private synchronized void setAddressBreakpoint0( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException private synchronized ICDIBreakpoint setAddressBreakpoint0( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException
{ {
ICDIBreakpointManager bm = getCDISession().getBreakpointManager(); ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) ); ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) );
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() ); ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null ); ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
getBreakpoints().put( breakpoint, cdiBreakpoint ); getBreakpoints().put( breakpoint, cdiBreakpoint );
return cdiBreakpoint;
} }
private void setWatchpoint( ICWatchpoint watchpoint ) throws DebugException private void setWatchpoint( ICWatchpoint watchpoint ) throws DebugException
{ {
try try
{ {
ICDIWatchpoint cdiWatchpoint = (ICDIWatchpoint)((CWatchpoint)watchpoint).getExternalBreakpoint(); ICDIWatchpoint cdiWatchpoint = (ICDIWatchpoint)getBreakpoints().get( watchpoint );
if ( cdiWatchpoint == null ) if ( cdiWatchpoint == null )
{ {
setWatchpoint0( watchpoint ); cdiWatchpoint = setWatchpoint0( watchpoint );
}
else
{
getBreakpoints().put( watchpoint, cdiWatchpoint );
} }
((CBreakpoint)watchpoint).incrementInstallCount(); ((CBreakpoint)watchpoint).incrementInstallCount();
if ( !watchpoint.isEnabled() ) if ( !watchpoint.isEnabled() )
@ -1855,7 +1891,7 @@ public class CDebugTarget extends CDebugElement
} }
} }
private synchronized void setWatchpoint0( ICWatchpoint watchpoint ) throws CDIException, CoreException private synchronized ICDIWatchpoint setWatchpoint0( ICWatchpoint watchpoint ) throws CDIException, CoreException
{ {
ICDIBreakpointManager bm = getCDISession().getBreakpointManager(); ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
ICDICondition condition = bm.createCondition( watchpoint.getIgnoreCount(), watchpoint.getCondition() ); ICDICondition condition = bm.createCondition( watchpoint.getIgnoreCount(), watchpoint.getCondition() );
@ -1865,6 +1901,7 @@ public class CDebugTarget extends CDebugElement
String expression = watchpoint.getExpression(); String expression = watchpoint.getExpression();
ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition ); ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
getBreakpoints().put( watchpoint, cdiWatchpoint ); getBreakpoints().put( watchpoint, cdiWatchpoint );
return cdiWatchpoint;
} }
private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint ) private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint )