|
Message
From: cvs at opencores.org<cvs@o...>
Date: Thu Nov 29 15:57:56 CET 2007
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/07/11 29:15:57 Modified: jop/java/tools/src/com/jopdesign/debug/jdwp JOPDebugChannel.java Log: Changed a few method signatures and added some new ones. Methods changed: 130: private boolean isConnected() 155: public void sendExitCommand(int exitCode) throws IOException 191: public void sendResumeCommand() throws IOException Methods created: 271: public int printStackFrames() throws IOException 287: public int printStackFrame(int frameIndex) throws IOException 398: public int getNumberOfLocalVariables(int frameIndex) throws IOException Revision Changes Path 1.3 jop/java/tools/src/com/jopdesign/debug/jdwp/JOPDebugChannel.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/debug/jdwp/JOPDebugChannel.java.diff?r1=1.2&r2=1.3 (In the diff below, changes in quantity of whitespace are not shown.) Index: JOPDebugChannel.java =================================================================== RCS file: /cvsroot/paulo/jop/java/tools/src/com/jopdesign/debug/jdwp/JOPDebugChannel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- JOPDebugChannel.java 6 Nov 2007 05:40:00 -0000 1.2 +++ JOPDebugChannel.java 29 Nov 2007 14:57:56 -0000 1.3 @@ -117,9 +117,26 @@ } } - public boolean isConnected() + /** + * Test the internal flag to check if it has connected. + * + * This method CANNOT BE USED to test if the server closed + * the connection. It should be used only to test if + * this object started a connection some time ago. + * Just this. + * + * @return + */ + private boolean isConnected() { return connected; + + // the code below can't be used to test if the server closed + // the connection. It seems that the only way to find out + // this is to try to write to the socket and look for + // an exception. +// return socket != null && socket.isConnected() && +// (socket.isClosed() == false); } /** @@ -135,7 +152,7 @@ } } - public void requestExit(int exitCode) throws IOException + public void sendExitCommand(int exitCode) throws IOException { checkConnection(); //------------------------------------------------------------ @@ -171,7 +188,7 @@ input.readInt(); } - public void resume() throws IOException + public void sendResumeCommand() throws IOException { checkConnection(); //------------------------------------------------------------ @@ -251,6 +268,39 @@ return received; } + public int printStackFrames() throws IOException + { + checkConnection(); +
+ int received;
+ //------------------------------------------------------------
+ // request to print all stack frames
+ output.writeByte(11);
+ output.writeByte(13);
+
+ received = input.readInt();
+// System.out.println(" Stack depth: " + received);
+
+ return received;
+ }
+
+ public int printStackFrame(int frameIndex) throws IOException
+ {
+ checkConnection();
+
+ int received;
+ //------------------------------------------------------------
+ // request to print all stack frames
+ output.writeByte(11);
+ output.writeByte(14);
+
+ output.writeInt(frameIndex);
+
+ received = input.readInt();
+
+ return received;
+ }
+
public int getLocalVariableValue(int frameIndex, int variableIndex) throws IOException
{
checkConnection();
@@ -337,6 +387,34 @@
System.out.println(" Variable value: " + received);
}
+ /**
+ * Get the number of local variables in a given stack frame,
+ * as reported by JOP (not using the symbol file).
+ *
+ * @param frameIndex
+ * @return
+ * @throws IOException
+ */
+ public int getNumberOfLocalVariables(int frameIndex) throws IOException
+ {
+ checkConnection();
+
+ int received;
+ //------------------------------------------------------------
+ // query the second local variable (index 1) on the first frame (index 0)
+ output.writeByte(16);
+ output.writeByte(5);
+
+ // frame 0 (main method call)
+// output.writeInt(0);
+ output.writeInt(frameIndex);
+
+ received = input.readInt();
+ System.out.println(" Number of local variables: " + received);
+
+ return received;
+ }
+
/*
* Request the machine to invoke a static method.
*
|
 |