Skip to content

Commit

Permalink
Breakpoint.ensureMarker() not MT safe and should provide more info
Browse files Browse the repository at this point in the history
- made Breakpoint.fMarker volatile so Breakpoint.ensureMarker() always
see the last state
- changed error message to indicate what was the real problem - not set
or not existing marker.

Fixes #1717
  • Loading branch information
iloveeclipse committed Jan 29, 2025
1 parent fbae6a1 commit 29bc65f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion debug/org.eclipse.debug.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
Bundle-Version: 3.22.0.qualifier
Bundle-Version: 3.22.100.qualifier
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.internal.core.BreakpointManager;
import org.eclipse.debug.internal.core.DebugCoreMessages;
import org.eclipse.osgi.util.NLS;

/**
* Abstract implementation of a breakpoint. This class is
Expand All @@ -58,15 +59,14 @@ public Breakpoint() {
/**
* Underlying marker.
*/
private IMarker fMarker= null;
private volatile IMarker fMarker;

/**
* @see IBreakpoint#setMarker(IMarker)
*/
@Override
public void setMarker(IMarker marker) throws CoreException {
fMarker= marker;

}

/**
Expand Down Expand Up @@ -292,10 +292,15 @@ protected void setAttributes(final Map<String, ? extends Object> attributes) thr
* this breakpoint or the associated marker does not exist
*/
protected IMarker ensureMarker() throws DebugException {
String message = null;
IMarker m = getMarker();
if (m == null || !m.exists()) {
throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED,
DebugCoreMessages.Breakpoint_no_associated_marker, null));
if (m == null) {
message = DebugCoreMessages.Breakpoint_no_associated_marker;
} else if (!m.exists()) {
message = NLS.bind(DebugCoreMessages.Breakpoint_marker_does_not_exist, m.toString());
}
if (message != null) {
throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, message, null));
}
return m;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class DebugCoreMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.debug.internal.core.DebugCoreMessages";//$NON-NLS-1$

public static String Breakpoint_no_associated_marker;
public static String Breakpoint_marker_does_not_exist;
public static String BreakpointManager_Missing_breakpoint_definition;
public static String BreakpointManager_Missing_model_identifier;
public static String DebugEvent_illegal_detail;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
###############################################################################

Breakpoint_no_associated_marker=Breakpoint does not have an associated marker.
Breakpoint_marker_does_not_exist=Breakpoint marker does not exist: {0}
BreakpointManager_Missing_breakpoint_definition=Missing breakpoint definition for marker type {0}
BreakpointManager_Missing_model_identifier=Breakpoint missing debug model identifier
DebugEvent_illegal_detail=detail is not one of the allowed constants, see IDebugEventConstants
Expand Down

0 comments on commit 29bc65f

Please sign in to comment.