diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java index df45548b852..3eeb0b059ba 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.model; import java.util.Arrays; +import java.util.HashMap; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint; @@ -18,15 +19,43 @@ import org.eclipse.cdt.debug.core.model.ICBreakpointType; import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; 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"; + public static final String CATCH_EXIT = "org.eclipse.cdt.debug.gdb.catch_exit"; + public static final String CATCH_START = "org.eclipse.cdt.debug.gdb.catch_start"; + public static final String CATCH_STOP = "org.eclipse.cdt.debug.gdb.catch_stop"; + public static final String CATCH_THREAD_START = "org.eclipse.cdt.debug.gdb.catch_thread_start"; + public static final String CATCH_THREAD_EXIT = "org.eclipse.cdt.debug.gdb.catch_thread_exit"; + public static final String CATCH_THREAD_JOIN = "org.eclipse.cdt.debug.gdb.catch_thread_join"; + public static final String CATCH_LOAD = "org.eclipse.cdt.debug.gdb.catch_load"; + public static final String CATCH_UNLOAD = "org.eclipse.cdt.debug.gdb.catch_unload"; + private String eventType; private String arg; + private static final HashMap idToKeyword = new HashMap(); + static { + // these Ids are also referenced in mi.ui plugin as contribution + // to event breakpoints selector + idToKeyword.put(CATCH, "catch"); + idToKeyword.put(THROW, "throw"); + idToKeyword.put(SIGNAL_CATCH, "signal"); + idToKeyword.put(STOP_ON_EXEC, "exec"); + idToKeyword.put(STOP_ON_FORK, "fork"); + idToKeyword.put(STOP_ON_VFORK, "vfork"); + idToKeyword.put(CATCH_EXIT, "exit"); + idToKeyword.put(CATCH_START, "start"); + idToKeyword.put(CATCH_STOP, "stop"); + idToKeyword.put(CATCH_THREAD_START, "thread_start"); + idToKeyword.put(CATCH_THREAD_EXIT, "thread_exit"); + idToKeyword.put(CATCH_THREAD_JOIN, "thread_join"); + idToKeyword.put(CATCH_LOAD, "load"); + idToKeyword.put(CATCH_UNLOAD, "unload"); + } public EventBreakpoint(Target target, String event, String arg, ICDICondition cond, boolean enabled) { super(target, ICBreakpointType.REGULAR, cond, enabled); @@ -44,12 +73,9 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint { public String getGdbEvent() { - if (getEventType().equals(CATCH)) return "catch"; - if (getEventType().equals(THROW)) return "throw"; - if (getEventType().equals(SIGNAL_CATCH)) return "signal"; - if (getEventType().equals(STOP_ON_EXEC)) return "exec"; - if (getEventType().equals(STOP_ON_FORK)) return "fork"; - if (getEventType().equals(STOP_ON_VFORK)) return "vfork"; + String etype = getEventType(); + String key= idToKeyword.get(etype); + if (key!=null) return key; return "unknown"; } @@ -78,18 +104,23 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint { */ public static String getEventTypeFromMI(MIBreakpoint miBreakpoint) { if (miBreakpoint.getWhat().equals("exception catch")) { - return - EventBreakpoint.CATCH; + return EventBreakpoint.CATCH; } else if (miBreakpoint.getWhat().equals("exception throw")) { return EventBreakpoint.THROW; } else if (miBreakpoint.getType().equals("catch signal")) { + // catch signal does not work in gdb return EventBreakpoint.SIGNAL_CATCH; - } else if (miBreakpoint.getType().equals("catch fork")) { - return EventBreakpoint.STOP_ON_FORK; - } else if (miBreakpoint.getType().equals("catch vfork")) { - return EventBreakpoint.STOP_ON_VFORK; - } else if (miBreakpoint.getType().equals("catch exec")) { - return EventBreakpoint.STOP_ON_EXEC; + } + String miType = miBreakpoint.getType(); + String prefix = "catch "; + if (miType.startsWith(prefix)) { + String key = miType.substring(prefix.length()); + for (String id : idToKeyword.keySet()) { + String etype = idToKeyword.get(id); + if (key.equals(etype)) { + return id; + } + } } return null; // not known/supported } diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties index 90a78aed162..7ab8dda1177 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties @@ -21,13 +21,23 @@ TargetOptionsPage.label=GDB/MI Options VerboseMode.label=Verbose Mode VerboseMode.tooltip=Verbose Mode For gdb Console -catchCatch.label = Exception Caught -catchThrow.label = Exception Thrown + catchType.label = Event Type catchSignal.label = Signal Caught catchSignal.arg.label = Signal Number +catchCatch.label = Exception Caught +catchThrow.label = Exception Thrown #Note: fork, vfork and exec is not translatable words catchFork.label = Stop on fork catchVfork.label = Stop on vfork -catchExec.label = Stop on exec \ No newline at end of file +catchExec.label = Stop on exec + +catchExit.label = Process exit +catchStop.label = Process suspend +catchStart.label = Process start +catchThreadExit.label = Thread exit +catchThreadStart.label = Thread start +catchThreadJoin.label = Thread join +catchLoad.label = Library load +catchUnload.label = Library unload diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml index 3f5203d341d..ebacefa621f 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml @@ -104,10 +104,34 @@ label="%catchVfork.label" value="org.eclipse.cdt.debug.gdb.catch_vfork"> - + + + + + + + + + + + + + + + +