1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

[305554] Incorrect check in MIBreakpointsManager.modifyBreakpoint()

This commit is contained in:
John Cortell 2010-03-12 16:10:03 +00:00
parent 985195bc3c
commit a21c69868a

View file

@ -91,6 +91,7 @@ import org.osgi.framework.BundleContext;
* *
* It relies on MIBreakpoints for the actual back-end interface. * It relies on MIBreakpoints for the actual back-end interface.
*/ */
@SuppressWarnings("restriction") // we use an internal platform type (BreakpointProblems)
public class MIBreakpointsManager extends AbstractDsfService implements IBreakpointManagerListener, IBreakpointListener public class MIBreakpointsManager extends AbstractDsfService implements IBreakpointManagerListener, IBreakpointListener
{ {
// Note: Find a way to import this (careful of circular dependencies) // Note: Find a way to import this (careful of circular dependencies)
@ -827,7 +828,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
// Get the list of back-end breakpoints // Get the list of back-end breakpoints
final Vector<IBreakpointDMContext> oldTargetBPs = new Vector<IBreakpointDMContext>(breakpointIDs.get(breakpoint)); final Vector<IBreakpointDMContext> oldTargetBPs = new Vector<IBreakpointDMContext>(breakpointIDs.get(breakpoint));
if (oldTargetBPs == null) { if (oldTargetBPs.isEmpty()) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null)); rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null));
rm.done(); rm.done();
return; return;
@ -1389,13 +1390,13 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/** /**
* supportsBreakpoint * Indicates if the platform breakpoint object [bp] is one we can deal with.
* For now, it boils down to whether it's a CDT Breakpoint (an
* ICBreakpoint). DSF can supports other (custom) types of breakpoints, but
* DSF-GDB is tied to ICBreakpoint.
* *
* Indicates if it is breakpoint we can deal with. For now, it boils down * @param bp the platform breakpoint
* to a CDI breakpoint... * @return true if we support it; false otherwise
*
* @param bp
* @return
*/ */
private boolean supportsBreakpoint(IBreakpoint bp) { private boolean supportsBreakpoint(IBreakpoint bp) {
if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(fDebugModelId)) { if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(fDebugModelId)) {
@ -1635,25 +1636,31 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/** /**
* Create a target breakpoint from an ICBreakpoint * Create a collection of DSF-GDB specific breakpoint properties given a
* platform/CDT breakpoint object and its properties. Basically, this
* determines the set of MI-specific properties to be used in installing the
* given breakpoint.
* *
* @param breakpoint * @param breakpoint
* the platform breakpoint object; was created by CDT
* @param attributes * @param attributes
* @return * the breakpoint's properties. By allowing this to be passed in
* (rather than us calling
* IBreakpoint#getMarker()#getProperties()), we allow the caller
* to specify additional/modified properties.
* @return a property bag containing the corresponding DSF-GDB properties
*/ */
protected Map<String,Object> convertToTargetBreakpoint(ICBreakpoint breakpoint, Map<String,Object> attributes) { protected Map<String,Object> convertToTargetBreakpoint(ICBreakpoint breakpoint, Map<String,Object> attributes) {
Map<String, Object> properties = new HashMap<String, Object>(); Map<String, Object> properties = new HashMap<String, Object>();
if (breakpoint instanceof ICWatchpoint) { if (breakpoint instanceof ICWatchpoint) {
// Convert the CDI watchpoint to an IBreakpoint
properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT); properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT);
properties.put(MIBreakpoints.EXPRESSION, attributes.get(ICWatchpoint.EXPRESSION)); properties.put(MIBreakpoints.EXPRESSION, attributes.get(ICWatchpoint.EXPRESSION));
properties.put(MIBreakpoints.READ, attributes.get(ICWatchpoint.READ)); properties.put(MIBreakpoints.READ, attributes.get(ICWatchpoint.READ));
properties.put(MIBreakpoints.WRITE, attributes.get(ICWatchpoint.WRITE)); properties.put(MIBreakpoints.WRITE, attributes.get(ICWatchpoint.WRITE));
} }
else if (breakpoint instanceof ICLineBreakpoint) { else if (breakpoint instanceof ICLineBreakpoint) {
// Convert the CDI breakpoint to an IBreakpoint
properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT); properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
properties.put(MIBreakpoints.FILE_NAME, attributes.get(ATTR_DEBUGGER_PATH)); properties.put(MIBreakpoints.FILE_NAME, attributes.get(ATTR_DEBUGGER_PATH));
properties.put(MIBreakpoints.LINE_NUMBER, attributes.get(IMarker.LINE_NUMBER)); properties.put(MIBreakpoints.LINE_NUMBER, attributes.get(IMarker.LINE_NUMBER));