|
Message
From: cvs at opencores.org<cvs@o...>
Date: Tue Dec 18 04:07:20 CET 2007
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/07/12 18:04:07 Modified: jop/java/target/src/test/debug/io DebugKernelChannel.java Log: Methods added: 224: private void writeFieldId(int fieldId) 234: private void writeObjectId(int objectId) 240: private void writeFrameId(int frameId) 401: public synchronized void sendReplyGetLocalVariable(int value) throws IOException 418: public synchronized void sendReplyLocalVariableCount(int localVariableCount) throws IOException 433: public synchronized void sendReplySetBreakpoint(int instruction) throws IOException 441: public synchronized void sendReplyTestJDWPPackets(int numPackets) throws IOException 521: public synchronized void skipBytes(int numBytes) 531: public synchronized void skipInt() 539: private void printInputPacketDescription() 544: private void printOutputPacketDescription() 565: public void prepareStackFrameListPacket(int count) throws IOException 579: public synchronized void writeStackFrameId(int framePointer) 589: public synchronized void sendStackFrameListReply() throws IOException Methods changed: 200: public void writeExecutableLocation(int typeTag, int classId, 277: private synchronized void sendPacket() throws IOException 292: public synchronized void receivePacket() throws IOException 427: public synchronized int readByteValue() Revision Changes Path 1.3 jop/java/target/src/test/debug/io/DebugKernelChannel.java http://www.opencores.org/cvsweb.shtml/jop/java/target/src/test/debug/io/DebugKernelChannel.java.diff?r1=1.2&r2=1.3 (In the diff below, changes in quantity of whitespace are not shown.) Index: DebugKernelChannel.java =================================================================== RCS file: /cvsroot/paulo/jop/java/target/src/test/debug/io/DebugKernelChannel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- DebugKernelChannel.java 12 Dec 2007 23:54:32 -0000 1.2 +++ DebugKernelChannel.java 18 Dec 2007 03:07:20 -0000 1.3 @@ -26,6 +26,7 @@ import java.io.InputStream; import java.io.OutputStream; +import debug.JopDebugKernel; import debug.constants.EventKindConstants; import debug.constants.SuspendPolicyConstants; @@ -196,7 +197,7 @@ * @param methodId * @param methodLocation */ - private void writeExecutableLocation(int typeTag, int classId, + public void writeExecutableLocation(int typeTag, int classId, int methodId, int methodLocation) { writeTypeTag(typeTag); @@ -220,11 +221,27 @@ outputPacket.writeInt(classId); } + private void writeFieldId(int fieldId) + { + outputPacket.writeInt(fieldId); + } + private void writeMethodId(int methodId) { outputPacket.writeInt(methodId); } + private void writeObjectId(int objectId) + { + outputPacket.writeInt(0); + outputPacket.writeInt(objectId); + } +
+ private void writeFrameId(int frameId)
+ {
+ outputPacket.writeInt(frameId);
+ }
+
private void writeMethodLocation(int location)
{
outputPacket.writeInt(0);
@@ -277,6 +294,12 @@
private synchronized void sendPacket() throws IOException
{
outputPacket.writePacket(outputStream);
+
+ JopDebugKernel.debugPrint("Packet sent! ");
+ if(JopDebugKernel.shouldPrintInternalMessages())
+ {
+ printOutputPacketDescription();
+ }
}
/**
@@ -292,6 +315,12 @@
public synchronized void receivePacket() throws IOException
{
inputPacket.readPacket(inputStream);
+
+ JopDebugKernel.debugPrint("Packet arrived!");
+ if(JopDebugKernel.shouldPrintInternalMessages())
+ {
+ printInputPacketDescription();
+ }
}
/**
@@ -363,6 +392,61 @@
}
/**
+ * Send a reply packet based on the last received packet.
+ * Insert the local variable content in the data.
+ *
+ * @param value
+ * @throws IOException
+ */
+ public synchronized void sendReplyGetLocalVariable(int value) throws IOException
+ {
+ // the content will be the local variable value.
+ // currently there's support to provide only one local variable.
+ createIntReplyPacket(1);
+ outputPacket.writeInt(value);
+
+ sendPacket();
+ }
+
+ /**
+ * Send a reply packet based on the last received packet.
+ * Insert the number of local variables.
+ *
+ * @param localVariableCount
+ * @throws IOException
+ */
+ public synchronized void sendReplyLocalVariableCount(int localVariableCount) throws IOException
+ {
+ // create a reply packet based on the received packet.
+ // the content will be the number of local variables.
+ createIntReplyPacket(localVariableCount);
+ sendPacket();
+ }
+
+ /**
+ * Send a reply packet based on the last received packet.
+ * Insert the overwritten instruction.
+ *
+ * @param instruction
+ * @throws IOException
+ */
+ public synchronized void sendReplySetBreakpoint(int instruction) throws IOException
+ {
+ // create a reply packet based on the received packet.
+ // the content will be the overwritten instruction
+ createIntReplyPacket(instruction);
+ sendPacket();
+ }
+
+ public synchronized void sendReplyTestJDWPPackets(int numPackets) throws IOException
+ {
+ // create a reply packet based on the received packet.
+ // the content will be the number of packets that will follow.
+ createIntReplyPacket(numPackets);
+ sendPacket();
+ }
+
+ /**
* Send a reply packet with an error code, based on the last received packet.
* The error code will be sent in the "error" field, to inform the error to
* the server.
@@ -426,6 +510,84 @@
*/
public synchronized int readByteValue()
{
- return inputPacket.readInt();
+ return inputPacket.readByte();
+ }
+
+ /**
+ * Skip some bytes from the input packet.
+ *
+ * @param numBytes
+ */
+ public synchronized void skipBytes(int numBytes)
+ {
+ inputPacket.skipBytes(numBytes);
+ }
+
+ /**
+ * Skip four bytes from the input packet.
+ *
+ * @param numBytes
+ */
+ public synchronized void skipInt()
+ {
+ skipBytes(4);
+ }
+
+ /**
+ * Print information about the input packet.
+ */
+ private void printInputPacketDescription()
+ {
+ inputPacket.printPacketHeader(System.out);
+ }
+
+ private void printOutputPacketDescription()
+ {
+ outputPacket.printPacketHeader(System.out);
+ }
+
+// Unfortunately there's no simple way to do this with one method call
+// (and without using dynamic lists), because the stack size changes
+// during execution.
+// So, the debug kernel uses the three methods below.
+// It does this for every "getstack frame list" command:
+//
+// - call prepareStackFrameListPacket once
+// - call many times writeStackFrameInformation
+// - call sendStackFrameListReply once
+//
+ /**
+ * Prepare the reply for the "get stack frame list" command.
+ *
+ * @param count
+ * @throws IOException
+ */
+ public void prepareStackFrameListPacket(int count) throws IOException
+ {
+ // create a reply packet based on the received packet.
+ createEmptyReplyPacket();
+
+ // write the number of stack frames.
+ outputPacket.writeInt(count);
+ }
+
+ /**
+ * Write information related to one stack frame to the output packet.
+ *
+ * @param framePointer
+ */
+ public synchronized void writeStackFrameId(int framePointer)
+ {
+ outputPacket.writeInt(framePointer);
+ }
+
+ /**
+ * Send the packet with data about stack frmaes to the server.
+ *
+ * @throws IOException
+ */
+ public synchronized void sendStackFrameListReply() throws IOException
+ {
+ sendPacket();
}
}
\ No newline at end of file
|
 |