From 3496b65bc6a6302e9afeb6f91f2853e20c403b5b Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Wed, 4 Sep 2002 15:43:56 +0000 Subject: [PATCH] More implementation of breakpoints. --- debug/org.eclipse.cdt.debug.core/plugin.xml | 14 +++--- .../eclipse/cdt/debug/core/ICBreakpoint.java | 32 +++++++++++--- .../core/breakpoints/CBreakpoint.java | 28 ------------ .../internal/core/model/CDebugTarget.java | 43 +++++++++++++++++++ 4 files changed, 76 insertions(+), 41 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml index 35bbfb4fcc7..f0d2bd64f4b 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.core/plugin.xml @@ -29,16 +29,16 @@ value="true"> + name="org.eclipse.cdt.debug.core.condition"> + name="org.eclipse.cdt.debug.core.ignoreCount"> + name="org.eclipse.cdt.debug.core.threadId"> + name="org.eclipse.cdt.debug.core.installCount"> + name="org.eclipse.cdt.debug.core.address"> + name="org.eclipse.cdt.debug.core.function"> + name="org.eclipse.cdt.debug.core.expression"> "org.eclipse.cdt.debug.core.installCount"). + * This attribute is a int. */ - public static final String CONDITION = "condition"; //$NON-NLS-1$ - public static final String IGNORE_COUNT = "ignoreCount"; //$NON-NLS-1$ - public static final String THREAD_ID = "threadId"; //$NON-NLS-1$ - public static final String INSTALL_COUNT = "installCount"; //$NON-NLS-1$ + public 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. + */ + public 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. + */ + public 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. + */ + public static final String THREAD_ID = "org.eclipse.cdt.debug.core.threadId"; //$NON-NLS-1$ /** * Returns whether this breakpoint is installed in at least 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 a39341f4c99..201203d7299 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 @@ -33,34 +33,6 @@ 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. */ 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 cb405c8e056..c0f3d176eb3 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 @@ -573,6 +573,15 @@ public class CDebugTarget extends CDebugElement */ public void breakpointChanged( IBreakpoint breakpoint, IMarkerDelta delta ) { + try + { + if ( breakpoint instanceof CBreakpoint ) + changeBreakpointProperties( (CBreakpoint)breakpoint, delta ); + } + catch( DebugException e ) + { + CDebugCorePlugin.log( e ); + } } /** @@ -1031,6 +1040,40 @@ public class CDebugTarget extends CDebugElement } } + protected void changeBreakpointProperties( CBreakpoint breakpoint, IMarkerDelta delta ) throws DebugException + { + ICDIBreakpoint cdiBreakpoint = findCDIBreakpoint( breakpoint ); + if ( cdiBreakpoint == null ) + return; + ICDIBreakpointManager bm = getCDISession().getBreakpointManager(); + try + { + boolean enabled = breakpoint.isEnabled(); + boolean oldEnabled = delta.getAttribute( IBreakpoint.ENABLED, true ); + int ignoreCount = breakpoint.getIgnoreCount(); + int oldIgnoreCount = delta.getAttribute( ICBreakpoint.IGNORE_COUNT, 0 ); + String condition = breakpoint.getCondition(); + String oldCondition = delta.getAttribute( ICBreakpoint.CONDITION, "" ); + if ( enabled != oldEnabled ) + { + cdiBreakpoint.setEnabled( enabled ); + } + if ( ignoreCount != oldIgnoreCount || !condition.equals( oldCondition ) ) + { + ICDICondition cdiCondition = bm.createCondition( ignoreCount, condition ); + cdiBreakpoint.setCondition( cdiCondition ); + } + } + catch( CoreException ce ) + { + requestFailed( "Operation failed. Reason: ", ce ); + } + catch( CDIException e ) + { + requestFailed( "Operation failed. Reason: ", e ); + } + } + /** * Creates, adds and returns a thread for the given underlying * CDI thread. A creation event is fired for the thread.