mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Addressed two loose ends of bugzilla 118100
This commit is contained in:
parent
79aa62cd97
commit
b36ad37def
6 changed files with 135 additions and 31 deletions
|
@ -37,17 +37,16 @@ public interface ICDIBreakpoint extends ICDIObject {
|
|||
final static public int TEMPORARY = ICBreakpointType.TEMPORARY;
|
||||
/** @deprecated use ICBreakpointTyped.HARDWARE */
|
||||
final static public int HARDWARE = ICBreakpointType.HARDWARE;
|
||||
|
||||
/**
|
||||
* Returns whether this breakpoint is temporary.
|
||||
*
|
||||
* @return whether this breakpoint is temporary
|
||||
* @deprecated by {@link ICDIBreakpoint2#getType()}
|
||||
*/
|
||||
boolean isTemporary();
|
||||
|
||||
/**
|
||||
* Returns whether this breakpoint is hardware-assisted.
|
||||
*
|
||||
* @return whether this breakpoint is hardware-assisted
|
||||
* @deprecated by {@link ICDIBreakpoint2#getType()}
|
||||
*/
|
||||
boolean isHardware();
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Freescale and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Freescale - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.core.cdi.model;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
|
||||
/**
|
||||
* Extension of the ICDIBreakpoint interface
|
||||
*/
|
||||
public interface ICDIBreakpoint2 extends ICDIBreakpoint {
|
||||
|
||||
/**
|
||||
* Return the type of the breakpoint. If the breakpoint's creation
|
||||
* originated in CDT, then CDT specified the type as part of that request
|
||||
* and this method must return that value. If the breakpoint's creation
|
||||
* originated in the CDI client, then this method is invoked by CDT to
|
||||
* discover the type of the breakpoint.
|
||||
*
|
||||
* If the CDI breakpoint implements this interface, then
|
||||
* {@link ICDIBreakpoint#isTemporary()} and
|
||||
* {@link ICDIBreakpoint#isHardware()} will never get called by CDT, as this
|
||||
* method is meant to replace those.
|
||||
*
|
||||
* @return one of the type constants defined in ICBreakpointType (note that
|
||||
* {@link ICBreakpointType#TEMPORARY} can be bit-applied to any of
|
||||
* the type values to qualify it as a temporary breakpoint.
|
||||
*/
|
||||
int getType();
|
||||
}
|
|
@ -179,6 +179,8 @@ public class CDIDebugModel {
|
|||
* 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
|
||||
|
@ -196,7 +198,7 @@ public class CDIDebugModel {
|
|||
* <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 lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
public static ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, int type, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
HashMap attributes = new HashMap( 10 );
|
||||
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
|
||||
|
@ -204,7 +206,7 @@ public class CDIDebugModel {
|
|||
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
|
||||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
|
||||
attributes.put( ICBreakpointType.TYPE, ICBreakpointType.REGULAR );
|
||||
attributes.put( ICBreakpointType.TYPE, type );
|
||||
return new CLineBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
|
@ -216,6 +218,7 @@ public class CDIDebugModel {
|
|||
* @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
|
||||
|
@ -229,8 +232,8 @@ public class CDIDebugModel {
|
|||
* failure.</li>
|
||||
* </ul>
|
||||
*/
|
||||
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, -1, address, enabled, ignoreCount, condition, register );
|
||||
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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,6 +244,7 @@ public class CDIDebugModel {
|
|||
* @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
|
||||
|
@ -255,7 +259,7 @@ public class CDIDebugModel {
|
|||
* failure.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
|
||||
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 attributes = new HashMap( 10 );
|
||||
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.CHAR_START, new Integer( -1 ) );
|
||||
|
@ -267,6 +271,7 @@ public class CDIDebugModel {
|
|||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
|
||||
attributes.put( ICBreakpoint.MODULE, module );
|
||||
attributes.put( ICBreakpointType.TYPE, type );
|
||||
return new CAddressBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
|
@ -394,6 +399,7 @@ public class CDIDebugModel {
|
|||
*
|
||||
* @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
|
||||
|
@ -416,7 +422,7 @@ public class CDIDebugModel {
|
|||
* failure.</li>
|
||||
* </ul>
|
||||
*/
|
||||
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 {
|
||||
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 attributes = new HashMap( 10 );
|
||||
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
|
||||
attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
|
||||
|
@ -427,6 +433,7 @@ public class CDIDebugModel {
|
|||
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
|
||||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
|
||||
attributes.put( ICBreakpointType.TYPE, type );
|
||||
return new CFunctionBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
|||
import org.eclipse.cdt.debug.core.cdi.event.ICDIExecutableReloadedEvent;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint2;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement2;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement3;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint;
|
||||
|
@ -458,6 +459,18 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
}
|
||||
return ( b instanceof IBreakpoint ) ? (IBreakpoint)b : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the breakpoint is of a temporary type, otherwise false
|
||||
*/
|
||||
private boolean isTemporary(ICDIBreakpoint cdiBreakpoint) {
|
||||
if (cdiBreakpoint instanceof ICDIBreakpoint2) {
|
||||
return (((ICDIBreakpoint2)cdiBreakpoint).getType() & ICBreakpointType.TEMPORARY) != 0;
|
||||
}
|
||||
else {
|
||||
return cdiBreakpoint.isTemporary();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleBreakpointCreatedEvent( ICDIBreakpoint cdiBreakpoint ) {
|
||||
if ( cdiBreakpoint instanceof ICDIWatchpoint )
|
||||
|
@ -466,7 +479,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
doHandleCatachpointCreatedEvent( (ICDIEventBreakpoint)cdiBreakpoint );
|
||||
else if ( cdiBreakpoint instanceof ICDILocationBreakpoint )
|
||||
doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint );
|
||||
if ( !cdiBreakpoint.isTemporary() && !DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) {
|
||||
if ( !isTemporary(cdiBreakpoint) && !DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) {
|
||||
changeBreakpointPropertiesOnTarget(cdiBreakpoint, new Boolean(false), null);
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +516,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
}
|
||||
|
||||
private void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint cdiBreakpoint ) {
|
||||
if ( cdiBreakpoint.isTemporary() )
|
||||
if ( isTemporary(cdiBreakpoint) )
|
||||
return;
|
||||
ICBreakpoint breakpoint = null;
|
||||
synchronized( getBreakpointMap() ) {
|
||||
|
@ -934,7 +947,8 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
|
||||
private ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
|
||||
ICLineBreakpoint breakpoint = CDIDebugModel.createLineBreakpoint( sourceHandle,
|
||||
resource,
|
||||
resource,
|
||||
getCdiBreakpointType(cdiBreakpoint),
|
||||
cdiBreakpoint.getLocator().getLineNumber(),
|
||||
cdiBreakpoint.isEnabled(),
|
||||
cdiBreakpoint.getCondition().getIgnoreCount(),
|
||||
|
@ -950,12 +964,36 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
return breakpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method that queries the CDI client for the breakpoint type.
|
||||
*
|
||||
* @param cdiBreakpoint
|
||||
* the CDI breakpoint
|
||||
* @return an ICDIBreakpointType constant
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private int getCdiBreakpointType(ICDIBreakpoint cdiBreakpoint) {
|
||||
if (cdiBreakpoint instanceof ICDIBreakpoint2) {
|
||||
// the new way
|
||||
return ((ICDIBreakpoint2)cdiBreakpoint).getType();
|
||||
}
|
||||
else {
|
||||
// the old way
|
||||
int type = cdiBreakpoint.isHardware() ? ICBreakpointType.HARDWARE : ICBreakpointType.REGULAR;
|
||||
if (cdiBreakpoint.isTemporary()) {
|
||||
type |= ICBreakpointType.TEMPORARY;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
private ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
|
||||
ICDILocator location = cdiBreakpoint.getLocator();
|
||||
int line = location.getLineNumber();
|
||||
ICFunctionBreakpoint breakpoint = CDIDebugModel.createFunctionBreakpoint(
|
||||
sourceHandle,
|
||||
resource,
|
||||
resource,
|
||||
getCdiBreakpointType(cdiBreakpoint),
|
||||
location.getFunction(),
|
||||
-1,
|
||||
-1,
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint2;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.Condition;
|
||||
|
@ -24,18 +24,30 @@ import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
|||
|
||||
/**
|
||||
*/
|
||||
public abstract class Breakpoint extends CObject implements ICDIBreakpoint {
|
||||
public abstract class Breakpoint extends CObject implements ICDIBreakpoint2 {
|
||||
|
||||
ICDICondition condition;
|
||||
MIBreakpoint[] miBreakpoints;
|
||||
|
||||
/**
|
||||
* One of the type constants in ICBreakpointType
|
||||
*/
|
||||
int type;
|
||||
boolean enable;
|
||||
|
||||
boolean enabled;
|
||||
|
||||
public Breakpoint(Target target, int kind, ICDICondition cond, boolean enabled) {
|
||||
public Breakpoint(Target target, int type, ICDICondition condition, boolean enabled) {
|
||||
super(target);
|
||||
type = kind;
|
||||
condition = cond;
|
||||
enable = enabled;
|
||||
this.type = type;
|
||||
this.condition = condition;
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint2#getType()
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public MIBreakpoint[] getMIBreakpoints() {
|
||||
|
@ -78,21 +90,28 @@ public abstract class Breakpoint extends CObject implements ICDIBreakpoint {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
|
||||
*/
|
||||
public boolean isEnabled() throws CDIException {
|
||||
return enable;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint#isHardware()
|
||||
*
|
||||
* CDT 5.0 won't call this deprecated method (since we implement
|
||||
* ICDIBreakpoint2), but we use it ourselves.
|
||||
*/
|
||||
public boolean isHardware() {
|
||||
return (type == ICBreakpointType.HARDWARE);
|
||||
// ignore the TEMPORARY bit qualifier
|
||||
return ((type & ~ICBreakpointType.TEMPORARY) == ICBreakpointType.HARDWARE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint#isTemporary()
|
||||
*
|
||||
* CDT 5.0 won't call this deprecated method (since we implement
|
||||
* ICDIBreakpoint2), but we use it ourselves.
|
||||
*/
|
||||
public boolean isTemporary() {
|
||||
return (type == ICBreakpointType.TEMPORARY);
|
||||
return (type & ICBreakpointType.TEMPORARY) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,7 +142,7 @@ public abstract class Breakpoint extends CObject implements ICDIBreakpoint {
|
|||
}
|
||||
|
||||
public void setEnabled0(boolean on) {
|
||||
enable = on;
|
||||
enabled = on;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.model.ISourceRange;
|
|||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.model.IVariable;
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
|
@ -131,7 +132,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
|
|||
}
|
||||
else {
|
||||
CDIDebugModel.createLineBreakpoint( sourceHandle,
|
||||
resource,
|
||||
resource,
|
||||
ICBreakpointType.REGULAR,
|
||||
lineNumber,
|
||||
true,
|
||||
0,
|
||||
|
@ -509,7 +511,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
|
|||
DebugPlugin.log( e );
|
||||
}
|
||||
CDIDebugModel.createFunctionBreakpoint( sourceHandle,
|
||||
resource,
|
||||
resource,
|
||||
ICBreakpointType.REGULAR,
|
||||
functionName,
|
||||
charStart,
|
||||
charEnd,
|
||||
|
|
Loading…
Add table
Reference in a new issue