1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-15 20:25:46 +02:00

[305752] Constants for standard event breakpoint types should be outside the CDI-GDB plugin

This commit is contained in:
John Cortell 2010-03-12 23:36:43 +00:00
parent cde61d6544
commit 9146796fd6
9 changed files with 180 additions and 87 deletions

View file

@ -19,34 +19,160 @@ import org.eclipse.core.runtime.CoreException;
* is break on raising exception in C++, or break on receiving signal. * is break on raising exception in C++, or break on receiving signal.
* *
* @sinse 5.0 * @sinse 5.0
* @since 7.0
*/ */
public interface ICEventBreakpoint extends ICBreakpoint { public interface ICEventBreakpoint extends ICBreakpoint {
/** /**
* Breakpoint attribute storing the event breakpoint event id * Breakpoint attribute storing the event breakpoint event id. Basically,
* this indicates what type of event the breakpoint catches--e.g., a C++
* exception throw, a library load, a thread exit, etc. Event types can be
* contributed via the "breakpointContribution" extension point. Stock CDT
* contributes a number of them, which are represented here by the
* EVENT_TYPE_XXXXX constants
*
* <p>
* This attribute is a <code>String</code>. * This attribute is a <code>String</code>.
* *
*/ */
public static final String EVENT_TYPE_ID = "org.eclipse.cdt.debug.core.eventbreakpoint_event_id"; //$NON-NLS-1$ public static final String EVENT_TYPE_ID = "org.eclipse.cdt.debug.core.eventbreakpoint_event_id"; //$NON-NLS-1$
/** /**
* Breakpoint attribute storing the event breakpoint argument * An event breakpoint of this type suspends the target program when it
* This attribute is a <code>String</code>. * catches a C++ exception. This type of event has no parameters.
* *
* @since 7.0
*/
public static final String EVENT_TYPE_CATCH = "org.eclipse.cdt.debug.gdb.catch"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* throws a C++ exception. This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_THROW = "org.eclipse.cdt.debug.gdb.throw"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* catches a signal (POSIX). This type of event has a single parameter of
* type in, indicating the specific signal.
*
* @since 7.0
*/
public static final String EVENT_TYPE_SIGNAL_CATCH = "org.eclipse.cdt.debug.gdb.signal"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* calls fork() (POSIX). This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_FORK = "org.eclipse.cdt.debug.gdb.catch_fork"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* calls vfork() (POSIX). This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_VFORK = "org.eclipse.cdt.debug.gdb.catch_vfork"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* calls exec() (POSIX). This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_EXEC = "org.eclipse.cdt.debug.gdb.catch_exec"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* calls exit() (POSIX). This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_EXIT = "org.eclipse.cdt.debug.gdb.catch_exit"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when a new
* process starts. This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_PROCESS_START = "org.eclipse.cdt.debug.gdb.catch_start"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when a
* process exits. This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_PROCESS_STOP = "org.eclipse.cdt.debug.gdb.catch_stop"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when a new
* thread starts. This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_THREAD_START = "org.eclipse.cdt.debug.gdb.catch_thread_start"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when a
* thread exits. This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_THREAD_EXIT = "org.eclipse.cdt.debug.gdb.catch_thread_exit"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when a
* thread joins another one (waits for it to exit) This type of event has no
* parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_THREAD_JOIN = "org.eclipse.cdt.debug.gdb.catch_thread_join"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* loads a library. This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_LIBRARY_LOAD = "org.eclipse.cdt.debug.gdb.catch_load"; //$NON-NLS-1$
/**
* An event breakpoint of this type suspends the target program when it
* unloads a library. This type of event has no parameters.
*
* @since 7.0
*/
public static final String EVENT_TYPE_LIBRARY_UNLOAD = "org.eclipse.cdt.debug.gdb.catch_unload"; //$NON-NLS-1$
/**
* Breakpoint attribute storing the event breakpoint argument. This
* attribute is a <code>String</code>, though it may be a stringified
* representation of another type (it may be a number, for example).
* Currently, an event type can have only one argument
*/ */
public static final String EVENT_ARG = "org.eclipse.cdt.debug.core.eventbreakpoint_event_arg"; //$NON-NLS-1$ public static final String EVENT_ARG = "org.eclipse.cdt.debug.core.eventbreakpoint_event_arg"; //$NON-NLS-1$
/** /**
* Get event breakpoint type. This is usually id in reverse web notation. * Get the event breakpoint type. One of our EVENT_TYPE_XXXXX constants or a
* This type is interpreted by underlying debugger implementation. * custom type contributed via the <code>breakpointContribution</code>
* Use extension point <code>org.eclipse.cdt.debug.ui.breakpointContribution</code> to define user visible label for this event type. * extension point
*
* @return event breakpoint type id (not null) * @return event breakpoint type id (not null)
* @throws CoreException * @throws CoreException
*/ */
String getEventType() throws CoreException; String getEventType() throws CoreException;
/** /**
* Get extra event argument. For example name of the exception or number of a signal. * Get the event argument, if the type has one. Currently, an event type can
* Use extension point <code>org.eclipse.cdt.debug.ui.breakpointContribution</code> to define UI control to edit/view this argument * have at most one argument.
* @return event argument (not null) *
* @return event argument, or null if not applicable
* @throws CoreException * @throws CoreException
*/ */
String getEventArgument() throws CoreException; String getEventArgument() throws CoreException;

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.mi.core; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.debug.mi.core; singleton:=true
Bundle-Version: 6.1.0.qualifier Bundle-Version: 7.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.mi.core.MIPlugin Bundle-Activator: org.eclipse.cdt.debug.mi.core.MIPlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -14,7 +14,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDIEventBreakpointHit;
import org.eclipse.cdt.debug.mi.core.event.MICatchpointHitEvent; import org.eclipse.cdt.debug.mi.core.event.MICatchpointHitEvent;
/** /**
* @since 6.1 * @since 7.0
*/ */
public class EventBreakpointHit extends SessionObject implements ICDIEventBreakpointHit { public class EventBreakpointHit extends SessionObject implements ICDIEventBreakpointHit {

View file

@ -12,10 +12,12 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointType; import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
/** /**
@ -23,71 +25,38 @@ import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
*/ */
public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint { public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
public static final String CATCH = "org.eclipse.cdt.debug.gdb.catch";
public static final String THROW = "org.eclipse.cdt.debug.gdb.throw";
public static final String SIGNAL_CATCH = "org.eclipse.cdt.debug.gdb.signal";
public static final String STOP_ON_FORK = "org.eclipse.cdt.debug.gdb.catch_fork";
public static final String STOP_ON_VFORK = "org.eclipse.cdt.debug.gdb.catch_vfork";
public static final String STOP_ON_EXEC = "org.eclipse.cdt.debug.gdb.catch_exec";
/**
* @since 6.0
*/
public static final String CATCH_EXIT = "org.eclipse.cdt.debug.gdb.catch_exit";
/**
* @since 6.0
*/
public static final String CATCH_START = "org.eclipse.cdt.debug.gdb.catch_start";
/**
* @since 6.0
*/
public static final String CATCH_STOP = "org.eclipse.cdt.debug.gdb.catch_stop";
/**
* @since 6.0
*/
public static final String CATCH_THREAD_START = "org.eclipse.cdt.debug.gdb.catch_thread_start";
/**
* @since 6.0
*/
public static final String CATCH_THREAD_EXIT = "org.eclipse.cdt.debug.gdb.catch_thread_exit";
/**
* @since 6.0
*/
public static final String CATCH_THREAD_JOIN = "org.eclipse.cdt.debug.gdb.catch_thread_join";
/**
* @since 6.0
*/
public static final String CATCH_LOAD = "org.eclipse.cdt.debug.gdb.catch_load";
/**
* @since 6.0
*/
public static final String CATCH_UNLOAD = "org.eclipse.cdt.debug.gdb.catch_unload";
private String eventType; private String eventType;
private String arg; private String arg;
private static final HashMap<String, String> idToKeyword = new HashMap<String, String>();
/**
* A mapping of ICEventBreakpoint event types to their corresponding gdb
* catchpoint keyword
*/
private static final Map<String, String> idToKeyword = new HashMap<String, String>();
static { static {
// these Ids are also referenced in mi.ui plugin as contribution // these Ids are also referenced in mi.ui plugin as contribution
// to event breakpoints selector // to event breakpoints selector
idToKeyword.put(CATCH, "catch"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_CATCH, "catch"); //$NON-NLS-1$
idToKeyword.put(THROW, "throw"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THROW, "throw"); //$NON-NLS-1$
idToKeyword.put(SIGNAL_CATCH, "signal"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_SIGNAL_CATCH, "signal"); //$NON-NLS-1$
idToKeyword.put(STOP_ON_EXEC, "exec"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_EXEC, "exec"); //$NON-NLS-1$
idToKeyword.put(STOP_ON_FORK, "fork"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_FORK, "fork"); //$NON-NLS-1$
idToKeyword.put(STOP_ON_VFORK, "vfork"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_VFORK, "vfork"); //$NON-NLS-1$
idToKeyword.put(CATCH_EXIT, "exit"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_EXIT, "exit"); //$NON-NLS-1$
idToKeyword.put(CATCH_START, "start"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_PROCESS_START, "start"); //$NON-NLS-1$
idToKeyword.put(CATCH_STOP, "stop"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_PROCESS_STOP, "stop"); //$NON-NLS-1$
idToKeyword.put(CATCH_THREAD_START, "thread_start"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THREAD_START, "thread_start"); //$NON-NLS-1$
idToKeyword.put(CATCH_THREAD_EXIT, "thread_exit"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THREAD_EXIT, "thread_exit"); //$NON-NLS-1$
idToKeyword.put(CATCH_THREAD_JOIN, "thread_join"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THREAD_JOIN, "thread_join"); //$NON-NLS-1$
idToKeyword.put(CATCH_LOAD, "load"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_LIBRARY_LOAD, "load"); //$NON-NLS-1$
idToKeyword.put(CATCH_UNLOAD, "unload"); idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_LIBRARY_UNLOAD, "unload"); //$NON-NLS-1$
} }
public EventBreakpoint(Target target, String event, String arg, ICDICondition cond, boolean enabled) { public EventBreakpoint(Target target, String event, String arg, ICDICondition cond, boolean enabled) {
super(target, ICBreakpointType.REGULAR, cond, enabled); super(target, ICBreakpointType.REGULAR, cond, enabled);
this.eventType = event; this.eventType = event;
this.arg = arg==null?"":arg; this.arg = arg==null?"":arg; //$NON-NLS-1$
} }
public String getEventType() { public String getEventType() {
@ -103,7 +72,7 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
String etype = getEventType(); String etype = getEventType();
String key= idToKeyword.get(etype); String key= idToKeyword.get(etype);
if (key!=null) return key; if (key!=null) return key;
return "unknown"; return "unknown"; //$NON-NLS-1$
} }
public String getGdbArg() { public String getGdbArg() {
@ -130,16 +99,16 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
* @return null if unknown type, null cannot be used to create valid EventBreakpoint * @return null if unknown type, null cannot be used to create valid EventBreakpoint
*/ */
public static String getEventTypeFromMI(MIBreakpoint miBreakpoint) { public static String getEventTypeFromMI(MIBreakpoint miBreakpoint) {
if (miBreakpoint.getWhat().equals("exception catch")) { if (miBreakpoint.getWhat().equals("exception catch")) { //$NON-NLS-1$
return EventBreakpoint.CATCH; return ICEventBreakpoint.EVENT_TYPE_CATCH;
} else if (miBreakpoint.getWhat().equals("exception throw")) { } else if (miBreakpoint.getWhat().equals("exception throw")) { //$NON-NLS-1$
return EventBreakpoint.THROW; return ICEventBreakpoint.EVENT_TYPE_THROW;
} else if (miBreakpoint.getType().equals("catch signal")) { } else if (miBreakpoint.getType().equals("catch signal")) { //$NON-NLS-1$
// catch signal does not work in gdb // catch signal does not work in gdb
return EventBreakpoint.SIGNAL_CATCH; return ICEventBreakpoint.EVENT_TYPE_SIGNAL_CATCH;
} }
String miType = miBreakpoint.getType(); String miType = miBreakpoint.getType();
String prefix = "catch "; String prefix = "catch "; //$NON-NLS-1$
if (miType.startsWith(prefix)) { if (miType.startsWith(prefix)) {
String key = miType.substring(prefix.length()); String key = miType.substring(prefix.length());
for (String id : idToKeyword.keySet()) { for (String id : idToKeyword.keySet()) {
@ -154,7 +123,7 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
public static String getEventArgumentFromMI(MIBreakpoint miBreakpoint) { public static String getEventArgumentFromMI(MIBreakpoint miBreakpoint) {
// need a working gdb command command that support catch event argument test test // need a working gdb command command that support catch event argument test test
return ""; return ""; //$NON-NLS-1$
} }
} }

View file

@ -17,7 +17,7 @@ import java.io.OutputStream;
/** /**
* Receiving, and printing to the console, stderr output * Receiving, and printing to the console, stderr output
* @since 6.1 * @since 7.0
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */

View file

@ -14,7 +14,7 @@ import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
/** /**
* @since 6.1 * @since 7.0
*/ */
public class MICatchpointHitEvent extends MIStoppedEvent { public class MICatchpointHitEvent extends MIStoppedEvent {

View file

@ -109,7 +109,7 @@ public class MIProcessAdapter implements MIProcess {
* @throws IOException * @throws IOException
* on failure to create the child process * on failure to create the child process
* *
* @since 6.1 * @since 7.0
*/ */
protected Process createGDBProcess(String[] args) throws IOException { protected Process createGDBProcess(String[] args) throws IOException {
return ProcessFactory.getFactory().exec(args); return ProcessFactory.getFactory().exec(args);

View file

@ -14,7 +14,7 @@ Export-Package: org.eclipse.cdt.debug.mi.internal.ui;x-internal:=true,
org.eclipse.cdt.debug.mi.ui org.eclipse.cdt.debug.mi.ui
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)", org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.debug.mi.core;bundle-version="[6.0.0,7.0.0)", org.eclipse.cdt.debug.mi.core;bundle-version="[7.0.0,8.0.0)",
org.eclipse.cdt.debug.ui;bundle-version="[7.0.0,8.0.0)", org.eclipse.cdt.debug.ui;bundle-version="[7.0.0,8.0.0)",
org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.0.0)", org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.0.0)",
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)", org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",

View file

@ -16,15 +16,13 @@ import junit.framework.Test;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.ICDILocator; 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.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement3; import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement3;
import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointType; import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.cdi.model.EventBreakpoint;
public class EventBreakpointTests extends AbstractDebugTest { public class EventBreakpointTests extends AbstractDebugTest {
public static Test suite() { public static Test suite() {
@ -54,11 +52,11 @@ public class EventBreakpointTests extends AbstractDebugTest {
public void testCatch() throws CModelException, IOException, MIException, CDIException { public void testCatch() throws CModelException, IOException, MIException, CDIException {
eventbreakpoints(EventBreakpoint.CATCH, ""); eventbreakpoints(ICEventBreakpoint.EVENT_TYPE_CATCH, "");
} }
public void testThrow() throws CModelException, IOException, MIException, CDIException { public void testThrow() throws CModelException, IOException, MIException, CDIException {
eventbreakpoints(EventBreakpoint.THROW, ""); eventbreakpoints(ICEventBreakpoint.EVENT_TYPE_THROW, "");
} }
private void eventbreakpoints(String type, String arg) throws CModelException, IOException, MIException, CDIException { private void eventbreakpoints(String type, String arg) throws CModelException, IOException, MIException, CDIException {