[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] MIPlugin changes.
|
2002-11-1 Alain Magloire
The change in MISession(), will catch things like starting gdb-5.0
with argument "-i mi1", that level of mi is not supported.
* src/.../mi/core/cdi/MemoryBlock.java (refresh): When doing the refresh
check if other blocks wehre affected and update them.
* src/.../mi/core/cdi/MemoryManager.java (update): Return the array of
affected addresses.
* src/.../mi/core/MIPlugin.java (createCSession): Do not throw an
error when trying "set new-console", it does not work on Linux.
* src/.../mi/core/MISession.java (MISession): Check if the process
terminated early, maybe because of wron arguments etc .. and throw
the exception.
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.26
diff -u -r1.26 ChangeLog
--- ChangeLog 1 Nov 2002 15:04:43 -0000 1.26
+++ ChangeLog 1 Nov 2002 16:40:11 -0000
@@ -1,3 +1,18 @@
+2002-11-1 Alain Magloire
+
+ The change in MISession(), will catch things like starting gdb-5.0
+ with argument "-i mi1", that level of mi is not supported.
+
+ * src/.../mi/core/cdi/MemoryBlock.java (refresh): When doing the refresh
+ check if other blocks wehre affected and update them.
+ * src/.../mi/core/cdi/MemoryManager.java (update): Return the array of
+ affected addresses.
+ * src/.../mi/core/MIPlugin.java (createCSession): Do not throw an
+ error when trying "set new-console", it does not work on Linux.
+ * src/.../mi/core/MISession.java (MISession): Check if the process
+ terminated early, maybe because of wron arguments etc .. and throw
+ the exception.
+
2002-11-1 David Inglis
* src/.../mi/core/MIPlugin.java
throw MIExceptions in createSession (not rethorwn IOExceptions)
Index: src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java,v
retrieving revision 1.31
diff -u -r1.31 MIPlugin.java
--- src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 1 Nov 2002 15:04:43 -0000 1.31
+++ src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 1 Nov 2002 16:40:12 -0000
@@ -115,12 +115,17 @@
MISession session = createMISession(pgdb, pty, MISession.PROGRAM);
// For windows we need to start the inferior in a new console window
// to separate the Inferior std{in,out,err} from gdb std{in,out,err}
- CommandFactory factory = session.getCommandFactory();
- MIGDBSet set = factory.createMIGDBSet(new String[]{"new-console"});
- session.postCommand(set);
- MIInfo info = set.getMIInfo();
- if (info == null) {
- throw new MIException("No answer");
+ try {
+ CommandFactory factory = session.getCommandFactory();
+ MIGDBSet set = factory.createMIGDBSet(new String[]{"new-console"});
+ session.postCommand(set);
+ MIInfo info = set.getMIInfo();
+ if (info == null) {
+ throw new MIException("No answer");
+ }
+ } catch (MIException e) {
+ // We ignore this exception, for example
+ // on GNU/Linux the new-console is an error.
}
return new CSession(session, false);
}
Index: src/org/eclipse/cdt/debug/mi/core/MISession.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java,v
retrieving revision 1.39
diff -u -r1.39 MISession.java
--- src/org/eclipse/cdt/debug/mi/core/MISession.java 26 Oct 2002 20:28:30 -0000 1.39
+++ src/org/eclipse/cdt/debug/mi/core/MISession.java 1 Nov 2002 16:40:12 -0000
@@ -4,8 +4,10 @@
*/
package org.eclipse.cdt.debug.mi.core;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
@@ -106,6 +108,27 @@
txQueue = new CommandQueue();
rxQueue = new CommandQueue();
eventQueue = new Queue();
+
+ // The Process may have terminated earlier because
+ // of bad arguments etc .. check this here and bail out.
+ try {
+ process.exitValue();
+ InputStream err = process.getErrorStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(err));
+ String line = null;
+ try {
+ line = reader.readLine();
+ reader.close();
+ } catch (Exception e) {
+ // the reader may throw a NPE.
+ }
+ if (line == null) {
+ line = "Process Terminated";
+ }
+ throw new MIException(line);
+ } catch (IllegalThreadStateException e) {
+ // Ok, it means the process is alive.
+ }
txThread = new TxThread(this);
rxThread = new RxThread(this);
Index: src/org/eclipse/cdt/debug/mi/core/cdi/MemoryBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/MemoryBlock.java,v
retrieving revision 1.8
diff -u -r1.8 MemoryBlock.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/MemoryBlock.java 31 Oct 2002 00:15:26 -0000 1.8
+++ src/org/eclipse/cdt/debug/mi/core/cdi/MemoryBlock.java 1 Nov 2002 16:40:15 -0000
@@ -115,7 +115,17 @@
public void refresh() throws CDIException {
MemoryManager mgr = (MemoryManager)getCTarget().getCSession().getMemoryManager();
setDirty(true);
- mgr.update(this, null);
+ Long[] addresses = mgr.update(this, null);
+ // Check if this affects other blocks.
+ if (addresses.length > 0) {
+ MemoryBlock[] blocks = mgr.listMemoryBlocks();
+ for (int i = 0; i < blocks.length; i++) {
+ if (! blocks[i].equals(this) && blocks[i].contains(addresses)) {
+ blocks[i].setDirty(false);
+ mgr.update(blocks[i], null);
+ }
+ }
+ }
}
/**
Index: src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java,v
retrieving revision 1.9
diff -u -r1.9 MemoryManager.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java 26 Oct 2002 23:40:34 -0000 1.9
+++ src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java 1 Nov 2002 16:40:14 -0000
@@ -56,7 +56,7 @@
/**
* update one Block.
*/
- public void update(MemoryBlock block, List aList) throws CDIException {
+ public Long[] update(MemoryBlock block, List aList) throws CDIException {
MemoryBlock newBlock = cloneBlock(block);
Long[] array = compareBlocks(block, newBlock);
// Update the block MIDataReadMemoryInfo.
@@ -69,6 +69,7 @@
mi.fireEvent(new MIMemoryChangedEvent(array));
}
}
+ return array;
}
/**