[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Signal implementation
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.87
diff -u -r1.87 ChangeLog
--- ChangeLog 31 Jan 2003 19:55:26 -0000 1.87
+++ ChangeLog 1 Feb 2003 23:11:50 -0000
@@ -1,3 +1,20 @@
+2003-02-01 Alain Magloire
+
+ * src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java:
+ Support for ICDISignal event.
+ * src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java (handle):
+ Implemented.
+ * src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java (update):
+ Support for ICDISignal event.
+ * src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java (handle):
+ New method.
+ * src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java (createMIHandle):
+ New method
+ * src/org/eclipse/cdt/debug/mi/core/command/MIHandle.java:
+ New File.
+ * src/org/eclipse/cdt/debug/mi/core/CLICommand.java:
+ Check for "handle" and "signal" cli command.
+
2003-01-31 Alain Magloire
* src/org/eclipse/cdt/debug/mi/core/cdi/event/DestroyedEvent.java:
Index: src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java,v
retrieving revision 1.5
diff -u -r1.5 CLIProcessor.java
--- src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java 28 Jan 2003 19:54:30 -0000 1.5
+++ src/org/eclipse/cdt/debug/mi/core/CLIProcessor.java 1 Feb 2003 23:11:51 -0000
@@ -9,6 +9,7 @@
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
+import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
/**
* Transmission command thread blocks on the command Queue
@@ -51,6 +52,8 @@
// We know something change, we just do not know what.
// So the easiest way is to let the top layer handle it.
session.fireEvent(new MIBreakpointChangedEvent(0));
+ } else if (isSettingSignal(operation)) {
+ session.fireEvent(new MISignalChangedEvent(""));
}
}
@@ -121,6 +124,16 @@
(operation.equals("en") || (operation.startsWith("en") && "enable".indexOf(operation) != -1)) ||
(operation.startsWith("ig") && "ignore".indexOf(operation) != -1) ||
(operation.startsWith("cond") && "condition".indexOf(operation) != -1)) {
+ isChange = true;
+ }
+ return isChange;
+ }
+
+ boolean isSettingSignal(String operation) {
+ boolean isChange = false;
+ /* changing signal: handle, signal */
+ if ((operation.startsWith("ha") && "handle".indexOf(operation) != -1) ||
+ (operation.startsWith("sig") && "signal".indexOf(operation) != -1)) {
isChange = true;
}
return isChange;
Index: src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java,v
retrieving revision 1.34
diff -u -r1.34 EventManager.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java 27 Jan 2003 03:17:53 -0000 1.34
+++ src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java 1 Feb 2003 23:11:55 -0000
@@ -52,6 +52,7 @@
import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MISharedLibCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MISharedLibUnloadedEvent;
+import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIStoppedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIThreadCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent;
@@ -115,12 +116,25 @@
// Something change we do not know what
// Let the breakpoint manager handle it with an update().
try {
- ((BreakpointManager)(session.getBreakpointManager())).update();
+ session.getBreakpointManager().update();
} catch (CDIException e) {
}
}
} else if (miEvent instanceof MISharedLibChangedEvent) {
cdiList.add(new ChangedEvent(session, (MISharedLibChangedEvent)miEvent));
+ } else if (miEvent instanceof MISignalChangedEvent) {
+ MISignalChangedEvent sig = (MISignalChangedEvent)miEvent;
+ String name = sig.getName();
+ if (name == null || name.length() == 0) {
+ // Something change we do not know what
+ // Let the signal manager handle it with an update().
+ try {
+ session.getSignalManager().update();
+ } catch (CDIException e) {
+ }
+ } else {
+ cdiList.add(new ChangedEvent(session, sig));
+ }
}
} else if (miEvent instanceof MIDestroyedEvent) {
if (miEvent instanceof MIThreadExitEvent) {
@@ -139,7 +153,7 @@
// Something was deleted we do not know what
// Let the breakpoint manager handle it with an update().
try {
- ((BreakpointManager)(session.getBreakpointManager())).update();
+ session.getBreakpointManager().update();
} catch (CDIException e) {
}
}
@@ -155,7 +169,7 @@
// Something created we do not know what
// Let the breakpoint manager handle it with an update().
try {
- ((BreakpointManager)(session.getBreakpointManager())).update();
+ session.getBreakpointManager().update();
} catch (CDIException e) {
}
}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java,v
retrieving revision 1.9
diff -u -r1.9 SignalManager.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java 31 Jan 2003 19:54:36 -0000 1.9
+++ src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java 1 Feb 2003 23:11:54 -0000
@@ -16,6 +16,7 @@
import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.model.Signal;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+import org.eclipse.cdt.debug.mi.core.command.MIHandle;
import org.eclipse.cdt.debug.mi.core.command.MIInfoSignals;
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
@@ -44,6 +45,9 @@
try {
mi.postCommand(sigs);
MIInfoSignalsInfo info = sigs.getMIInfoSignalsInfo();
+ if (info == null) {
+ throw new CDIException("No answer");
+ }
miSigs = info.getMISignals();
} catch (MIException e) {
throw new MI2CDIException(e);
@@ -60,6 +64,9 @@
try {
mi.postCommand(sigs);
MIInfoSignalsInfo info = sigs.getMIInfoSignalsInfo();
+ if (info == null) {
+ throw new CDIException("No answer");
+ }
MISignal[] miSigs = info.getMISignals();
if (miSigs.length > 0) {
sig = miSigs[0];
@@ -105,6 +112,32 @@
}
}
return sig;
+ }
+
+ public void handle(ICDISignal sig, boolean isIgnore, boolean isStop) throws CDIException {
+ Session session = (Session)getSession();
+ MISession mi = session.getMISession();
+ CommandFactory factory = mi.getCommandFactory();
+ StringBuffer buffer = new StringBuffer(sig.getName());
+ buffer.append(" ");
+ if (isIgnore) {
+ buffer.append("ignore");
+ } else {
+ buffer.append("noignore");
+ }
+ buffer.append(" ");
+ if (isStop) {
+ buffer.append("stop");
+ } else {
+ buffer.append("nostop");
+ }
+ MIHandle handle = factory.createMIHandle(buffer.toString());
+ try {
+ mi.postCommand(handle);
+ handle.getMIInfo();
+ } catch (MIException e) {
+ throw new MI2CDIException(e);
+ }
}
/**
Index: src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java,v
retrieving revision 1.4
diff -u -r1.4 ChangedEvent.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java 27 Jan 2003 04:49:02 -0000 1.4
+++ src/org/eclipse/cdt/debug/mi/core/cdi/event/ChangedEvent.java 1 Feb 2003 23:11:55 -0000
@@ -9,11 +9,13 @@
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
+import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
import org.eclipse.cdt.debug.mi.core.cdi.ExpressionManager;
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;
+import org.eclipse.cdt.debug.mi.core.cdi.SignalManager;
import org.eclipse.cdt.debug.mi.core.cdi.VariableManager;
import org.eclipse.cdt.debug.mi.core.cdi.model.CObject;
import org.eclipse.cdt.debug.mi.core.cdi.model.Expression;
@@ -22,6 +24,7 @@
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIRegisterChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MISharedLibChangedEvent;
+import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
/**
@@ -84,6 +87,18 @@
ICDISharedLibrary lib = mgr.getSharedLibrary(name);
if (lib != null) {
source = lib;
+ } else {
+ source = new CObject(session.getCurrentTarget());
+ }
+ }
+
+ public ChangedEvent(Session s, MISignalChangedEvent sig) {
+ session = s;
+ SignalManager mgr = (SignalManager)session.getSignalManager();
+ String name = sig.getName();
+ ICDISignal signal = mgr.getSignal(name);
+ if (signal != null) {
+ source = signal;
} else {
source = new CObject(session.getCurrentTarget());
}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java,v
retrieving revision 1.3
diff -u -r1.3 Signal.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java 31 Jan 2003 19:53:32 -0000 1.3
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java 1 Feb 2003 23:11:55 -0000
@@ -19,6 +19,7 @@
public Signal(SignalManager m, MISignal s) {
super(m.getSession().getCurrentTarget());
+ mgr = m;
sig = s;
}
@@ -44,6 +45,7 @@
* @see org.eclipse.cdt.debug.core.cdi.ICDISignalReceived#handle()
*/
public void handle(boolean ignore, boolean stop) throws CDIException {
+ mgr.handle(this, ignore, stop);
}
/**
Index: src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java,v
retrieving revision 1.20
diff -u -r1.20 CommandFactory.java
--- src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java 31 Jan 2003 19:55:07 -0000 1.20
+++ src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java 1 Feb 2003 23:11:52 -0000
@@ -277,6 +277,10 @@
return new MIInfoSignals(name);
}
+ public MIHandle createMIHandle(String arg) {
+ return new MIHandle(arg);
+ }
+
public MIPType createMIPType(String name) {
return new MIPType(name);
}
Index: src/org/eclipse/cdt/debug/mi/core/command/MIHandle.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/mi/core/command/MIHandle.java
diff -N src/org/eclipse/cdt/debug/mi/core/command/MIHandle.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/mi/core/command/MIHandle.java 1 Feb 2003 23:11:51 -0000
@@ -0,0 +1,22 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+
+package org.eclipse.cdt.debug.mi.core.command;
+
+
+
+/**
+ *
+ * handle SIGUSR1 nostop noignore
+ *
+ */
+public class MIHandle extends CLICommand {
+
+ public MIHandle(String arg) {
+ super("handle " + arg);
+ }
+
+}