1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

bug 118100 - moving breakpoints types in ICBreakpointTyped

This commit is contained in:
Alena Laskavaia 2008-05-06 13:51:32 +00:00
parent 2cac1ea941
commit 5a0701efaa
11 changed files with 120 additions and 113 deletions

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
/**
*
@ -30,93 +31,12 @@ import org.eclipse.cdt.debug.core.cdi.ICDICondition;
* @since Jul 9, 2002
*/
public interface ICDIBreakpoint extends ICDIObject {
/**
* This type of breakpoint is exposed to the user. How it is installed
* (hardware or software) is up to the discretion of the debugger backend. A
* common backend approach is to try one way first and then the other if the
* first attempt fails.
*
* <p>
* In the future, we will expose a preference that lets the user dictate his
* preference to the backend. That is, the user will be able to say "I want
* the backend to install regular breakpoints using hardware breakpoint
* capabilities on the target."
*
* <p>
* It's important to realize that how a backend ends up installing the
* breakpoint does not alter the type of the breakpoint in the Eclipse/CDT
* layer. A regular breakpoint will always be a <i>regular</i> breakpoint
* regardless of the technique the backend used to install it (software or
* hardware).
*/
final static public int REGULAR = 0x0;
/**
* This type of breakpoint is <b>not</b> exposed to the user and is
* typically uninstalled after getting hit. How it is installed (hardware or
* software) is up to the discretion of the debugger backend. A common
* backend approach is to try one way first and then the other if the first
* attempt fails.
*
* <p>
* Unlike the <i>regular</i> breakpoint type, there are no plans to let the
* user coax the backend to install a temporary breakpoint in any particular
* way (hardware vs software).
*/
final static public int TEMPORARY = 0x1;
/**
* This type of breakpoint is exposed to the user. The user intends for the
* breakpoint to be installed as a hardware breakpoint and if it cannot be
* installed as such it should not be installed at all.
*
* A hardware breakpoint is one that makes use of a breakpoint hardware
* facility on the target. For example, the hardware may have a breakpoint
* register where an address can be set. The target will halt itself when
* the PC matches that register value. Hardware breakpoints have several
* advantages. They're non-intrusive to the code and so are simpler for the
* debugger to install/uninstall/manage. Also, because they are
* non-intrusive, they allow for breakpoints to be set in ROM code. The
* disadvantage is that support for them is often limited. Some
* architectures only support one or two hardware breakpoints.
*/
final static public int HARDWARE = 0x2;
/**
* This type of breakpoint is exposed to the user. The user intends for the
* breakpoint to be installed as a software breakpoint and if it cannot be
* installed as such it should not be installed at all.
*
* A software breakpoint is one that swaps out instructions in the target
* code memory with an opcode that causes the target to halt. The only
* advantage to software breakpoints is that there is no limit to how many
* can be set. The disadvantages are that they are intrusive and thus more
* difficult to install/uninstall/manage and, of course, they can't be set
* in ROM code.
*
*/
final static public int SOFTWARE = 0x3;
/**
* This type of breakpoint is <b>not</b> exposed to the user. The code that
* creates such a breakpoint intends for the breakpoint to be installed as a
* hardware breakpoint and if it cannot be installed as such it should not
* be installed at all.
*
*/
final static public int TEMPORARY_HARDWARE = 0x4;
/**
* This type of breakpoint is <b>not</b> exposed to the user. The code that
* creates such a breakpoint intends for the breakpoint to be installed as a
* software breakpoint and if it cannot be installed as such it should not
* be installed at all.
*
*/
final static public int TEMPORARY_SOFTWARE = 0x5;
/** @deprecated use ICBreakpointTyped.REGULAR */
final static public int REGULAR = ICBreakpointTyped.REGULAR;
/** @deprecated use ICBreakpointTyped.TEMPORARY */
final static public int TEMPORARY = ICBreakpointTyped.TEMPORARY;
/** @deprecated use ICBreakpointTyped.HARDWARE */
final static public int HARDWARE = ICBreakpointTyped.HARDWARE;
/**
* Returns whether this breakpoint is temporary.
*

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
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;
@ -205,7 +204,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( ICBreakpointTyped.TYPE, ICDIBreakpoint.REGULAR );
attributes.put( ICBreakpointTyped.TYPE, ICBreakpointTyped.REGULAR );
return new CLineBreakpoint( resource, attributes, register );
}

View file

@ -29,7 +29,6 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
@ -465,10 +464,10 @@ public class CDebugUtils {
String typeString = null;
int type = ((ICBreakpointTyped) breakpoint).getType();
switch (type) {
case ICDIBreakpoint.HARDWARE:
case ICBreakpointTyped.HARDWARE:
typeString = DebugCoreMessages.getString("CDebugUtils.10");
break;
case ICDIBreakpoint.TEMPORARY:
case ICBreakpointTyped.TEMPORARY:
typeString = DebugCoreMessages.getString("CDebugUtils.11");
break;
}

View file

@ -19,15 +19,101 @@ public interface ICBreakpointTyped {
* is set in (value <code>"org.eclipse.cdt.debug.core.type"</code>).
* This attribute is a <code>int</code>.
* Possible values are
* <code>ICDIBreakpoint.REGULAR</code>
* <code>ICDIBreakpoint.HARDWARE</code>
* <code>ICDIBreakpoint.TEMPORARY</code>
* <code>ICBreakpointTyped.REGULAR</code>
* <code>ICBreakpointTyped.HARDWARE</code>
* <code>ICBreakpointTyped.TEMPORARY</code>
*
* @since 5.0
*/
public static final String TYPE = "org.eclipse.cdt.debug.core.breakpointType"; //$NON-NLS-1$
/**
* This type of breakpoint is exposed to the user. How it is installed
* (hardware or software) is up to the discretion of the debugger backend. A
* common backend approach is to try one way first and then the other if the
* first attempt fails.
*
* <p>
* In the future, we will expose a preference that lets the user dictate his
* preference to the backend. That is, the user will be able to say "I want
* the backend to install regular breakpoints using hardware breakpoint
* capabilities on the target."
*
* <p>
* It's important to realize that how a backend ends up installing the
* breakpoint does not alter the type of the breakpoint in the Eclipse/CDT
* layer. A regular breakpoint will always be a <i>regular</i> breakpoint
* regardless of the technique the backend used to install it (software or
* hardware).
*/
final static public int REGULAR = 0x0;
/**
* This type of breakpoint is <b>not</b> exposed to the user and is
* typically uninstalled after getting hit. How it is installed (hardware or
* software) is up to the discretion of the debugger backend. A common
* backend approach is to try one way first and then the other if the first
* attempt fails.
*
* <p>
* Unlike the <i>regular</i> breakpoint type, there are no plans to let the
* user coax the backend to install a temporary breakpoint in any particular
* way (hardware vs software).
*/
final static public int TEMPORARY = 0x1;
/**
* This type of breakpoint is exposed to the user. The user intends for the
* breakpoint to be installed as a hardware breakpoint and if it cannot be
* installed as such it should not be installed at all.
*
* A hardware breakpoint is one that makes use of a breakpoint hardware
* facility on the target. For example, the hardware may have a breakpoint
* register where an address can be set. The target will halt itself when
* the PC matches that register value. Hardware breakpoints have several
* advantages. They're non-intrusive to the code and so are simpler for the
* debugger to install/uninstall/manage. Also, because they are
* non-intrusive, they allow for breakpoints to be set in ROM code. The
* disadvantage is that support for them is often limited. Some
* architectures only support one or two hardware breakpoints.
*/
final static public int HARDWARE = 0x2;
/**
* This type of breakpoint is exposed to the user. The user intends for the
* breakpoint to be installed as a software breakpoint and if it cannot be
* installed as such it should not be installed at all.
*
* A software breakpoint is one that swaps out instructions in the target
* code memory with an opcode that causes the target to halt. The only
* advantage to software breakpoints is that there is no limit to how many
* can be set. The disadvantages are that they are intrusive and thus more
* difficult to install/uninstall/manage and, of course, they can't be set
* in ROM code.
*
*/
final static public int SOFTWARE = 0x4;
/**
* This type of breakpoint is <b>not</b> exposed to the user. The code that
* creates such a breakpoint intends for the breakpoint to be installed as a
* hardware breakpoint and if it cannot be installed as such it should not
* be installed at all.
*
*/
final static public int TEMPORARY_HARDWARE = TEMPORARY | HARDWARE;
/**
* This type of breakpoint is <b>not</b> exposed to the user. The code that
* creates such a breakpoint intends for the breakpoint to be installed as a
* software breakpoint and if it cannot be installed as such it should not
* be installed at all.
*
*/
final static public int TEMPORARY_SOFTWARE = TEMPORARY | SOFTWARE;
/**
* Returns the type of this breakpoint
*

View file

@ -771,7 +771,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
for ( int i = 0; i < breakpoints.length; ++i ) {
try {
ICDIBreakpoint b = null;
int breakpointType = ICDIBreakpoint.REGULAR;
int breakpointType = ICBreakpointTyped.REGULAR;
ICBreakpoint icbreakpoint = breakpoints[i];
if (icbreakpoint instanceof ICBreakpointTyped) {
breakpointType = ((ICBreakpointTyped) icbreakpoint).getType();

View file

@ -56,7 +56,6 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIRestartedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressFactoryManagement;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
@ -69,6 +68,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.model.CDebugElementState;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
@ -1309,11 +1309,11 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public void setInternalTemporaryBreakpoint( ICDILocation location ) throws DebugException {
try {
if (location instanceof ICDIFunctionLocation) {
getCDITarget().setFunctionBreakpoint( ICDIBreakpoint.TEMPORARY, (ICDIFunctionLocation)location, null, false );
getCDITarget().setFunctionBreakpoint( ICBreakpointTyped.TEMPORARY, (ICDIFunctionLocation)location, null, false );
} else if (location instanceof ICDILineLocation) {
getCDITarget().setLineBreakpoint( ICDIBreakpoint.TEMPORARY, (ICDILineLocation)location, null, false );
getCDITarget().setLineBreakpoint( ICBreakpointTyped.TEMPORARY, (ICDILineLocation)location, null, false );
} else if (location instanceof ICDIAddressLocation) {
getCDITarget().setAddressBreakpoint( ICDIBreakpoint.TEMPORARY, (ICDIAddressLocation)location, null, false );
getCDITarget().setAddressBreakpoint( ICBreakpointTyped.TEMPORARY, (ICDIAddressLocation)location, null, false );
} else {
// ???
targetRequestFailed("not_a_location", null); //$NON-NLS-1$

View file

@ -33,6 +33,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MIFormat;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
@ -423,11 +424,11 @@ public class BreakpointManager extends Manager {
}
} else {
// add the new breakpoint and fire CreatedEvent
int type = ICDIBreakpoint.REGULAR;
int type = ICBreakpointTyped.REGULAR;
if (miBreakpoint.isHardware()) {
type = ICDIBreakpoint.HARDWARE;
type = ICBreakpointTyped.HARDWARE;
} else if (miBreakpoint.isTemporary()) {
type = ICDIBreakpoint.TEMPORARY;
type = ICBreakpointTyped.TEMPORARY;
}
String[] tids = null;
String tid = miBreakpoint.getThreadId();
@ -860,7 +861,7 @@ public class BreakpointManager extends Manager {
int id = EXCEPTION_THROW_IDX;
if (exceptionBps[EXCEPTION_THROW_IDX] == null) {
FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]);
FunctionBreakpoint bp = new FunctionBreakpoint(target, ICDIBreakpoint.REGULAR, location, null, enabled);
FunctionBreakpoint bp = new FunctionBreakpoint(target, ICBreakpointTyped.REGULAR, location, null, enabled);
setLocationBreakpoint(bp);
exceptionBps[id] = bp;
miBreakpoints = bp.getMIBreakpoints();
@ -872,7 +873,7 @@ public class BreakpointManager extends Manager {
int id = EXCEPTION_THROW_IDX;
if (exceptionBps[id] == null) {
FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]);
FunctionBreakpoint bp = new FunctionBreakpoint(target, ICDIBreakpoint.REGULAR, location, null, enabled);
FunctionBreakpoint bp = new FunctionBreakpoint(target, ICBreakpointTyped.REGULAR, location, null, enabled);
setLocationBreakpoint(bp);
exceptionBps[id] = bp;
if (miBreakpoints != null) {

View file

@ -16,6 +16,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.model.ICBreakpointTyped;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
import org.eclipse.cdt.debug.mi.core.cdi.Condition;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
@ -84,14 +85,14 @@ public abstract class Breakpoint extends CObject implements ICDIBreakpoint {
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
*/
public boolean isHardware() {
return (type == ICDIBreakpoint.HARDWARE);
return (type == ICBreakpointTyped.HARDWARE);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
*/
public boolean isTemporary() {
return (type == ICDIBreakpoint.TEMPORARY);
return (type == ICBreakpointTyped.TEMPORARY);
}
/**

View file

@ -13,8 +13,8 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
import java.util.Arrays;
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.ICDIEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
@ -29,7 +29,7 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
private String arg;
public EventBreakpoint(Target target, String event, String arg, ICDICondition cond, boolean enabled) {
super(target, ICDIBreakpoint.REGULAR, cond, enabled);
super(target, ICBreakpointTyped.REGULAR, cond, enabled);
this.eventType = event;
this.arg = arg==null?"":arg;
}

View file

@ -12,8 +12,8 @@
package org.eclipse.cdt.debug.mi.core.cdi.model;
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.ICDIExceptionpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
/**
* Exceptionpoint
@ -27,7 +27,7 @@ public class Exceptionpoint extends Breakpoint implements ICDIExceptionpoint {
/**
*/
public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch, ICDICondition cond, boolean enabled) {
super(target, ICDIBreakpoint.REGULAR, cond, enabled);
super(target, ICBreakpointTyped.REGULAR, cond, enabled);
fClazz = clazz;
fStopOnThrow = stopOnThrow;
fStopOnCatch = stopOnCatch;

View file

@ -22,6 +22,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDILocator;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement3;
import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.cdi.model.EventBreakpoint;
@ -54,7 +55,7 @@ public class EventBreakpointTests extends AbstractDebugTest {
void setBreakOnMain() throws CDIException {
ICDILocation location = null;
location = currentTarget.createFunctionLocation("", "main"); //$NON-NLS-1$
currentTarget.setFunctionBreakpoint(ICDIBreakpoint.TEMPORARY, (ICDIFunctionLocation) location, null, false);
currentTarget.setFunctionBreakpoint(ICBreakpointTyped.TEMPORARY, (ICDIFunctionLocation) location, null, false);
}
@ -80,7 +81,7 @@ public class EventBreakpointTests extends AbstractDebugTest {
currentTarget.deleteAllBreakpoints();
pause();
assertTrue(currentTarget instanceof ICDIBreakpointManagement3);
((ICDIBreakpointManagement3) currentTarget).setEventBreakpoint(type, arg, ICDIBreakpoint.REGULAR, null, false, true);
((ICDIBreakpointManagement3) currentTarget).setEventBreakpoint(type, arg, ICBreakpointTyped.REGULAR, null, false, true);
pause();
breakpoints = currentTarget.getBreakpoints();
assertNotNull(breakpoints);