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;
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;
@ -25,8 +26,36 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
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<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) {
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
}

View file

@ -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
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

@ -108,6 +108,30 @@
label="%catchExec.label"
value="org.eclipse.cdt.debug.gdb.catch_exec">
</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>
</breakpointLabels>
</extension>