Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java2083
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java5
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java7
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java5
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java7
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java25
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java4
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java4
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java8
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java137
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java36
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java8
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java14
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java17
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java14
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java18
20 files changed, 1462 insertions, 954 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
index ea88c2b8ef5..43539805dc7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
@@ -29,11 +29,13 @@ import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint2;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
+import org.eclipse.cdt.debug.core.model.ICTracepoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
@@ -63,6 +65,7 @@ import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.debug.core.model.IProcess;
/**
@@ -71,747 +74,1345 @@ import org.eclipse.debug.core.model.IProcess;
*/
public class CDIDebugModel {
- /**
- * Returns the identifier for the CDI debug model plug-in
- *
- * @return plugin identifier
- */
- public static String getPluginIdentifier() {
- return CDebugCorePlugin.getUniqueIdentifier();
- }
-
- /**
- * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
- * target is added to the given launch.
- *
- * @param launch the launch the new debug target will be contained in
- * @param project the project to use to persist breakpoints.
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
- * @param file the executable to debug.
- * @param allowTerminate allow terminate().
- * @param allowDisconnect allow disconnect().
- * @param stopSymbol place temporary breakpoint at <code>stopSymbol</code>, ignore if <code>null</code> or empty.
- * @param resumeTarget resume target.
- * @return a debug target
- * @throws DebugException
- * @since 3.1
- */
- public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, final boolean allowDisconnect, final String stopSymbol, final boolean resumeTarget ) throws DebugException {
- final IDebugTarget[] target = new IDebugTarget[1];
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
-
- @Override
- public void run( IProgressMonitor m ) throws CoreException {
- target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
- ((CDebugTarget)target[0]).start( stopSymbol, resumeTarget );
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( r, null );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e );
- throw new DebugException( e.getStatus() );
- }
- return target[0];
- }
-
- /**
- * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
- * target is added to the given launch.
- *
- * @param launch the launch the new debug target will be contained in
- * @param project the project to use to persist breakpoints.
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
- * @param file the executable to debug.
- * @param allowTerminate allow terminate().
- * @param allowDisconnect allow disconnect().
- * @param stopInMain place temporary breakpoint at main()
- * @param resumeTarget resume target.
- * @return a debug target
- * @throws DebugException
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget ) throws DebugException {
- final IDebugTarget[] target = new IDebugTarget[1];
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
-
- @Override
- public void run( IProgressMonitor m ) throws CoreException {
- String stopSymbol = null;
- if ( stopInMain )
- stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
- target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
- ((CDebugTarget)target[0]).start( stopSymbol, resumeTarget );
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( r, null );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e );
- throw new DebugException( e.getStatus() );
- }
- return target[0];
- }
-
- /**
- * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
- * target is added to the given launch.
- *
- * @param launch the launch the new debug target will be contained in
- * @param project the project to use to persist breakpoints.
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
- * @param file the executable to debug.
- * @param allowTerminate allow terminate().
- * @param allowDisconnect allow disconnect().
- * @param resumeTarget resume target.
- * @return a debug target
- * @throws DebugException
- */
- public static IDebugTarget newDebugTarget( ILaunch launch, IProject project, ICDITarget cdiTarget, final String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowTerminate, boolean allowDisconnect, boolean resumeTarget ) throws DebugException {
- return newDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, null, resumeTarget );
- }
-
- /**
- * Creates and returns a line breakpoint for the source defined by the given source handle, at the given line number. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param sourceHandle
- * the handle to the breakpoint source
- * @param resource
- * the resource on which to create the associated breakpoint marker
- * @param lineNumber
- * the line number on which the breakpoint is set - line numbers are 1 based, associated with the source file in which the breakpoint is set
- * @param enabled
- * whether to enable or disable this breakpoint
- * @param ignoreCount
- * the number of times this breakpoint will be ignored
- * @param condition
- * the breakpoint condition
- * @param register
- * whether to add this breakpoint to the breakpoint manager
- * @return a line breakpoint
- * @throws CoreException
- * if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's status contains the underlying exception responsible for the failure.</li>
- * </ul>
- * @deprecated as of CDT 5.0 use {@link #createLineBreakpoint(String, IResource, int, int, boolean, int, String, boolean)}
- */
- @Deprecated
- public static ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createLineBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, lineNumber, enabled, ignoreCount, condition, register);
- }
-
- /**
- * Creates and returns a line breakpoint for the source defined by the given source handle, at the given line number. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param sourceHandle
- * the handle to the breakpoint source
- * @param resource
- * the resource on which to create the associated breakpoint marker
- * @param type
- * a type constant from ICBreakpointType
- * @param lineNumber
- * the line number on which the breakpoint is set - line numbers are 1 based, associated with the source file in which the breakpoint is set
- * @param enabled
- * whether to enable or disable this breakpoint
- * @param ignoreCount
- * the number of times this breakpoint will be ignored
- * @param condition
- * the breakpoint condition
- * @param register
- * whether to add this breakpoint to the breakpoint manager
- * @return a line breakpoint
- * @throws CoreException
- * if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's status contains the underlying exception responsible for the failure.</li>
- * </ul>
- */
- public static ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, int type, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setLineBreakpointAttributes( attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition );
- return new CLineBreakpoint( resource, attributes, register );
- }
-
- /**
- * @since 7.0
- */
- public static ICLineBreakpoint createLineTracepoint( String sourceHandle, IResource resource, int type, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setLineBreakpointAttributes( attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition );
- return new CLineTracepoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common line breakpoint attributes.
- */
- private static void setLineBreakpointAttributes( HashMap<String, Object> attributes,
- String sourceHandle,
- Integer type,
- int lineNumber,
- boolean enabled,
- int ignoreCount,
- String condition ) {
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
- attributes.put( IBreakpoint.ENABLED, Boolean.valueOf( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- attributes.put( ICBreakpointType.TYPE, type );
-
- // Added for source relocated breakpoints.
- if (!attributes.containsKey(ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE)) {
- attributes.put( ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE, sourceHandle );
- }
- if (!attributes.containsKey( ICLineBreakpoint2.REQUESTED_LINE )) {
- attributes.put( ICLineBreakpoint2.REQUESTED_LINE, new Integer( lineNumber ));
- }
- if (attributes.containsKey(IMarker.CHAR_START) &&
- !attributes.containsKey( ICLineBreakpoint2.REQUESTED_CHAR_START ))
- {
- attributes.put( ICLineBreakpoint2.REQUESTED_CHAR_START, attributes.get(IMarker.CHAR_START));
+ /**
+ * Returns the identifier for the CDI debug model plug-in
+ *
+ * @return plugin identifier
+ */
+ public static String getPluginIdentifier() {
+ return CDebugCorePlugin.getUniqueIdentifier();
+ }
+
+ /**
+ * Creates and returns a debug target for the given CDI target, with the
+ * specified name, and associates it with the given process for console I/O.
+ * The debug target is added to the given launch.
+ *
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param project
+ * the project to use to persist breakpoints.
+ * @param cdiTarget
+ * the CDI target to create a debug target for
+ * @param name
+ * the name to associate with this target, which will be returned
+ * from <code>IDebugTarget.getName</code>.
+ * @param debuggeeProcess
+ * the process to associate with the debug target, which will be
+ * returned from <code>IDebugTarget.getProcess</code>
+ * @param file
+ * the executable to debug.
+ * @param allowTerminate
+ * allow terminate().
+ * @param allowDisconnect
+ * allow disconnect().
+ * @param stopSymbol
+ * place temporary breakpoint at <code>stopSymbol</code>, ignore
+ * if <code>null</code> or empty.
+ * @param resumeTarget
+ * resume target.
+ * @return a debug target
+ * @throws DebugException
+ * @since 3.1
+ */
+ public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget,
+ final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate,
+ final boolean allowDisconnect, final String stopSymbol, final boolean resumeTarget) throws DebugException {
+ final IDebugTarget[] target = new IDebugTarget[1];
+ IWorkspaceRunnable r = new IWorkspaceRunnable() {
+
+ @Override
+ public void run(IProgressMonitor m) throws CoreException {
+ target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate,
+ allowDisconnect);
+ ((CDebugTarget) target[0]).start(stopSymbol, resumeTarget);
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(r, null);
+ } catch (CoreException e) {
+ CDebugCorePlugin.log(e);
+ throw new DebugException(e.getStatus());
+ }
+ return target[0];
+ }
+
+ /**
+ * Creates and returns a debug target for the given CDI target, with the
+ * specified name, and associates it with the given process for console I/O.
+ * The debug target is added to the given launch.
+ *
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param project
+ * the project to use to persist breakpoints.
+ * @param cdiTarget
+ * the CDI target to create a debug target for
+ * @param name
+ * the name to associate with this target, which will be returned
+ * from <code>IDebugTarget.getName</code>.
+ * @param debuggeeProcess
+ * the process to associate with the debug target, which will be
+ * returned from <code>IDebugTarget.getProcess</code>
+ * @param file
+ * the executable to debug.
+ * @param allowTerminate
+ * allow terminate().
+ * @param allowDisconnect
+ * allow disconnect().
+ * @param stopInMain
+ * place temporary breakpoint at main()
+ * @param resumeTarget
+ * resume target.
+ * @return a debug target
+ * @throws DebugException
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget,
+ final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate,
+ final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget) throws DebugException {
+ final IDebugTarget[] target = new IDebugTarget[1];
+ IWorkspaceRunnable r = new IWorkspaceRunnable() {
+
+ @Override
+ public void run(IProgressMonitor m) throws CoreException {
+ String stopSymbol = null;
+ if (stopInMain)
+ stopSymbol = launch.getLaunchConfiguration().getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+ target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate,
+ allowDisconnect);
+ ((CDebugTarget) target[0]).start(stopSymbol, resumeTarget);
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(r, null);
+ } catch (CoreException e) {
+ CDebugCorePlugin.log(e);
+ throw new DebugException(e.getStatus());
+ }
+ return target[0];
+ }
+
+ /**
+ * Creates and returns a debug target for the given CDI target, with the
+ * specified name, and associates it with the given process for console I/O.
+ * The debug target is added to the given launch.
+ *
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param project
+ * the project to use to persist breakpoints.
+ * @param cdiTarget
+ * the CDI target to create a debug target for
+ * @param name
+ * the name to associate with this target, which will be returned
+ * from <code>IDebugTarget.getName</code>.
+ * @param debuggeeProcess
+ * the process to associate with the debug target, which will be
+ * returned from <code>IDebugTarget.getProcess</code>
+ * @param file
+ * the executable to debug.
+ * @param allowTerminate
+ * allow terminate().
+ * @param allowDisconnect
+ * allow disconnect().
+ * @param resumeTarget
+ * resume target.
+ * @return a debug target
+ * @throws DebugException
+ */
+ public static IDebugTarget newDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget,
+ final String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowTerminate,
+ boolean allowDisconnect, boolean resumeTarget) throws DebugException {
+ return newDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect,
+ null, resumeTarget);
+ }
+
+ /**
+ * Calculates breakpoint marker ID based on the breakpoint object type.
+ *
+ * @since 7.2
+ */
+ public static String calculateMarkerType(IBreakpoint bp) {
+ if (bp instanceof ICBreakpoint2) {
+ return ((ICBreakpoint2) bp).getMarkerType();
+ }
+ if (bp instanceof ICTracepoint) {
+ if (bp instanceof ICFunctionBreakpoint) {
+ return ICTracepoint.C_FUNCTION_TRACEPOINT_MARKER;
+ } else if (bp instanceof ICAddressBreakpoint) {
+ return ICTracepoint.C_ADDRESS_TRACEPOINT_MARKER;
+ } else if (bp instanceof ICLineBreakpoint) {
+ return ICTracepoint.C_LINE_TRACEPOINT_MARKER;
+ } else {
+ return ICTracepoint.C_TRACEPOINT_MARKER;
+ }
+ } else if (bp instanceof ICFunctionBreakpoint) {
+ return ICFunctionBreakpoint.C_FUNCTION_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICAddressBreakpoint) {
+ return ICAddressBreakpoint.C_ADDRESS_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICLineBreakpoint) {
+ return ICLineBreakpoint.C_LINE_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICEventBreakpoint) {
+ return ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICBreakpoint) {
+ return ICBreakpoint.C_BREAKPOINT_MARKER;
+ } else if (bp instanceof ILineBreakpoint) {
+ return IBreakpoint.LINE_BREAKPOINT_MARKER;
+ }
+ return IBreakpoint.BREAKPOINT_MARKER;
+ }
+
+ /**
+ * Creates and returns a line breakpoint for the source defined by the given
+ * source handle, at the given line number. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param lineNumber
+ * the line number on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a line breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @deprecated as of CDT 5.0 use
+ * {@link #createLineBreakpoint(String, IResource, int, int, boolean, int, String, boolean)}
+ */
+ @Deprecated
+ public static ICLineBreakpoint createLineBreakpoint(String sourceHandle, IResource resource, int lineNumber,
+ boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ return createLineBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, lineNumber, enabled, ignoreCount,
+ condition, register);
+ }
+
+ /**
+ * Creates and returns a line breakpoint for the source defined by the given
+ * source handle, at the given line number. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param lineNumber
+ * the line number on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a line breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICLineBreakpoint createLineBreakpoint(String sourceHandle, IResource resource, int type,
+ int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ return new CLineBreakpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICLineBreakpoint createBlankLineBreakpoint() {
+ return new CLineBreakpoint();
+ }
+
+ /**
+ * @since 7.0
+ */
+ public static ICLineBreakpoint createLineTracepoint(String sourceHandle, IResource resource, int type,
+ int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ return new CLineTracepoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICLineBreakpoint createBlankLineTracepoint() {
+ return new CLineTracepoint();
+ }
+
+ /**
+ * Helper function for setting common line breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param sourceHandle
+ * The handle to the breakpoint source.
+ * @param resource
+ * The resource on which to create the associated breakpoint
+ * marker.
+ * @param type
+ * A type constant from ICBreakpointType.
+ * @param lineNumber
+ * The line number on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set.
+ * @param enabled
+ * Whether to enable or disable this breakpoint.
+ * @param ignoreCount
+ * The number of times this breakpoint will be ignored.
+ * @param condition
+ * The breakpoint condition.
+ * @param register
+ * Whether to add this breakpoint to the breakpoint manager.
+ *
+ * @since 7.2
+ */
+ public static void setLineBreakpointAttributes(Map<String, Object> attributes, String sourceHandle, Integer type,
+ int lineNumber, boolean enabled, int ignoreCount, String condition) {
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
+ attributes.put(IBreakpoint.ENABLED, Boolean.valueOf(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ attributes.put(ICBreakpointType.TYPE, type);
+
+ // Added for source relocated breakpoints.
+ if (!attributes.containsKey(ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE, sourceHandle);
}
- if (attributes.containsKey(IMarker.CHAR_END) &&
- !attributes.containsKey( ICLineBreakpoint2.REQUESTED_CHAR_END ))
- {
- attributes.put( ICLineBreakpoint2.REQUESTED_CHAR_END, attributes.get(IMarker.CHAR_END));
+ if (!attributes.containsKey(ICLineBreakpoint2.REQUESTED_LINE)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_LINE, new Integer(lineNumber));
}
- }
-
- /**
- * Creates and returns an address breakpoint for the source defined by the
- * given source handle, at the given address. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param module the module name the breakpoint is set in
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param address the address on which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- * @deprecated as of CDT 5.0 use {@link #createAddressBreakpoint(String, String, IResource, int, int, IAddress, boolean, int, String, boolean)}
- */
- @Deprecated
- public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createAddressBreakpoint( module, sourceHandle, resource, ICBreakpointType.REGULAR, -1, address, enabled, ignoreCount, condition, register );
- }
-
- /**
- * Creates and returns an address breakpoint for the source defined by the
- * given source handle, at the given address. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param module the module name the breakpoint is set in
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param type a type constant from ICBreakpointType
- * @param address the address on which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, int type, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createAddressBreakpoint( module, sourceHandle, resource, type, -1, address, enabled, ignoreCount, condition, register );
- }
-
- /**
- * Creates and returns an address breakpoint for the source defined by the
- * given source handle, at the given address. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param module the module name the breakpoint is set in
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param type a type constant from ICBreakpointType
- * @param lineNumber the line number in the source file
- * @param address the address on which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setAddressBreakpointAttributes( attributes, module, sourceHandle, type, lineNumber, address, enabled, ignoreCount, condition );
- return new CAddressBreakpoint( resource, attributes, register );
- }
-
- /**
- * @since 7.0
- */
- public static ICAddressBreakpoint createAddressTracepoint( String module, String sourceHandle, IResource resource, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setAddressBreakpointAttributes( attributes, module, sourceHandle, type, lineNumber, address, enabled, ignoreCount, condition );
- return new CAddressTracepoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common address breakpoint attributes.
- */
- private static void setAddressBreakpointAttributes( HashMap<String, Object> attributes,
- String module,
- String sourceHandle,
- int type,
- int lineNumber,
- IAddress address,
- boolean enabled,
- int ignoreCount,
- String condition ) {
- setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
- attributes.put( IMarker.CHAR_START, new Integer( -1 ) );
- attributes.put( IMarker.CHAR_END, new Integer( -1 ) );
- attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
- attributes.put( ICBreakpoint.MODULE, module );
- }
-
- /**
- * Creates and returns a watchpoint for the source defined by the given
- * source handle, at the given expression. The marker associated with the
- * watchpoint will be created on the specified resource.
- *
- * @param sourceHandle the handle to the watchpoint source
- * @param resource the resource on which to create the associated watchpoint marker
- * @param writeAccess whether this is write watchpoint
- * @param readAccess whether this is read watchpoint
- * @param expression the expression on which the watchpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return a watchpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", BigInteger.ZERO, enabled, ignoreCount, condition, register ); //$NON-NLS-1$
- return new CWatchpoint( resource, attributes, register );
- }
-
- /**
- * Creates and returns a watchpoint for the source defined by the given
- * source handle, at the given expression. The marker associated with the
- * watchpoint will be created on the specified resource.
- *
- * @param sourceHandle the handle to the watchpoint source
- * @param resource the resource on which to create the associated watchpoint marker
- * @param charStart the first character index associated with the watchpoint, or
- * -1 if unspecified, in the source file in which the watchpoint
- * is set
- * @param charEnd the last character index associated with the watchpoint, or -1
- * if unspecified, in the source file in which the watchpoint is
- * set
- * @param lineNumber the lineNumber on which the watchpoint is set, or -1 if
- * unspecified - line numbers are 1 based, associated with the
- * source file in which the watchpoint is set
- * @param writeAccess whether this is write watchpoint
- * @param readAccess whether this is read watchpoint
- * @param expression the expression on which the watchpoint is set
- * @param memorySpace the memory space in which the watchpoint is set
- * @param range the range of the watchpoint in addressable units
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return a watchpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, int charStart, int charEnd, int lineNumber, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
- attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
- attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
- attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
- return new CWatchpoint( resource, attributes, register );
- }
-
- /**
- * Creates and returns a watchpoint for the source defined by the given
- * source handle, at the given expression and over the given range.
- * The marker associated with the watchpoint will be created on the
- * specified resource.
- *
- * @param sourceHandle the handle to the watchpoint source
- * @param resource the resource on which to create the associated watchpoint marker
- * @param writeAccess whether this is write watchpoint
- * @param readAccess whether this is read watchpoint
- * @param expression the expression on which the watchpoint is set
- * @param memorySpace the memory space in which the watchpoint is set
- * @param range the range of the watchpoint in addressable units
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return the watchpoint that was created
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
- return new CWatchpoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common watchpoint attributes.
- */
- private static void setWatchPointAttributes( HashMap<String, Object> attributes, String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) {
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IBreakpoint.ENABLED, Boolean.valueOf( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- attributes.put( ICWatchpoint.EXPRESSION, expression );
- attributes.put( ICWatchpoint2.MEMORYSPACE, memorySpace );
- attributes.put( ICWatchpoint2.RANGE, range.toString() );
- attributes.put( ICWatchpoint.READ, Boolean.valueOf( readAccess ) );
- attributes.put( ICWatchpoint.WRITE, Boolean.valueOf( writeAccess ) );
- }
-
- /**
- * Creates and returns a breakpoint for the function defined by the given
- * name. The marker associated with the breakpoint will be created on the
- * specified resource.
- *
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param function the name of the function this breakpoint suspends execution in
- * @param charStart the first character index associated with the breakpoint, or
- * -1 if unspecified, in the source file in which the breakpoint
- * is set
- * @param charEnd the last character index associated with the breakpoint, or -1
- * if unspecified, in the source file in which the breakpoint is
- * set
- * @param lineNumber the lineNumber on which the breakpoint is set, or -1 if
- * unspecified - line numbers are 1 based, associated with the
- * source file in which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- * @deprecated as of CDT 5.0 use {@link #createFunctionBreakpoint(String, IResource, int, String, int, int, int, boolean, int, String, boolean)}
- */
- @Deprecated
- public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createFunctionBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition, register);
- }
-
- /**
- * Creates and returns a breakpoint for the function defined by the given
- * name. The marker associated with the breakpoint will be created on the
- * specified resource.
- *
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param type a type constant from ICBreakpointType
- * @param function the name of the function this breakpoint suspends execution in
- * @param charStart the first character index associated with the breakpoint, or
- * -1 if unspecified, in the source file in which the breakpoint
- * is set
- * @param charEnd the last character index associated with the breakpoint, or -1
- * if unspecified, in the source file in which the breakpoint is
- * set
- * @param lineNumber the lineNumber on which the breakpoint is set, or -1 if
- * unspecified - line numbers are 1 based, associated with the
- * source file in which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, int type, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setFunctionBreakpointAttributes( attributes, sourceHandle, type, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition);
- return new CFunctionBreakpoint( resource, attributes, register );
- }
-
- /**
- * @since 7.0
- */
- public static ICFunctionBreakpoint createFunctionTracepoint( String sourceHandle, IResource resource, int type, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setFunctionBreakpointAttributes( attributes, sourceHandle, type, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition);
- return new CFunctionTracepoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common address breakpoint attributes.
- */
- private static void setFunctionBreakpointAttributes( HashMap<String, Object> attributes,
- String sourceHandle,
- int type,
- String function,
- int charStart,
- int charEnd,
- int lineNumber,
- boolean enabled,
- int ignoreCount,
- String condition ) {
- setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
- attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
- attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
- attributes.put( ICLineBreakpoint.FUNCTION, function );
- }
-
- /**
- * Returns the line breakpoint that is already registered with the
- * breakpoint manager for a source with the given handle and the given
- * resource at the given line number.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param lineNumber the line number
- * @return the line breakpoint that is already registered with the
- * breakpoint manager or <code>null</code> if no such breakpoint
- * is registered
- * @exception CoreException if unable to retrieve the associated marker attributes (line number).
- */
- public static ICLineBreakpoint lineBreakpointExists( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- String modelId = getPluginIdentifier();
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICLineBreakpoint) ) {
- continue;
- }
- ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
- if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getLineNumber() == lineNumber ) {
- return breakpoint;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the watchpoint that is already registered with the breakpoint
- * manager for a source with the given handle and the given resource at the
- * given expression.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param expression the expression
- * @return the watchpoint that is already registered with the breakpoint
- * manager or <code>null</code> if no such watchpoint is
- * registered
- * @exception CoreException if unable to retrieve the associated marker attributes (line number).
- */
- public static ICWatchpoint watchpointExists( String sourceHandle, IResource resource, String expression ) throws CoreException {
- String modelId = getPluginIdentifier();
- String markerType = CWatchpoint.getMarkerType();
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICWatchpoint) ) {
- continue;
- }
- ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i];
- if ( breakpoint.getMarker().getType().equals( markerType ) ) {
- if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getMarker().getResource().equals( resource ) ) {
- if ( breakpoint.getExpression().equals( expression ) ) {
- return breakpoint;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the function breakpoint that is already registered with the
- * breakpoint manager for a source with the given handle and the given
- * resource with the given function name.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param function the fully qualified function name
- * @return the breakpoint that is already registered with the breakpoint
- * manager or <code>null</code> if no such breakpoint is
- * registered
- * @exception CoreException if unable to retrieve the associated marker attributes (line number).
- */
- public static ICFunctionBreakpoint functionBreakpointExists( String sourceHandle, IResource resource, String function ) throws CoreException {
- String modelId = getPluginIdentifier();
- String markerType = CFunctionBreakpoint.getMarkerType();
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICFunctionBreakpoint) ) {
- continue;
- }
- ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
- if ( breakpoint.getMarker().getType().equals( markerType ) ) {
- if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getMarker().getResource().equals( resource ) ) {
- if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( function ) ) {
- return breakpoint;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess iprocess, IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain ) throws CoreException {
- IBinaryExecutable exeFile = getBinary( file );
- String stopSymbol = null;
- if ( stopInMain )
- stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
- return newDebugTarget( launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, allowDisconnect, stopSymbol, true );
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newAttachDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess debuggerProcess, IFile file ) throws CoreException {
- IBinaryExecutable exeFile = getBinary( file );
- return newDebugTarget( launch, file.getProject(), target, name, null, exeFile, true, true, false );
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, final ICDITarget target, final String name, final IProcess debuggerProcess, final IFile file ) throws CoreException {
- IBinaryExecutable exeFile = getBinary( file );
- return newDebugTarget( launch, file.getProject(), target, name, null, exeFile, true, false, false );
- }
-
- private static IBinaryExecutable getBinary( IFile file ) throws CoreException {
- IProject project = file.getProject();
- ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( project );
- for( int i = 0; i < binaryParsersExt.length; i++ ) {
- IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]);
- try {
- IBinaryFile exe = parser.getBinary( file.getLocation() );
- if ( exe instanceof IBinaryExecutable ) {
- return (IBinaryExecutable)exe;
- }
- }
- catch( IOException e ) {
- }
- }
- throw new CoreException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, DebugCoreMessages.getString( "CDIDebugModel.0" ), null ) ); //$NON-NLS-1$
- }
-
- private static boolean sameSourceHandle( String handle1, String handle2 ) {
- if ( handle1 == null || handle2 == null )
- return false;
- IPath path1 = new Path( handle1 );
- IPath path2 = new Path( handle2 );
- if ( path1.isValidPath( handle1 ) && path2.isValidPath( handle2 ) ) {
- return path1.equals( path2 );
- }
- // If handles are not file names ????
- return handle1.equals( handle2 );
- }
-
- public static ICEventBreakpoint eventBreakpointExists(String type, String arg ) throws CoreException {
- String modelId = getPluginIdentifier();
-
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
- for (int i = 0; i < breakpoints.length; i++) {
- if (!(breakpoints[i] instanceof ICEventBreakpoint)) {
- continue;
- }
- ICEventBreakpoint breakpoint = (ICEventBreakpoint) breakpoints[i];
-
- if (breakpoint.getEventType().equals(type)) {
- String arg1 = breakpoint.getEventArgument();
- if (arg1 == null)
- arg1 = ""; //$NON-NLS-1$
- String arg2 = arg == null ? "" : arg; //$NON-NLS-1$
- if (arg1.equals(arg2))
- return breakpoint;
- }
-
- }
- return null;
- }
- public static ICEventBreakpoint createEventBreakpoint(String type, String arg, boolean register)
- throws CoreException {
- final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- final Map<String,Object> attributes = new HashMap<String,Object>();
- attributes.put(IBreakpoint.ID, CDIDebugModel.getPluginIdentifier());
- attributes.put(IBreakpoint.ENABLED, true);
- attributes.put(ICBreakpoint.IGNORE_COUNT, 0);
- attributes.put(ICBreakpoint.CONDITION, ""); //$NON-NLS-1$
- attributes.put(ICEventBreakpoint.EVENT_TYPE_ID, type);
- attributes.put(ICEventBreakpoint.EVENT_ARG, arg);
- return new CEventBreakpoint(resource, attributes, register);
-
- }
+ if (attributes.containsKey(IMarker.CHAR_START)
+ && !attributes.containsKey(ICLineBreakpoint2.REQUESTED_CHAR_START)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_CHAR_START, attributes.get(IMarker.CHAR_START));
+ }
+ if (attributes.containsKey(IMarker.CHAR_END) && !attributes.containsKey(ICLineBreakpoint2.REQUESTED_CHAR_END)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_CHAR_END, attributes.get(IMarker.CHAR_END));
+ }
+ }
+
+ /**
+ * Creates and returns an address breakpoint for the source defined by the
+ * given source handle, at the given address. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @deprecated as of CDT 5.0 use
+ * {@link #createAddressBreakpoint(String, String, IResource, int, int, IAddress, boolean, int, String, boolean)}
+ */
+ @Deprecated
+ public static ICAddressBreakpoint createAddressBreakpoint(String module, String sourceHandle, IResource resource,
+ IAddress address, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ return createAddressBreakpoint(module, sourceHandle, resource, ICBreakpointType.REGULAR, -1, address, enabled,
+ ignoreCount, condition, register);
+ }
+
+ /**
+ * Creates and returns an address breakpoint for the source defined by the
+ * given source handle, at the given address. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICAddressBreakpoint createAddressBreakpoint(String module, String sourceHandle, IResource resource,
+ int type, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ return createAddressBreakpoint(module, sourceHandle, resource, type, -1, address, enabled, ignoreCount,
+ condition, register);
+ }
+
+ /**
+ * Creates and returns an address breakpoint for the source defined by the
+ * given source handle, at the given address. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param lineNumber
+ * the line number in the source file
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICAddressBreakpoint createAddressBreakpoint(String module, String sourceHandle, IResource resource,
+ int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setAddressBreakpointAttributes(attributes, module, sourceHandle, type, lineNumber, address, enabled,
+ ignoreCount, condition);
+ return new CAddressBreakpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICAddressBreakpoint createBlankAddressBreakpoint() {
+ return new CAddressBreakpoint();
+ }
+
+ /**
+ * @since 7.0
+ */
+ public static ICAddressBreakpoint createAddressTracepoint(String module, String sourceHandle, IResource resource,
+ int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setAddressBreakpointAttributes(attributes, module, sourceHandle, type, lineNumber, address, enabled,
+ ignoreCount, condition);
+ return new CAddressTracepoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICAddressBreakpoint createBlankAddressTracepoint() {
+ return new CAddressTracepoint();
+ }
+
+ /**
+ * Helper function for setting common address breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param lineNumber
+ * the line number in the source file
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setAddressBreakpointAttributes(Map<String, Object> attributes, String module,
+ String sourceHandle, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount,
+ String condition) {
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ attributes.put(IMarker.CHAR_START, new Integer(-1));
+ attributes.put(IMarker.CHAR_END, new Integer(-1));
+ attributes.put(ICLineBreakpoint.ADDRESS, address.toHexAddressString());
+ attributes.put(ICBreakpoint.MODULE, module);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICWatchpoint createBlankWatchpoint() {
+ return new CWatchpoint();
+ }
+
+ /**
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression. The marker associated with the
+ * watchpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a watchpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, boolean writeAccess,
+ boolean readAccess, String expression, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", //$NON-NLS-1$
+ BigInteger.ZERO, enabled, ignoreCount, condition);
+ return new CWatchpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression. The marker associated with the
+ * watchpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param charStart
+ * the first character index associated with the watchpoint, or
+ * -1 if unspecified, in the source file in which the watchpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the watchpoint, or -1
+ * if unspecified, in the source file in which the watchpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the watchpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the watchpoint is set
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param memorySpace
+ * the memory space in which the watchpoint is set
+ * @param range
+ * the range of the watchpoint in addressable units
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a watchpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, int charStart, int charEnd,
+ int lineNumber, boolean writeAccess, boolean readAccess, String expression, String memorySpace,
+ BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace,
+ range, enabled, ignoreCount, condition);
+ attributes.put(IMarker.CHAR_START, new Integer(charStart));
+ attributes.put(IMarker.CHAR_END, new Integer(charEnd));
+ attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
+ return new CWatchpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression and over the given range. The
+ * marker associated with the watchpoint will be created on the specified
+ * resource.
+ *
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param memorySpace
+ * the memory space in which the watchpoint is set
+ * @param range
+ * the range of the watchpoint in addressable units
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return the watchpoint that was created
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, boolean writeAccess,
+ boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace,
+ range, enabled, ignoreCount, condition);
+ return new CWatchpoint(resource, attributes, register);
+ }
+
+ /**
+ * Helper function for setting common watchpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param memorySpace
+ * the memory space in which the watchpoint is set
+ * @param range
+ * the range of the watchpoint in addressable units
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setWatchPointAttributes(Map<String, Object> attributes, String sourceHandle, IResource resource,
+ boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range,
+ boolean enabled, int ignoreCount, String condition) {
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IBreakpoint.ENABLED, Boolean.valueOf(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ attributes.put(ICWatchpoint.EXPRESSION, expression);
+ attributes.put(ICWatchpoint2.MEMORYSPACE, memorySpace);
+ attributes.put(ICWatchpoint2.RANGE, range.toString());
+ attributes.put(ICWatchpoint.READ, Boolean.valueOf(readAccess));
+ attributes.put(ICWatchpoint.WRITE, Boolean.valueOf(writeAccess));
+ }
+
+ /**
+ * Creates and returns a breakpoint for the function defined by the given
+ * name. The marker associated with the breakpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @deprecated as of CDT 5.0 use
+ * {@link #createFunctionBreakpoint(String, IResource, int, String, int, int, int, boolean, int, String, boolean)}
+ */
+ @Deprecated
+ public static ICFunctionBreakpoint createFunctionBreakpoint(String sourceHandle, IResource resource,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ return createFunctionBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, function, charStart, charEnd,
+ lineNumber, enabled, ignoreCount, condition, register);
+ }
+
+ /**
+ * Creates and returns a breakpoint for the function defined by the given
+ * name. The marker associated with the breakpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICFunctionBreakpoint createFunctionBreakpoint(String sourceHandle, IResource resource, int type,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setFunctionBreakpointAttributes(attributes, sourceHandle, type, function, charStart, charEnd, lineNumber,
+ enabled, ignoreCount, condition);
+ return new CFunctionBreakpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICFunctionBreakpoint createBlankFunctionBreakpoint() {
+ return new CFunctionBreakpoint();
+ }
+
+ /**
+ * Creates and returns a tracepoint for the function defined by the given
+ * name. The marker associated with the breakpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @since 7.0
+ */
+ public static ICFunctionBreakpoint createFunctionTracepoint(String sourceHandle, IResource resource, int type,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setFunctionBreakpointAttributes(attributes, sourceHandle, type, function, charStart, charEnd, lineNumber,
+ enabled, ignoreCount, condition);
+ return new CFunctionTracepoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICFunctionBreakpoint createBlankFunctionTracepoint() {
+ return new CFunctionTracepoint();
+ }
+
+ /**
+ * Helper function for setting common address breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setFunctionBreakpointAttributes(Map<String, Object> attributes, String sourceHandle, int type,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition) {
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ attributes.put(IMarker.CHAR_START, new Integer(charStart));
+ attributes.put(IMarker.CHAR_END, new Integer(charEnd));
+ attributes.put(ICLineBreakpoint.FUNCTION, function);
+ }
+
+ /**
+ * Returns the line breakpoint that is already registered with the
+ * breakpoint manager for a source with the given handle and the given
+ * resource at the given line number.
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param lineNumber
+ * the line number
+ * @return the line breakpoint that is already registered with the
+ * breakpoint manager or <code>null</code> if no such breakpoint is
+ * registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
+ */
+ public static ICLineBreakpoint lineBreakpointExists(String sourceHandle, IResource resource, int lineNumber)
+ throws CoreException {
+ String modelId = getPluginIdentifier();
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICLineBreakpoint)) {
+ continue;
+ }
+ ICLineBreakpoint breakpoint = (ICLineBreakpoint) breakpoints[i];
+ if (sameSourceHandle(sourceHandle, breakpoint.getSourceHandle())) {
+ if (breakpoint.getLineNumber() == lineNumber) {
+ return breakpoint;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the watchpoint that is already registered with the breakpoint
+ * manager for a source with the given handle and the given resource at the
+ * given expression.
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param expression
+ * the expression
+ * @return the watchpoint that is already registered with the breakpoint
+ * manager or <code>null</code> if no such watchpoint is registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
+ */
+ public static ICWatchpoint watchpointExists(String sourceHandle, IResource resource, String expression)
+ throws CoreException {
+ String modelId = getPluginIdentifier();
+ String markerType = ICWatchpoint.C_WATCHPOINT_MARKER;
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICWatchpoint)) {
+ continue;
+ }
+ ICWatchpoint breakpoint = (ICWatchpoint) breakpoints[i];
+ if (breakpoint.getMarker().getType().equals(markerType)) {
+ if (sameSourceHandle(sourceHandle, breakpoint.getSourceHandle())) {
+ if (breakpoint.getMarker().getResource().equals(resource)) {
+ if (breakpoint.getExpression().equals(expression)) {
+ return breakpoint;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the function breakpoint that is already registered with the
+ * breakpoint manager for a source with the given handle and the given
+ * resource with the given function name.
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param function
+ * the fully qualified function name
+ * @return the breakpoint that is already registered with the breakpoint
+ * manager or <code>null</code> if no such breakpoint is registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
+ */
+ public static ICFunctionBreakpoint functionBreakpointExists(String sourceHandle, IResource resource, String function)
+ throws CoreException {
+ String modelId = getPluginIdentifier();
+ String markerType = ICFunctionBreakpoint.C_FUNCTION_BREAKPOINT_MARKER;
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICFunctionBreakpoint)) {
+ continue;
+ }
+ ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint) breakpoints[i];
+ if (breakpoint.getMarker().getType().equals(markerType)) {
+ if (sameSourceHandle(sourceHandle, breakpoint.getSourceHandle())) {
+ if (breakpoint.getMarker().getResource().equals(resource)) {
+ if (breakpoint.getFunction() != null && breakpoint.getFunction().equals(function)) {
+ return breakpoint;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newDebugTarget(ILaunch launch, ICDITarget target, String name, IProcess iprocess,
+ IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain)
+ throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ String stopSymbol = null;
+ if (stopInMain)
+ stopSymbol = launch.getLaunchConfiguration().getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+ return newDebugTarget(launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate,
+ allowDisconnect, stopSymbol, true);
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newAttachDebugTarget(ILaunch launch, ICDITarget target, String name,
+ IProcess debuggerProcess, IFile file) throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, true, false);
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newCoreFileDebugTarget(final ILaunch launch, final ICDITarget target, final String name,
+ final IProcess debuggerProcess, final IFile file) throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, false, false);
+ }
+
+ private static IBinaryExecutable getBinary(IFile file) throws CoreException {
+ IProject project = file.getProject();
+ ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(
+ project);
+ for (int i = 0; i < binaryParsersExt.length; i++) {
+ IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]);
+ try {
+ IBinaryFile exe = parser.getBinary(file.getLocation());
+ if (exe instanceof IBinaryExecutable) {
+ return (IBinaryExecutable) exe;
+ }
+ } catch (IOException e) {
+ }
+ }
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1,
+ DebugCoreMessages.getString("CDIDebugModel.0"), null)); //$NON-NLS-1$
+ }
+
+ private static boolean sameSourceHandle(String handle1, String handle2) {
+ if (handle1 == null || handle2 == null)
+ return false;
+ IPath path1 = new Path(handle1);
+ IPath path2 = new Path(handle2);
+ if (path1.isValidPath(handle1) && path2.isValidPath(handle2)) {
+ return path1.equals(path2);
+ }
+ // If handles are not file names ????
+ return handle1.equals(handle2);
+ }
+
+ /**
+ * Checks whether an event breakpoint with given type and argument already
+ * exists. If multiple event breakpoints exist that match given parameters,
+ * only one of them will be returned.
+ *
+ * @param type
+ * Event type.
+ * @param arg
+ * Event argument.
+ * @return Event breakpoint, if found.
+ * @throws CoreException
+ * Exception in reading breakpoint properties.
+ */
+ public static ICEventBreakpoint eventBreakpointExists(String type, String arg) throws CoreException {
+ String modelId = getPluginIdentifier();
+
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICEventBreakpoint)) {
+ continue;
+ }
+ ICEventBreakpoint breakpoint = (ICEventBreakpoint) breakpoints[i];
+
+ if (breakpoint.getEventType().equals(type)) {
+ String arg1 = breakpoint.getEventArgument();
+ if (arg1 == null)
+ arg1 = ""; //$NON-NLS-1$
+ String arg2 = arg == null ? "" : arg; //$NON-NLS-1$
+ if (arg1.equals(arg2))
+ return breakpoint;
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Creates and registers a new event breakpoint.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param type
+ * Event breakpoint type.
+ * @param arg
+ * Event-specific argument value.
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an event breakpoint
+ *
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICEventBreakpoint createEventBreakpoint(String type, String arg, boolean register)
+ throws CoreException {
+ final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
+ final Map<String, Object> attributes = new HashMap<String, Object>();
+ setEventBreakpointAttributes(attributes, type, arg);
+ return new CEventBreakpoint(resource, attributes, register);
+
+ }
+
+ /**
+ * Helper function for setting common event breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param type
+ * Event breakpoint type.
+ * @param arg
+ * Event-specific argument value.
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setEventBreakpointAttributes(Map<String, Object> attributes, String type, String arg) {
+ attributes.put(IBreakpoint.ID, CDIDebugModel.getPluginIdentifier());
+ attributes.put(IBreakpoint.ENABLED, true);
+ attributes.put(ICBreakpoint.IGNORE_COUNT, 0);
+ attributes.put(ICBreakpoint.CONDITION, ""); //$NON-NLS-1$
+ attributes.put(ICEventBreakpoint.EVENT_TYPE_ID, type);
+ attributes.put(ICEventBreakpoint.EVENT_ARG, arg);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICEventBreakpoint createBlankEventBreakpoint() {
+ return new CEventBreakpoint();
+ }
+
+ /**
+ * Creates a marker for given C breakpoint.
+ *
+ * @param breakpoint
+ * Breakpoint to create the marker for.
+ * @param resource
+ * Resource to create the marker on.
+ * @param attributes
+ * Marker attributes to use.
+ * @param add
+ * Whether to register the breakpoint with breakpoint manager.
+ * @throws CoreException
+ * Error thrown while creating marker.
+ *
+ * @since 7.2
+ */
+ public static void createBreakpointMarker(final ICBreakpoint breakpoint, final IResource resource,
+ final Map<String, Object> attributes, final boolean add) throws CoreException {
+ if (breakpoint.getMarker() != null) {
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID,
+ "Cannot create breakpoint marker breakpoint given breakpoint already has an assotiated maker")); //$NON-NLS-1$
+ }
+
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ // create the marker
+ IMarker marker = resource.createMarker(calculateMarkerType(breakpoint));
+ breakpoint.setMarker(marker);
+
+ // set attributes
+ marker.setAttributes(attributes);
+
+ // set the marker message
+ if (breakpoint instanceof ICBreakpoint2) {
+ ((ICBreakpoint2) breakpoint).refreshMessage();
+ }
+
+ // add to breakpoint manager if requested
+ if (add) {
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(breakpoint);
+ }
+ }
+ };
+ ResourcesPlugin.getWorkspace().run(wr, null);
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java
index 0d7ab756cd5..a56831d017a 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java
@@ -14,5 +14,11 @@ package org.eclipse.cdt.debug.core.model;
* A breakpoint that suspend the execution when a particular address is reached.
*/
public interface ICAddressBreakpoint extends ICLineBreakpoint {
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_ADDRESS_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
index 4d00e6c4528..0d85e473e3e 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
@@ -26,6 +26,12 @@ import org.eclipse.debug.core.model.IBreakpoint;
*/
public interface ICBreakpoint extends IBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cBreakpointMarker"; //$NON-NLS-1$
+
/**
* This debug model identifier can be returned by a debug implementation
* to indicate that a given debugger integration is using C Breakpoints.
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java
index 3e7acd6b207..0c2a784def7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java
@@ -36,4 +36,9 @@ public interface ICBreakpoint2 extends ICBreakpoint {
*/
public void refreshMessage() throws CoreException;
+ /**
+ * Returns the marker type of the given CDT Breakpoint.
+ * @return marker type ID
+ */
+ public String getMarkerType();
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
index ee635da0cb0..1be934e8665 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
@@ -22,6 +22,13 @@ import org.eclipse.core.runtime.CoreException;
* @since 7.0
*/
public interface ICEventBreakpoint extends ICBreakpoint {
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_EVENT_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cEventBreakpointMarker"; //$NON-NLS-1$;
+
/**
* Breakpoint attribute storing the event breakpoint event id. Basically,
* this indicates what type of event the breakpoint catches--e.g., a C++
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java
index 593bffe77fe..543e1864fc0 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java
@@ -15,5 +15,10 @@ package org.eclipse.cdt.debug.core.model;
* A breakpoint that suspends the execution when a function is entered.
*/
public interface ICFunctionBreakpoint extends ICLineBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_FUNCTION_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java
index 5f9fd93db9a..d3cc7d6ecd2 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java
@@ -19,6 +19,12 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
*/
public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_LINE_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
+
/**
* Breakpoint attribute storing the function this breakpoint suspends
* execution at (value <code>"org.eclipse.cdt.debug.core.function"</code>).
@@ -77,4 +83,5 @@ public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
* underlying marker
*/
public String getFileName() throws CoreException;
+
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java
index c55f1c3cd41..ba3fb2b8f1c 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java
@@ -18,6 +18,31 @@ import org.eclipse.core.runtime.CoreException;
* @since 7.0
*/
public interface ICTracepoint extends ICLineBreakpoint {
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cTracepointMarker"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_LINE_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineTracepointMarker"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_ADDRESS_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressTracepointMarker"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_FUNCTION_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionTracepointMarker"; //$NON-NLS-1$
+
/**
* Tracepoint attribute storing a tracepoint's pass count value (value
* <code>"org.eclipse.cdt.debug.core.passCount"</code>). This attribute
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java
index f2e63b7345f..55bd9d38d98 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java
@@ -18,6 +18,12 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
*/
public interface ICWatchpoint extends ICBreakpoint, ILineBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_WATCHPOINT_MARKER = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
+
/**
* Watchpoint attribute storing the expression associated with this
* watchpoint (value <code>"org.eclipse.cdt.debug.core.expression"</code>).
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java
index d5150ff1f75..1fae7032860 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java
@@ -42,8 +42,8 @@ public abstract class AbstractLineBreakpoint extends CBreakpoint implements ICLi
* @param add
* @throws CoreException
*/
- public AbstractLineBreakpoint( IResource resource, String markerType, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, markerType, attributes, add );
+ public AbstractLineBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
+ super( resource, attributes, add );
}
/*(non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java
index 02611c9e218..a50acc756de 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java
@@ -42,8 +42,8 @@ public abstract class AbstractTracepoint extends CBreakpoint implements ICTracep
* @param add
* @throws CoreException
*/
- public AbstractTracepoint( IResource resource, String markerType, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, markerType, attributes, add );
+ public AbstractTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
+ super( resource, attributes, add );
}
/*(non-Javadoc)
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 7d31ce0ae1c..85df609b65f 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
@@ -24,8 +24,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddressBreakpoint {
- private static final String C_ADDRESS_BREAKPOINT = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CAddressBreakpoint.
*/
@@ -36,14 +34,14 @@ public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddr
* Constructor for CAddressBreakpoint.
*/
public CAddressBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
- public static String getMarkerType() {
- return C_ADDRESS_BREAKPOINT;
+ public String getMarkerType() {
+ return C_ADDRESS_BREAKPOINT_MARKER;
}
/*
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java
index 0106803b448..f5852983ef3 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java
@@ -27,8 +27,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CAddressTracepoint extends AbstractTracepoint implements ICAddressBreakpoint, ICTracepoint {
- private static final String C_ADDRESS_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressTracepointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CAddressTracepoint.
*/
@@ -39,13 +37,13 @@ public class CAddressTracepoint extends AbstractTracepoint implements ICAddressB
* Constructor for CAddressTracepoint.
*/
public CAddressTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
- public static String getMarkerType() {
+ public String getMarkerType() {
return C_ADDRESS_TRACEPOINT_MARKER;
}
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 b8a8ccdb11d..6182be1db46 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;
-import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -18,8 +17,7 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint2;
import org.eclipse.cdt.debug.core.model.ICBreakpointExtension;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.core.resources.IMarker;
@@ -39,10 +37,12 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.Breakpoint;
+import com.ibm.icu.text.MessageFormat;
+
/**
* The base class for all C/C++ specific breakpoints.
*/
-public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ICBreakpointType, IDebugEventSetListener {
+public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint2, ICBreakpointType, IDebugEventSetListener {
/**
* Map of breakpoint extensions. The keys to the map are debug model IDs
@@ -67,14 +67,14 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
/**
* Constructor for CBreakpoint.
*/
- public CBreakpoint( final IResource resource, final String markerType, final Map<String, Object> attributes, final boolean add ) throws CoreException {
+ public CBreakpoint( final IResource resource, final Map<String, Object> attributes, final boolean add ) throws CoreException {
this();
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
@Override
public void run( IProgressMonitor monitor ) throws CoreException {
// create the marker
- setMarker( resource.createMarker( markerType ) );
+ setMarker( resource.createMarker( getMarkerType() ) );
// set attributes
ensureMarker().setAttributes( attributes );
//set the marker message
@@ -86,146 +86,69 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
run( wr );
}
- public void createMarker( final IResource resource, final String markerType, final Map<String, Object> attributes, final boolean add ) throws DebugException {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- @Override
- public void run( IProgressMonitor monitor ) throws CoreException {
- // create the marker
- setMarker( resource.createMarker( markerType ) );
- // set attributes
- ensureMarker().setAttributes( attributes );
- //set the marker message
- setAttribute( IMarker.MESSAGE, getMarkerMessage() );
- // add to breakpoint manager if requested
- register( add );
- }
- };
- run( wr );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
- */
@Override
public String getModelIdentifier() {
return CDIDebugModel.getPluginIdentifier();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#isInstalled()
- */
@Override
public boolean isInstalled() throws CoreException {
return fInstallCount > 0;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#getCondition()
- */
@Override
public String getCondition() throws CoreException {
return ensureMarker().getAttribute( CONDITION, "" ); //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#setCondition(String)
- */
@Override
public void setCondition( String condition ) throws CoreException {
setAttribute( CONDITION, condition );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#getIgnoreCount()
- */
@Override
public int getIgnoreCount() throws CoreException {
return ensureMarker().getAttribute( IGNORE_COUNT, 0 );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#setIgnoreCount(int)
- */
@Override
public void setIgnoreCount( int ignoreCount ) throws CoreException {
setAttribute( IGNORE_COUNT, ignoreCount );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getType()
- */
@Override
public int getType() throws CoreException {
return ensureMarker().getAttribute( TYPE, 0 );
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setType(int)
- */
@Override
public void setType(int type) throws CoreException {
setAttribute( TYPE, type );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#getThreadId()
- */
@Override
public String getThreadId() throws CoreException {
return ensureMarker().getAttribute( THREAD_ID, null );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#setThreadId(String)
- */
@Override
public void setThreadId( String threadId ) throws CoreException {
setAttribute( THREAD_ID, threadId );
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getSourceHandle()
- */
@Override
public String getSourceHandle() throws CoreException {
return ensureMarker().getAttribute( SOURCE_HANDLE, null );
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setSourceHandle(java.lang.String)
- */
@Override
public void setSourceHandle( String sourceHandle ) throws CoreException {
setAttribute( SOURCE_HANDLE, sourceHandle );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(DebugEvent[])
- */
@Override
public void handleDebugEvents( DebugEvent[] events ) {
}
@@ -257,9 +180,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
abstract protected String getMarkerMessage() throws CoreException;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#incrementInstallCount()
- */
@Override
public synchronized int incrementInstallCount() throws CoreException {
++fInstallCount;
@@ -279,9 +199,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
return fInstallCount;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#decrementInstallCount()
- */
@Override
public synchronized int decrementInstallCount() throws CoreException {
fInstallCount--;
@@ -293,9 +210,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
return fInstallCount;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#resetInstallCount()
- */
@Override
public synchronized void resetInstallCount() throws CoreException {
if (fInstallCount != 0) {
@@ -304,31 +218,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.Breakpoint#ensureMarker()
- */
- @Override
- protected IMarker ensureMarker() throws DebugException {
- return super.ensureMarker();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.Breakpoint#setAttribute(String, Object)
- */
- @Override
- protected void setAttribute( String attributeName, Object value ) throws CoreException {
- super.setAttribute( attributeName, value );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#isConditional()
- */
@Override
public boolean isConditional() throws CoreException {
return ((getCondition() != null && getCondition().trim().length() > 0) || getIgnoreCount() > 0);
@@ -359,17 +248,11 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getModule()
- */
@Override
public String getModule() throws CoreException {
return ensureMarker().getAttribute( MODULE, null );
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setModule(java.lang.String)
- */
@Override
public void setModule( String module ) throws CoreException {
setAttribute( MODULE, module );
@@ -436,6 +319,10 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
}
return fExtensions.get(debugModelId);
}
-
-
+
+ @Override
+ public void refreshMessage() throws CoreException {
+ IMarker marker = ensureMarker();
+ marker.setAttribute(IMarker.MESSAGE, getMarkerMessage());
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java
index 70377807de7..96e16776e77 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java
@@ -14,24 +14,15 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.DebugException;
public class CEventBreakpoint extends CBreakpoint implements ICEventBreakpoint {
- private static final String C_EVENTBREAKPOINT_MARKER_TYPE = "org.eclipse.cdt.debug.core.cEventBreakpointMarker"; //$NON-NLS-1$;
-
public CEventBreakpoint() {
-
- }
-
- public static String getMarkerType() {
- return C_EVENTBREAKPOINT_MARKER_TYPE;
}
public CEventBreakpoint(IResource resource, Map<String, Object> attributes, boolean add) throws CoreException {
@@ -39,29 +30,14 @@ public class CEventBreakpoint extends CBreakpoint implements ICEventBreakpoint {
// event breakpoint must set non null EVENT_TYPE_ID property to be valid
if (attributes.get(EVENT_TYPE_ID) == null)
throw new IllegalArgumentException();
- setBreakpointMarker(resource, getMarkerType(), attributes, add);
-
+ CDIDebugModel.createBreakpointMarker(this, resource, attributes, add);
}
- private void setBreakpointMarker(final IResource resource, final String markerType,
- final Map<String, Object> attributes, final boolean add) throws DebugException {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- // create the marker
- setMarker(resource.createMarker(markerType));
- // set attributes
- ensureMarker().setAttributes(attributes);
- // set the marker message
- setAttribute(IMarker.MESSAGE, getMarkerMessage());
- // add to breakpoint manager if requested
- register(add);
- }
- };
- run(wr);
+ @Override
+ public String getMarkerType() {
+ return C_EVENT_BREAKPOINT_MARKER;
}
-
+
@Override
protected String getMarkerMessage() throws CoreException {
// default message, overridden by label provider, which would take care of translation
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 a9f27aeb4fa..9d36cdd948a 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
@@ -24,8 +24,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFunctionBreakpoint {
- private static final String C_FUNCTION_BREAKPOINT = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CFunctionBreakpoint.
*/
@@ -36,14 +34,14 @@ public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFun
* Constructor for CFunctionBreakpoint.
*/
public CFunctionBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
- public static String getMarkerType() {
- return C_FUNCTION_BREAKPOINT;
+ public String getMarkerType() {
+ return C_FUNCTION_BREAKPOINT_MARKER;
}
/*(non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java
index ea0503cf0d6..8631eab5a39 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java
@@ -27,8 +27,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CFunctionTracepoint extends AbstractTracepoint implements ICFunctionBreakpoint, ICTracepoint {
- private static final String C_FUNCTION_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionTracepointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CFunctionTracepoint.
*/
@@ -39,15 +37,15 @@ public class CFunctionTracepoint extends AbstractTracepoint implements ICFunctio
* Constructor for CFunctionTracepoint.
*/
public CFunctionTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_FUNCTION_TRACEPOINT_MARKER;
- }
+ * Returns the type of marker associated with this type of breakpoints
+ */
+ public String getMarkerType() {
+ return C_FUNCTION_TRACEPOINT_MARKER;
+ }
/*(non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
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 37f16afd8fd..05a4b0173fa 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;
-import com.ibm.icu.text.MessageFormat;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugUtils;
@@ -20,14 +19,14 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import com.ibm.icu.text.MessageFormat;
+
/**
* A breakpoint that suspends the execution when a particular line of code is
* reached.
*/
public class CLineBreakpoint extends AbstractLineBreakpoint {
- private static final String C_LINE_BREAKPOINT = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CLineBreakpoint.
*/
@@ -38,14 +37,12 @@ public class CLineBreakpoint extends AbstractLineBreakpoint {
* Constructor for CLineBreakpoint.
*/
public CLineBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
-
- /**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_LINE_BREAKPOINT;
+
+ @Override
+ public String getMarkerType() {
+ return C_LINE_BREAKPOINT_MARKER;
}
/*(non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java
index c911cc63daf..9089a732cd1 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java
@@ -29,8 +29,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, ICLineBreakpoint2 {
- private static final String C_LINE_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineTracepointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CLineTracepoint.
*/
@@ -41,16 +39,14 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint,
* Constructor for CLineTracepoint.
*/
public CLineTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
- /**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_LINE_TRACEPOINT_MARKER;
+ @Override
+ public String getMarkerType() {
+ return C_LINE_TRACEPOINT_MARKER;
}
-
+
@Override
public synchronized int decrementInstallCount() throws CoreException {
int count = super.decrementInstallCount();
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 75f992d126d..e1a23732e1d 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
@@ -25,8 +25,6 @@ import org.eclipse.core.runtime.CoreException;
*/
public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
- private static final String C_WATCHPOINT = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CWatchpoint.
*/
@@ -37,13 +35,14 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
* Constructor for CWatchpoint.
*/
public CWatchpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
- protected CWatchpoint( IResource resource, String marker, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, marker, attributes, add );
+ @Override
+ public String getMarkerType() {
+ return C_WATCHPOINT_MARKER;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICWatchpoint#isWriteType()
*/
@@ -68,13 +67,6 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
return ensureMarker().getAttribute( EXPRESSION, "" ); //$NON-NLS-1$
}
- /**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_WATCHPOINT;
- }
-
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/

Back to the top