diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 5ec5d0acbff..1d316943169 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -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 * src/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibraryManger.java (getSharedLibraryPaths): diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java index a5c33744d60..97d1c2201af 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java @@ -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.ICDISessionObject; 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.ICDIMemoryBlock; 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.ICDIWatchpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICDebugTargetType; @@ -309,23 +307,6 @@ public class CDebugModel 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 { String modelId = getPluginIdentifier(); @@ -378,26 +359,6 @@ public class CDebugModel 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 { String modelId = getPluginIdentifier(); @@ -443,27 +404,6 @@ public class CDebugModel 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 { if ( target != null && target instanceof CDebugTarget ) 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 index 6d71cb1daa0..d0c33bfce10 100644 --- 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 @@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints; import java.util.Map; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; @@ -39,14 +38,6 @@ public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoi 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) * @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#getAddress() */ 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 index b936e672a2c..609e1b4d885 100644 --- 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 @@ -9,7 +9,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints; import java.util.Map; 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.core.resources.IMarker; import org.eclipse.core.resources.IResource; @@ -33,12 +32,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, 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. */ @@ -71,12 +64,8 @@ public abstract class CBreakpoint extends Breakpoint run( wr ); } - /** - * Constructor for CBreakpoint. - */ - public CBreakpoint( final IResource resource, final String markerType, final Map attributes, final ICDIBreakpoint cdiBreakpoint, final boolean add ) throws DebugException + public void createMarker( final IResource resource, final String markerType, final Map attributes, final boolean add ) throws DebugException { - setExternalBreakpoint( cdiBreakpoint ); IWorkspaceRunnable wr= new IWorkspaceRunnable() { public void run( IProgressMonitor monitor ) throws CoreException @@ -187,16 +176,18 @@ public abstract class CBreakpoint extends Breakpoint * Add this breakpoint to the breakpoint manager, * or sets it as unregistered. */ - protected void register( boolean register ) throws CoreException + public void register( boolean register ) throws CoreException { if ( register ) { DebugPlugin.getDefault().getBreakpointManager().addBreakpoint( this ); } +/* else { setRegistered( false ); } +*/ } protected String getMarkerMessage() throws CoreException @@ -257,14 +248,4 @@ public abstract class CBreakpoint extends Breakpoint { super.setAttribute( attributeName, value ); } - - public ICDIBreakpoint getExternalBreakpoint() - { - return fExternalBreakpoint; - } - - public void setExternalBreakpoint( ICDIBreakpoint cdiBreakpoint ) - { - fExternalBreakpoint = cdiBreakpoint; - } } 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 index 2e1c01ec69f..3858037c519 100644 --- 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 @@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints; import java.util.Map; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; @@ -46,14 +45,6 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp 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) * @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#getFunction() */ 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 index f1cfe8aaf82..6404205b9ba 100644 --- 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 @@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints; import java.util.Map; -import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; @@ -39,14 +38,6 @@ public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint 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) * @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber() */ diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java index 4361bb843a7..f6ee2c296d9 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java @@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints; import java.util.Map; -import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -38,14 +37,6 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint 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) * @see org.eclipse.cdt.debug.core.ICWatchpoint#isWriteType() */ diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index 30b3c132ad6..178fe60c9ba 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.StringTokenizer; 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.ICDebugInternalConstants; 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.DisassemblyManager; import org.eclipse.core.resources.IFile; @@ -264,7 +264,7 @@ public class CDebugTarget extends CDebugElement setName( name ); setProcesses( debuggeeProcess, debuggerProcess ); setCDITarget( cdiTarget ); - initializeBreakpoints( new HashMap( 5 ) ); + initializeBreakpointMap( new HashMap( 5 ) ); setExecFile( file ); setConfiguration( cdiTarget.getSession().getConfiguration() ); fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate(); @@ -286,13 +286,19 @@ public class CDebugTarget extends CDebugElement { initializeState(); setSourceSearchPath(); - setBreakpoints(); + initializeBreakpoints(); initializeRegisters(); initializeMemoryManager(); getLaunch().addDebugTarget( this ); fireCreationEvent(); } + private void initializeBreakpoints() + { + DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener( this ); + setBreakpoints(); + } + /** * Adds all of the pre-existing threads to this debug target. * @@ -322,7 +328,6 @@ public class CDebugTarget extends CDebugElement if ( getRetryBreakpoints() ) { IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); - manager.addBreakpointListener( this ); IBreakpoint[] bps = (IBreakpoint[])manager.getBreakpoints( CDebugModel.getPluginIdentifier() ); for ( int i = 0; i < bps.length; i++ ) { @@ -964,6 +969,10 @@ public class CDebugTarget extends CDebugElement { getSharedLibraryManager().symbolsLoaded( (ICDISharedLibrary)source ); } + if ( source instanceof ICDIBreakpoint ) + { + handleBreakpointChangedEvent( (ICDIBreakpoint)source ); + } } else if ( event instanceof ICDIRestartedEvent ) { @@ -1484,49 +1493,50 @@ public class CDebugTarget extends CDebugElement { doHandleLocationBreakpointCreatedEvent( breakpoint ); } - }; 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; 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 ) { - 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 ) { - CDebugModel.createLineBreakpoint( (IFile)sourceElement, - breakpoint.getLocation().getLineNumber(), - breakpoint.isEnabled(), - breakpoint.getCondition().getIgnoreCount(), - breakpoint.getCondition().getExpression(), - breakpoint, - true ); + ICLineBreakpoint breakpoint = CDebugModel.createLineBreakpoint( (IFile)sourceElement, + cdiBreakpoint.getLocation().getLineNumber(), + cdiBreakpoint.isEnabled(), + cdiBreakpoint.getCondition().getIgnoreCount(), + cdiBreakpoint.getCondition().getExpression(), + false ); + getBreakpoints().put( breakpoint, cdiBreakpoint ); + ((CBreakpoint)breakpoint).register( true ); } } } - else if ( breakpoint.getLocation().getAddress() > 0 ) + else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) { - CDebugModel.createAddressBreakpoint( getExecFile(), - breakpoint.getLocation().getAddress(), - breakpoint.isEnabled(), - breakpoint.getCondition().getIgnoreCount(), - breakpoint.getCondition().getExpression(), - breakpoint, - true ); + ICAddressBreakpoint breakpoint = CDebugModel.createAddressBreakpoint( getExecFile(), + cdiBreakpoint.getLocation().getAddress(), + cdiBreakpoint.isEnabled(), + cdiBreakpoint.getCondition().getIgnoreCount(), + cdiBreakpoint.getCondition().getExpression(), + false ); + getBreakpoints().put( breakpoint, cdiBreakpoint ); + ((CBreakpoint)breakpoint).register( true ); } } catch( CDIException e ) { } - catch( DebugException e ) + catch( CoreException e ) { } } @@ -1544,26 +1554,27 @@ public class CDebugTarget extends CDebugElement CDebugCorePlugin.getDefault().asyncExec( runnable ); } - protected void doHandleWatchpointCreatedEvent( ICDIWatchpoint watchpoint ) + protected void doHandleWatchpointCreatedEvent( ICDIWatchpoint cdiWatchpoint ) { - if ( getBreakpoints().containsValue( watchpoint ) ) + if ( getBreakpoints().containsValue( cdiWatchpoint ) ) return; try { - CDebugModel.createWatchpoint( getExecFile().getProject(), - watchpoint.isWriteType(), - watchpoint.isReadType(), - watchpoint.getWatchExpression(), - watchpoint.isEnabled(), - watchpoint.getCondition().getIgnoreCount(), - watchpoint.getCondition().getExpression(), - watchpoint, - true ); + ICWatchpoint watchpoint = CDebugModel.createWatchpoint( getExecFile().getProject(), + cdiWatchpoint.isWriteType(), + cdiWatchpoint.isReadType(), + cdiWatchpoint.getWatchExpression(), + cdiWatchpoint.isEnabled(), + cdiWatchpoint.getCondition().getIgnoreCount(), + cdiWatchpoint.getCondition().getExpression(), + false ); + getBreakpoints().put( watchpoint, cdiWatchpoint ); + ((CBreakpoint)watchpoint).register( true ); } 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, * or null if not found. @@ -1721,7 +1767,7 @@ public class CDebugTarget extends CDebugElement * * @param breakpoints breakpoints map */ - private void initializeBreakpoints( HashMap breakpoints ) + private void initializeBreakpointMap( HashMap breakpoints ) { fBreakpoints = breakpoints; } @@ -1750,14 +1796,10 @@ public class CDebugTarget extends CDebugElement { try { - ICDIBreakpoint cdiBreakpoint = ((CBreakpoint)breakpoint).getExternalBreakpoint(); + ICDIBreakpoint cdiBreakpoint = (ICDIBreakpoint)getBreakpoints().get( breakpoint ); if ( cdiBreakpoint == null ) { - setLineBreakpoint0( breakpoint ); - } - else - { - getBreakpoints().put( breakpoint, cdiBreakpoint ); + cdiBreakpoint = setLineBreakpoint0( breakpoint ); } ((CBreakpoint)breakpoint).incrementInstallCount(); 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(); ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() ); ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() ); ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null ); getBreakpoints().put( breakpoint, cdiBreakpoint ); + return cdiBreakpoint; } private void setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws DebugException { try { - ICDIBreakpoint cdiBreakpoint = ((CBreakpoint)breakpoint).getExternalBreakpoint(); + ICDIBreakpoint cdiBreakpoint = (ICDIBreakpoint)getBreakpoints().get( breakpoint ); if ( cdiBreakpoint == null ) { - setAddressBreakpoint0( breakpoint ); - } - else - { - getBreakpoints().put( breakpoint, cdiBreakpoint ); + cdiBreakpoint = setAddressBreakpoint0( breakpoint ); } ((CBreakpoint)breakpoint).incrementInstallCount(); 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(); ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) ); ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() ); ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null ); getBreakpoints().put( breakpoint, cdiBreakpoint ); + return cdiBreakpoint; } private void setWatchpoint( ICWatchpoint watchpoint ) throws DebugException { try { - ICDIWatchpoint cdiWatchpoint = (ICDIWatchpoint)((CWatchpoint)watchpoint).getExternalBreakpoint(); + ICDIWatchpoint cdiWatchpoint = (ICDIWatchpoint)getBreakpoints().get( watchpoint ); if ( cdiWatchpoint == null ) { - setWatchpoint0( watchpoint ); - } - else - { - getBreakpoints().put( watchpoint, cdiWatchpoint ); + cdiWatchpoint = setWatchpoint0( watchpoint ); } ((CBreakpoint)watchpoint).incrementInstallCount(); 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(); ICDICondition condition = bm.createCondition( watchpoint.getIgnoreCount(), watchpoint.getCondition() ); @@ -1865,6 +1901,7 @@ public class CDebugTarget extends CDebugElement String expression = watchpoint.getExpression(); ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition ); getBreakpoints().put( watchpoint, cdiWatchpoint ); + return cdiWatchpoint; } private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint )