1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

[216711] - added other visible gdb catch events, most of them is not support right now though

This commit is contained in:
Alena Laskavaia 2008-07-09 16:37:40 +00:00
parent 89050be0e1
commit 82f0c74d03
3 changed files with 84 additions and 19 deletions

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model; package org.eclipse.cdt.debug.mi.core.cdi.model;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
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;
@ -18,15 +19,43 @@ import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; 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 CATCH = "org.eclipse.cdt.debug.gdb.catch";
public static final String THROW = "org.eclipse.cdt.debug.gdb.throw"; 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 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_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_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 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 eventType;
private String arg; private String arg;
private static final HashMap<String, String> idToKeyword = new HashMap<String, String>();
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) { public EventBreakpoint(Target target, String event, String arg, ICDICondition cond, boolean enabled) {
super(target, ICBreakpointType.REGULAR, cond, enabled); super(target, ICBreakpointType.REGULAR, cond, enabled);
@ -44,12 +73,9 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
public String getGdbEvent() { public String getGdbEvent() {
if (getEventType().equals(CATCH)) return "catch"; String etype = getEventType();
if (getEventType().equals(THROW)) return "throw"; String key= idToKeyword.get(etype);
if (getEventType().equals(SIGNAL_CATCH)) return "signal"; if (key!=null) return key;
if (getEventType().equals(STOP_ON_EXEC)) return "exec";
if (getEventType().equals(STOP_ON_FORK)) return "fork";
if (getEventType().equals(STOP_ON_VFORK)) return "vfork";
return "unknown"; return "unknown";
} }
@ -78,18 +104,23 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
*/ */
public static String getEventTypeFromMI(MIBreakpoint miBreakpoint) { public static String getEventTypeFromMI(MIBreakpoint miBreakpoint) {
if (miBreakpoint.getWhat().equals("exception catch")) { if (miBreakpoint.getWhat().equals("exception catch")) {
return return EventBreakpoint.CATCH;
EventBreakpoint.CATCH;
} else if (miBreakpoint.getWhat().equals("exception throw")) { } else if (miBreakpoint.getWhat().equals("exception throw")) {
return EventBreakpoint.THROW; return EventBreakpoint.THROW;
} else if (miBreakpoint.getType().equals("catch signal")) { } else if (miBreakpoint.getType().equals("catch signal")) {
// catch signal does not work in gdb
return EventBreakpoint.SIGNAL_CATCH; return EventBreakpoint.SIGNAL_CATCH;
} else if (miBreakpoint.getType().equals("catch fork")) { }
return EventBreakpoint.STOP_ON_FORK; String miType = miBreakpoint.getType();
} else if (miBreakpoint.getType().equals("catch vfork")) { String prefix = "catch ";
return EventBreakpoint.STOP_ON_VFORK; if (miType.startsWith(prefix)) {
} else if (miBreakpoint.getType().equals("catch exec")) { String key = miType.substring(prefix.length());
return EventBreakpoint.STOP_ON_EXEC; for (String id : idToKeyword.keySet()) {
String etype = idToKeyword.get(id);
if (key.equals(etype)) {
return id;
}
}
} }
return null; // not known/supported return null; // not known/supported
} }

View file

@ -21,13 +21,23 @@ TargetOptionsPage.label=GDB/MI Options
VerboseMode.label=Verbose Mode VerboseMode.label=Verbose Mode
VerboseMode.tooltip=Verbose Mode For gdb Console VerboseMode.tooltip=Verbose Mode For gdb Console
catchCatch.label = Exception Caught
catchThrow.label = Exception Thrown
catchType.label = Event Type catchType.label = Event Type
catchSignal.label = Signal Caught catchSignal.label = Signal Caught
catchSignal.arg.label = Signal Number catchSignal.arg.label = Signal Number
catchCatch.label = Exception Caught
catchThrow.label = Exception Thrown
#Note: fork, vfork and exec is not translatable words #Note: fork, vfork and exec is not translatable words
catchFork.label = Stop on fork catchFork.label = Stop on fork
catchVfork.label = Stop on vfork catchVfork.label = Stop on vfork
catchExec.label = Stop on exec 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

View file

@ -104,10 +104,34 @@
label="%catchVfork.label" label="%catchVfork.label"
value="org.eclipse.cdt.debug.gdb.catch_vfork"> value="org.eclipse.cdt.debug.gdb.catch_vfork">
</value> </value>
<value <value
label="%catchExec.label" label="%catchExec.label"
value="org.eclipse.cdt.debug.gdb.catch_exec"> value="org.eclipse.cdt.debug.gdb.catch_exec">
</value> </value>
<value label="%catchExit.label"
value="org.eclipse.cdt.debug.gdb.catch_exit">
</value>
<value label="%catchStop.label"
value="org.eclipse.cdt.debug.gdb.catch_stop">
</value>
<value label="%catchStart.label"
value="org.eclipse.cdt.debug.gdb.catch_start">
</value>
<value label="%catchThreadStart.label"
value="org.eclipse.cdt.debug.gdb.catch_thread_start">
</value>
<value label="%catchThreadExit.label"
value="org.eclipse.cdt.debug.gdb.catch_thread_exit">
</value>
<value label="%catchThreadJoin.label"
value="org.eclipse.cdt.debug.gdb.catch_thread_join">
</value>
<value label="%catchLoad.label"
value="org.eclipse.cdt.debug.gdb.catch_load">
</value>
<value label="%catchUnload.label"
value="org.eclipse.cdt.debug.gdb.catch_unload">
</value>
</attribute> </attribute>
</breakpointLabels> </breakpointLabels>
</extension> </extension>