summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/classpath
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/gnu/classpath')
-rw-r--r--libjava/classpath/gnu/classpath/ByteArray.java109
-rw-r--r--libjava/classpath/gnu/classpath/debug/Simple1LineFormatter.java22
-rw-r--r--libjava/classpath/gnu/classpath/debug/SystemLogger.java8
-rw-r--r--libjava/classpath/gnu/classpath/debug/TeeInputStream.java98
-rw-r--r--libjava/classpath/gnu/classpath/debug/TeeOutputStream.java93
-rw-r--r--libjava/classpath/gnu/classpath/debug/TeeReader.java98
-rw-r--r--libjava/classpath/gnu/classpath/debug/TeeWriter.java93
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/Jdwp.java46
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java15
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java6
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/ClassUnloadEvent.java96
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/Event.java37
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/EventManager.java9
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java157
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/MethodEntryEvent.java118
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/MethodExitEvent.java115
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/SingleStepEvent.java121
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java4
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java4
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/VmInitEvent.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java62
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java4
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java8
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java8
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java8
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java6
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/util/Location.java40
32 files changed, 1207 insertions, 191 deletions
diff --git a/libjava/classpath/gnu/classpath/ByteArray.java b/libjava/classpath/gnu/classpath/ByteArray.java
deleted file mode 100644
index 6307b8abd79..00000000000
--- a/libjava/classpath/gnu/classpath/ByteArray.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* ByteArray.java -- wrapper around a byte array, with nice toString output.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-public final class ByteArray
-{
- private final byte[] value;
-
- public ByteArray (final byte[] value)
- {
- this.value = value;
- }
-
- public byte[] getValue ()
- {
- return value;
- }
-
- public String toString ()
- {
- StringWriter str = new StringWriter ();
- PrintWriter out = new PrintWriter (str);
- int i = 0;
- int len = value.length;
- while (i < len)
- {
- out.print (formatInt (i, 16, 8));
- out.print (" ");
- int l = Math.min (16, len - i);
- String s = toHexString (value, i, l, ' ');
- out.print (s);
- for (int j = 56 - (56 - s.length ()); j < 56; j++)
- out.print (" ");
- for (int j = 0; j < l; j++)
- {
- byte b = value[i+j];
- if ((b & 0xFF) < 0x20 || (b & 0xFF) > 0x7E)
- out.print (".");
- else
- out.print ((char) (b & 0xFF));
- }
- out.println ();
- i += 16;
- }
- return str.toString ();
- }
-
- public static String toHexString (byte[] buf, int off, int len, char sep)
- {
- StringBuffer str = new StringBuffer();
- for (int i = 0; i < len; i++)
- {
- str.append (Character.forDigit (buf[i+off] >>> 4 & 0x0F, 16));
- str.append (Character.forDigit (buf[i+off] & 0x0F, 16));
- if (i < len - 1)
- str.append(sep);
- }
- return str.toString();
- }
-
- public static String formatInt (int value, int radix, int len)
- {
- String s = Integer.toString (value, radix);
- StringBuffer buf = new StringBuffer ();
- for (int j = 0; j < len - s.length(); j++)
- buf.append ("0");
- buf.append (s);
- return buf.toString();
- }
-}
diff --git a/libjava/classpath/gnu/classpath/debug/Simple1LineFormatter.java b/libjava/classpath/gnu/classpath/debug/Simple1LineFormatter.java
index 0bdf22a1950..96573193a9e 100644
--- a/libjava/classpath/gnu/classpath/debug/Simple1LineFormatter.java
+++ b/libjava/classpath/gnu/classpath/debug/Simple1LineFormatter.java
@@ -38,10 +38,11 @@ exception statement from your version. */
package gnu.classpath.debug;
-import gnu.classpath.SystemProperties;
+import gnu.java.security.action.GetPropertyAction;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.security.AccessController;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.NumberFormat;
@@ -91,20 +92,27 @@ public class Simple1LineFormatter
extends Formatter
{
private static final String DAT_PATTERN = "yyyy-MM-dd HH:mm:ss.SSSS Z ";
- private static final DateFormat DAT_FORMAT = new SimpleDateFormat(DAT_PATTERN);
private static final String THREAD_PATTERN = " #########0;-#########0";
- private static final NumberFormat THREAD_FORMAT = new DecimalFormat(THREAD_PATTERN);
private static final String SPACES_32 = " ";
private static final String SPACES_6 = " ";
- private static final String LS = SystemProperties.getProperty("line.separator");
+ private static final String LS = (String) AccessController.doPrivileged
+ (new GetPropertyAction("line.separator"));
+ private DateFormat dateFormat;
+ private NumberFormat threadFormat;
// default 0-arguments constructor
public String format(LogRecord record)
{
- StringBuffer sb = new StringBuffer(180)
- .append(DAT_FORMAT.format(new Date(record.getMillis())))
- .append(THREAD_FORMAT.format(record.getThreadID()))
+ if (dateFormat == null)
+ dateFormat = new SimpleDateFormat(DAT_PATTERN);
+
+ if (threadFormat == null)
+ threadFormat = new DecimalFormat(THREAD_PATTERN);
+
+ StringBuilder sb = new StringBuilder(180)
+ .append(dateFormat.format(new Date(record.getMillis())))
+ .append(threadFormat.format(record.getThreadID()))
.append(" ");
String s = record.getSourceClassName();
if (s == null)
diff --git a/libjava/classpath/gnu/classpath/debug/SystemLogger.java b/libjava/classpath/gnu/classpath/debug/SystemLogger.java
index 94aa93f69da..502b488702b 100644
--- a/libjava/classpath/gnu/classpath/debug/SystemLogger.java
+++ b/libjava/classpath/gnu/classpath/debug/SystemLogger.java
@@ -38,7 +38,9 @@ version. */
package gnu.classpath.debug;
-import gnu.classpath.SystemProperties;
+import gnu.java.security.action.GetPropertyAction;
+
+import java.security.AccessController;
import java.util.StringTokenizer;
import java.util.logging.Logger;
@@ -49,8 +51,8 @@ public final class SystemLogger
static
{
SYSTEM.setFilter (PreciseFilter.GLOBAL);
-
- String defaults = SystemProperties.getProperty ("gnu.classpath.debug.components");
+ String defaults = (String) AccessController.doPrivileged
+ (new GetPropertyAction("gnu.classpath.debug.components"));
if (defaults != null)
{
diff --git a/libjava/classpath/gnu/classpath/debug/TeeInputStream.java b/libjava/classpath/gnu/classpath/debug/TeeInputStream.java
new file mode 100644
index 00000000000..ef6b2ed3dc1
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/debug/TeeInputStream.java
@@ -0,0 +1,98 @@
+/* TeeInputStream.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module. An
+independent module is a module which is not derived from or based on
+this library. If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from your
+version. */
+
+package gnu.classpath.debug;
+
+import java.io.*;
+
+/**
+ * An input stream that copies all its input to a byte sink.
+ *
+ * @author Chris Burdess
+ */
+public class TeeInputStream
+ extends InputStream
+{
+
+ private final InputStream in;
+ private final OutputStream out;
+
+ /**
+ * Constructs a tee input stream.
+ * @param in the underlying input stream
+ * @param out the output sink
+ */
+ public TeeInputStream(InputStream in, OutputStream out)
+ {
+ this.in = in;
+ this.out = out;
+ }
+
+ public int read()
+ throws IOException
+ {
+ int ret = in.read();
+ out.write(ret);
+ out.flush();
+ return ret;
+ }
+
+ public int read(byte[] b, int off, int len)
+ throws IOException
+ {
+ int ret = in.read(b, off, len);
+ if (ret != -1)
+ {
+ out.write(b, off, ret);
+ out.flush();
+ }
+ return ret;
+ }
+
+ public void close()
+ throws IOException
+ {
+ in.close();
+ out.close();
+ }
+
+ public final boolean markSupported()
+ {
+ return false;
+ }
+
+}
diff --git a/libjava/classpath/gnu/classpath/debug/TeeOutputStream.java b/libjava/classpath/gnu/classpath/debug/TeeOutputStream.java
new file mode 100644
index 00000000000..cff60894a6c
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/debug/TeeOutputStream.java
@@ -0,0 +1,93 @@
+/* TeeOutputStream.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module. An
+independent module is a module which is not derived from or based on
+this library. If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from your
+version. */
+
+package gnu.classpath.debug;
+
+import java.io.*;
+
+/**
+ * An output stream that copies all its output to an additional byte sink.
+ *
+ * @author Chris Burdess
+ */
+public class TeeOutputStream
+ extends OutputStream
+{
+
+ private final OutputStream out;
+ private final OutputStream sink;
+
+ /**
+ * Constructs a tee output stream.
+ * @param out the underlying output stream
+ * @param sink the output sink
+ */
+ public TeeOutputStream(OutputStream out, OutputStream sink)
+ {
+ this.out = out;
+ this.sink = sink;
+ }
+
+ public void write(int c)
+ throws IOException
+ {
+ out.write(c);
+ sink.write(c);
+ }
+
+ public void write(byte[] b, int off, int len)
+ throws IOException
+ {
+ out.write(b, off, len);
+ sink.write(b, off, len);
+ }
+
+ public void flush()
+ throws IOException
+ {
+ out.flush();
+ sink.flush();
+ }
+
+ public void close()
+ throws IOException
+ {
+ out.close();
+ sink.close();
+ }
+
+}
diff --git a/libjava/classpath/gnu/classpath/debug/TeeReader.java b/libjava/classpath/gnu/classpath/debug/TeeReader.java
new file mode 100644
index 00000000000..8fa742e21a1
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/debug/TeeReader.java
@@ -0,0 +1,98 @@
+/* TeeReader.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module. An
+independent module is a module which is not derived from or based on
+this library. If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from your
+version. */
+
+package gnu.classpath.debug;
+
+import java.io.*;
+
+/**
+ * A reader that copies all characters read to an output sink.
+ *
+ * @author Chris Burdess
+ */
+public class TeeReader
+ extends Reader
+{
+
+ private final Reader in;
+ private final Writer out;
+
+ /**
+ * Constructs a tee reader.
+ * @param in the input
+ * @param out the output sink
+ */
+ public TeeReader(Reader in, Writer out)
+ {
+ this.in = in;
+ this.out = out;
+ }
+
+ public int read()
+ throws IOException
+ {
+ int ret = in.read();
+ out.write(ret);
+ out.flush();
+ return ret;
+ }
+
+ public int read(char[] b, int off, int len)
+ throws IOException
+ {
+ int ret = in.read(b, off, len);
+ if (ret != -1)
+ {
+ out.write(b, off, ret);
+ out.flush();
+ }
+ return ret;
+ }
+
+ public void close()
+ throws IOException
+ {
+ in.close();
+ out.close();
+ }
+
+ public final boolean markSupported()
+ {
+ return false;
+ }
+
+}
diff --git a/libjava/classpath/gnu/classpath/debug/TeeWriter.java b/libjava/classpath/gnu/classpath/debug/TeeWriter.java
new file mode 100644
index 00000000000..f226c21658a
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/debug/TeeWriter.java
@@ -0,0 +1,93 @@
+/* TeeWriter.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module. An
+independent module is a module which is not derived from or based on
+this library. If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from your
+version. */
+
+package gnu.classpath.debug;
+
+import java.io.*;
+
+/**
+ * A writer that copies all its output to an additional character sink.
+ *
+ * @author Chris Burdess
+ */
+public class TeeWriter
+ extends Writer
+{
+
+ private final Writer out;
+ private final Writer sink;
+
+ /**
+ * Constructs a tee writer.
+ * @param out the underlying writer
+ * @param sink the output sink
+ */
+ public TeeWriter(Writer out, Writer sink)
+ {
+ this.out = out;
+ this.sink = sink;
+ }
+
+ public void write(int c)
+ throws IOException
+ {
+ out.write(c);
+ sink.write(c);
+ }
+
+ public void write(char[] b, int off, int len)
+ throws IOException
+ {
+ out.write(b, off, len);
+ sink.write(b, off, len);
+ }
+
+ public void flush()
+ throws IOException
+ {
+ out.flush();
+ sink.flush();
+ }
+
+ public void close()
+ throws IOException
+ {
+ out.close();
+ sink.close();
+ }
+
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/Jdwp.java b/libjava/classpath/gnu/classpath/jdwp/Jdwp.java
index 7141214ef26..e63a9a353dd 100644
--- a/libjava/classpath/gnu/classpath/jdwp/Jdwp.java
+++ b/libjava/classpath/gnu/classpath/jdwp/Jdwp.java
@@ -56,6 +56,9 @@ import java.util.HashMap;
/**
* Main interface from the virtual machine to the JDWP back-end.
*
+ * The thread created by this class is only used for initialization.
+ * Once it exits, the JDWP backend is fully initialized.
+ *
* @author Keith Seitz (keiths@redhat.com)
*/
public class Jdwp
@@ -65,7 +68,8 @@ public class Jdwp
private static Jdwp _instance = null;
/**
- * Are we debugging?
+ * Are we debugging? Only true if debugging
+ * *and* initialized.
*/
public static boolean isDebugging = false;
@@ -89,13 +93,16 @@ public class Jdwp
// A thread group for the JDWP threads
private ThreadGroup _group;
+ // Initialization synchronization
+ private Object _initLock = new Object ();
+ private int _initCount = 0;
+
/**
* constructor
*/
public Jdwp ()
{
_shutdown = false;
- isDebugging = true;
_instance = this;
}
@@ -271,17 +278,52 @@ public class Jdwp
}
}
+ /**
+ * Allows subcomponents to specify that they are
+ * initialized.
+ *
+ * Subcomponents include JdwpConnection and PacketProcessor.
+ */
+ public void subcomponentInitialized ()
+ {
+ synchronized (_initLock)
+ {
+ ++_initCount;
+ _initLock.notify ();
+ }
+ }
+
public void run ()
{
try
{
_doInitialization ();
+
+ /* We need a little internal synchronization here, so that
+ when this thread dies, the back-end will be fully initialized,
+ ready to start servicing the VM and debugger. */
+ synchronized (_initLock)
+ {
+ while (_initCount != 2)
+ _initLock.wait ();
+ }
+ _initLock = null;
}
catch (Throwable t)
{
System.out.println ("Exception in JDWP back-end: " + t);
System.exit (1);
}
+
+ /* Force creation of the EventManager. If the event manager
+ has not been created when isDebugging is set, it is possible
+ that the VM will call Jdwp.notify (which uses EventManager)
+ while the EventManager is being created (or at least this is
+ a problem with gcj/gij). */
+ EventManager.getDefault();
+
+ // Now we are finally ready and initialized
+ isDebugging = true;
}
// A helper function to process the configure string "-Xrunjdwp:..."
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java
index be429f4873a..abf280d6ec6 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java
@@ -62,18 +62,23 @@ public class BreakpointEvent
// Location where breakpoint occurred
private Location _location;
+
+ //object instance
+ private Object _instance;
/**
* Constructs a new BreakpointEvent
*
* @param thread thread in which event occurred
* @param loc location where breakpoint occurred
+ * @param instance object instance
*/
- public BreakpointEvent(Thread thread, Location loc)
+ public BreakpointEvent(Thread thread, Location loc, Object instance)
{
super(JdwpConstants.EventKind.BREAKPOINT);
_thread = thread;
_location = loc;
+ _instance = instance;
}
/**
@@ -83,12 +88,14 @@ public class BreakpointEvent
* @param type the type of parameter desired
* @returns the desired parameter or null
*/
- public Object getParameter(Class type)
+ public Object getParameter(int type)
{
- if (type == ThreadId.class)
+ if (type == EVENT_THREAD)
return _thread;
- else if (type == Location.class)
+ else if (type == EVENT_LOCATION)
return _location;
+ else if (type == EVENT_INSTANCE)
+ return _instance;
return null;
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java
index 22cede0c50a..5341daa42b5 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java
@@ -116,11 +116,11 @@ public class ClassPrepareEvent
* @param type the type of parameter desired
* @returns the desired parameter or <code>null</code>
*/
- public Object getParameter (Class type)
+ public Object getParameter (int type)
{
- if (type == ThreadId.class)
+ if (type == EVENT_THREAD)
return _thread;
- else if (type == ReferenceTypeId.class)
+ else if (type == EVENT_CLASS)
return _class;
return null;
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/ClassUnloadEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/ClassUnloadEvent.java
new file mode 100644
index 00000000000..4ba8bc80666
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/event/ClassUnloadEvent.java
@@ -0,0 +1,96 @@
+/* ClassUnloadEvent.java -- event generated when a class is unloaded
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.util.JdwpString;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * "Notification of a class unload in the target VM" -- JDWP 1.4.2
+ *
+ * @author Kyle Galloway (kgallowa@redhat.com)
+ */
+public class ClassUnloadEvent
+ extends Event
+{
+ //signature directly from VM
+ private String _signature;
+
+ /**
+ * Constructs a new <code>ClassUnloadEvent</code>
+ *
+ * @param signature the signature reported from the VM
+ */
+ public ClassUnloadEvent(String signature)
+ {
+ super(JdwpConstants.EventKind.CLASS_UNLOAD);
+ _signature = signature;
+ }
+
+ /**
+ * Returns a specific filtering parameter for this event. Class is the only
+ * valid type.
+ *
+ * @param type the type of parameter desired
+ * @returns the desired parameter or <code>null</code>
+ */
+ public Object getParameter(int type)
+ {
+
+ return null;
+ }
+
+ /**
+ * Writes the event to the given stream
+ *
+ * @param outStream the output stream to write the event to
+ */
+ protected void _writeData(DataOutputStream outStream)
+ throws IOException
+ {
+ VMIdManager idm = VMIdManager.getDefault();
+
+ JdwpString.writeString(outStream, _signature);
+ }
+
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/Event.java b/libjava/classpath/gnu/classpath/jdwp/event/Event.java
index 14e5b78fc14..e91108a61a8 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/Event.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/Event.java
@@ -54,6 +54,41 @@ import java.io.IOException;
*/
public abstract class Event
{
+ /**
+ * The class of the object in which the event occurred
+ */
+ public static final int EVENT_CLASS = 1;
+
+ /**
+ * The thread where the event occurred
+ */
+ public static final int EVENT_THREAD = 2;
+
+ /**
+ * The location where an event occurred
+ */
+ public static final int EVENT_LOCATION = 3;
+
+ /**
+ * The instance of the class where the event occurred
+ */
+ public static final int EVENT_INSTANCE = 4;
+
+ /**
+ * The field acted on by an event
+ */
+ public static final int EVENT_FIELD = 5;
+
+ /**
+ * The class of the exception for ExceptionEvent
+ */
+ public static final int EVENT_EXCEPTION_CLASS = 6;
+
+ /**
+ * Whether this exception was caught (only valid for ExceptionEvents)
+ */
+ public static final int EVENT_EXCEPTION_CAUGHT = 7;
+
// The kind of event represented by this event
private byte _eventKind;
@@ -97,7 +132,7 @@ public abstract class Event
* @returns the parameter (not the ID) or <code>null</code> if none is
* is defined for this event
*/
- public abstract Object getParameter (Class type);
+ public abstract Object getParameter (int type);
/**
* Converts this event into to a JDWP packet
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/EventManager.java b/libjava/classpath/gnu/classpath/jdwp/event/EventManager.java
index eb0c3ddb7d2..54a7b08312d 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/EventManager.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/EventManager.java
@@ -1,5 +1,5 @@
/* EventManager.java -- event management and notification infrastructure
- Copyright (C) 2005 Free Software Foundation
+ Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -69,7 +69,7 @@ import java.util.Iterator;
public class EventManager
{
// Single instance
- private static EventManager _instance = new EventManager ();
+ private static EventManager _instance = null;
// maps event (EVENT_*) to lists of EventRequests
private Hashtable _requests = null;
@@ -79,8 +79,11 @@ public class EventManager
*
* @return the event manager
*/
- public static EventManager getDefault ()
+ public static EventManager getDefault()
{
+ if (_instance == null)
+ _instance = new EventManager();
+
return _instance;
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java
new file mode 100644
index 00000000000..1303c09be76
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java
@@ -0,0 +1,157 @@
+/* ExceptionEvent.java -- an event specifying an exception has been thrown
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.id.ObjectId;
+import gnu.classpath.jdwp.id.ThreadId;
+import gnu.classpath.jdwp.util.Location;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * Notification from the VM that an exception has occurred along with where it
+ * occurred, and if and where it was caught.
+ *
+ * @author Kyle Galloway (kgallowa@redhat.com)
+ */
+public class ExceptionEvent
+ extends Event
+{
+ //object instance
+ private Object _instance;
+
+ // the exception thrown
+ private Throwable _exception;
+
+ // the thread in which the exception occurred
+ private Thread _thread;
+
+ // the location where the exception was thrown
+ private Location _location;
+
+ //the location where the exception was caught
+ private Location _catchLocation;
+
+ //the class where the exeption was thrown
+ private Class _klass;
+
+ /**
+ * Constructs a new <code>ExceptionEvent</code> where the exception was
+ * caught.
+ *
+ * @param exception the throwable object that generated the event
+ * @param thread the thread where the exception occurred
+ * @param location the location where the exception was thrown
+ * @param catchLocation the location where the exception was caught
+ * @param instance the instance that threw the exception
+ */
+ public ExceptionEvent(Throwable exception, Thread thread, Location location,
+ Location catchLocation, Class clazz, Object instance)
+ {
+ super(JdwpConstants.EventKind.EXCEPTION);
+ _exception = exception;
+ _thread = thread;
+ _location = location;
+ _catchLocation = catchLocation;
+ _klass = clazz;
+ _instance = instance;
+ }
+
+ /**
+ * Returns a specific filtering parameter for this event. Valid types are
+ * thread, location, and catchLocation.
+ *
+ * @param type the type of parameter desired
+ * @returns the desired parameter or null
+ */
+ public Object getParameter(int type)
+ {
+ if (type == EVENT_THREAD)
+ return _thread;
+ else if (type == EVENT_LOCATION)
+ return _location;
+ else if (type == EVENT_INSTANCE)
+ return _instance;
+ else if (type == EVENT_CLASS)
+ return _klass;
+ else if (type == EVENT_EXCEPTION_CLASS)
+ return _exception.getClass();
+ else if (type == EVENT_EXCEPTION_CAUGHT)
+ if (_catchLocation.getMethod() != null)
+ return new Boolean(true);
+ else
+ return new Boolean(false);
+
+ return null;
+ }
+
+ /**
+ * Sets the catchLocation, used for exceptions that are caught in different
+ * stack frames from where they are thrown.
+ *
+ * @param catchLoc the location of the catch
+ */
+ public void setCatchLoc(Location catchLoc)
+ {
+ _catchLocation = catchLoc;
+ }
+
+ /**
+ * Writes the event to the given stream
+ *
+ * @param outStream the output stream to write the event to
+ * @throws IOException
+ */
+ protected void _writeData(DataOutputStream outStream)
+ throws IOException
+ {
+ VMIdManager idm = VMIdManager.getDefault();
+ ThreadId tid = (ThreadId) idm.getObjectId(_thread);
+ ObjectId oid = idm.getObjectId(_exception);
+
+ tid.write(outStream);
+ _location.write(outStream);
+ oid.writeTagged(outStream);
+ _catchLocation.write(outStream);
+
+ }
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/MethodEntryEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/MethodEntryEvent.java
new file mode 100644
index 00000000000..40c0516c716
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/event/MethodEntryEvent.java
@@ -0,0 +1,118 @@
+/* MethodEntryEvent.java -- an event specifying that a method has been invoked
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.id.ThreadId;
+import gnu.classpath.jdwp.util.Location;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * Notification from the VM that that a method has been invoked
+ *
+ * @author Kyle Galloway (kgallowa@redhat.com)
+ */
+public class MethodEntryEvent
+ extends Event
+{
+ // The thread where the event occurred
+ private Thread _thread;
+
+ // the location where the event occurred
+ private Location _location;
+
+ //object instance
+ private Object _instance;
+
+ /**
+ * Constructs a new <code>MethodEntryEvent</code>
+ *
+ * @param thread the thread where the exception occurred
+ * @param location the location single stepped to
+ * @param instance instance from which the method was called
+ */
+ public MethodEntryEvent(Thread thread, Location location, Object instance)
+ {
+ super(JdwpConstants.EventKind.METHOD_ENTRY);
+ _thread = thread;
+ _location = location;
+ _instance = instance;
+ }
+
+ /**
+ * Returns a specific filtering parameter for this event. Valid types are
+ * thread and location
+ *
+ * @param type the type of parameter desired
+ * @returns the desired parameter or null
+ */
+ public Object getParameter(int type)
+ {
+ if (type == EVENT_THREAD)
+ return _thread;
+ else if (type == EVENT_LOCATION)
+ return _location;
+ else if (type == EVENT_INSTANCE)
+ return _instance;
+ else if (type == EVENT_CLASS)
+ return _instance.getClass();
+
+ return null;
+ }
+
+ /**
+ * Writes the event to the given stream
+ *
+ * @param outStream the output stream to write the event to
+ * @throws IOException
+ */
+ protected void _writeData(DataOutputStream outStream)
+ throws IOException
+ {
+ VMIdManager idm = VMIdManager.getDefault();
+ ThreadId tid = (ThreadId) idm.getObjectId(_thread);
+
+ tid.write(outStream);
+ _location.write(outStream);
+ }
+
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/MethodExitEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/MethodExitEvent.java
new file mode 100644
index 00000000000..ce03dd264e2
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/event/MethodExitEvent.java
@@ -0,0 +1,115 @@
+/* MethodExitEvent.java -- an event specifying that a method has returned
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.id.ThreadId;
+import gnu.classpath.jdwp.util.Location;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * Notification from the VM that that a method has returned
+ *
+ * @author Kyle Galloway (kgallowa@redhat.com)
+ */
+public class MethodExitEvent
+ extends Event
+{
+ // The thread where the event occurred
+ private Thread _thread;
+
+ // the location where the event occurred
+ private Location _location;
+
+ // object instance
+ private Object _instance;
+
+ /**
+ * Constructs a new <code>MethodExitEvent</code>
+ *
+ * @param thread the thread where the exception occurred
+ * @param location the location single stepped to
+ * @param instance the instance from which the method was called
+ */
+ public MethodExitEvent(Thread thread, Location location, Object instance)
+ {
+ super(JdwpConstants.EventKind.METHOD_EXIT);
+ _thread = thread;
+ _location = location;
+ _instance = instance;
+ }
+
+ /**
+ * Returns a specific filtering parameter for this event. Valid types are
+ * thread and location
+ *
+ * @param type the type of parameter desired
+ * @returns the desired parameter or null
+ */
+ public Object getParameter(int type)
+ {
+ if (type == EVENT_THREAD)
+ return _thread;
+ else if (type == EVENT_LOCATION)
+ return _location;
+ else if (type == EVENT_CLASS)
+ return _instance.getClass();
+
+ return null;
+ }
+
+ /**
+ * Writes the event to the given stream
+ *
+ * @param outStream the output stream to write the event to
+ * @throws IOException
+ */
+ protected void _writeData(DataOutputStream outStream)
+ throws IOException
+ {
+ VMIdManager idm = VMIdManager.getDefault();
+ ThreadId tid = (ThreadId) idm.getObjectId(_thread);
+
+ tid.write(outStream);
+ _location.write(outStream);
+ }
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/SingleStepEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/SingleStepEvent.java
new file mode 100644
index 00000000000..cd69dd99d6b
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/event/SingleStepEvent.java
@@ -0,0 +1,121 @@
+/* SingleStepEvent.java -- an event specifying that a single step has
+ compleated
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.id.ThreadId;
+import gnu.classpath.jdwp.util.Location;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+
+/**
+ * Notification from the VM that a single step has compleated including the
+ * thread and location stepped to
+ *
+ * @author Kyle Galloway (kgallowa@redhat.com)
+ */
+public class SingleStepEvent
+ extends Event
+{
+ // the thread where the event occurred
+ private Thread _thread;
+
+ // the location where the event occurred
+ private Location _location;
+
+ //object instance
+ private Object _instance;
+
+ /**
+ * Constructs a new <code>SingleStepEvent</code>
+ *
+ * @param thread the thread where the exception occurred
+ * @param location the location single stepped to
+ * @param instance the instance in which the single step occurred
+ */
+ public SingleStepEvent(Thread thread, Location location, Object instance)
+ {
+ super(JdwpConstants.EventKind.SINGLE_STEP);
+ _thread = thread;
+ _location = location;
+ _instance = instance;
+ }
+
+ /**
+ * Returns a specific filtering parameter for this event. Valid types are
+ * thread and location
+ *
+ * @param type the type of parameter desired
+ * @returns the desired parameter or null
+ */
+ public Object getParameter(int type)
+ {
+ if (type == EVENT_THREAD)
+ return _thread;
+ else if (type == EVENT_LOCATION)
+ return _location;
+ else if (type == EVENT_INSTANCE)
+ return _instance;
+ else if (type == EVENT_CLASS)
+ return _instance.getClass();
+
+ return null;
+ }
+
+ /**
+ * Writes the event to the given stream
+ *
+ * @param outStream the output stream to write the event to
+ * @throws IOException
+ */
+ protected void _writeData(DataOutputStream outStream)
+ throws IOException
+ {
+ VMIdManager idm = VMIdManager.getDefault();
+ ThreadId tid = (ThreadId) idm.getObjectId(_thread);
+
+ tid.write(outStream);
+ _location.write(outStream);
+ }
+
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java
index 768b216de0c..c665428fb6a 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java
@@ -81,9 +81,9 @@ public class ThreadEndEvent
* @param type the type of parameter desired
* @returns the desired parameter or <code>null</code>
*/
- public Object getParameter (Class type)
+ public Object getParameter (int type)
{
- if (type == ThreadId.class)
+ if (type == EVENT_THREAD)
return _thread;
return null;
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java
index 2fa20791716..f9c507dfb16 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java
@@ -86,9 +86,9 @@ public class ThreadStartEvent
* @param type the type of parameter desired
* @returns the desired parameter or <code>null</code>
*/
- public Object getParameter (Class type)
+ public Object getParameter (int type)
{
- if (type == ThreadId.class)
+ if (type == EVENT_THREAD)
return _thread;
return null;
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java
index 160ef6acea1..a729bd47ec0 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java
@@ -67,7 +67,7 @@ public class VmDeathEvent
* @param type the type of parameter desired
* @returns the desired parameter or <code>null</code>
*/
- public Object getParameter (Class type)
+ public Object getParameter (int type)
{
return null;
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/VmInitEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/VmInitEvent.java
index dd228e935cf..1ed63b24799 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/VmInitEvent.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/VmInitEvent.java
@@ -76,7 +76,7 @@ public class VmInitEvent
* @param type the type of parameter desired
* @returns the desired parameter or <code>null</code>
*/
- public Object getParameter (Class type)
+ public Object getParameter (int type)
{
return null;
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java
index 62a3a74fe54..a8984316957 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java
@@ -41,7 +41,6 @@ package gnu.classpath.jdwp.event.filters;
import gnu.classpath.jdwp.event.Event;
import gnu.classpath.jdwp.exception.InvalidStringException;
-import gnu.classpath.jdwp.id.ReferenceTypeId;
/**
* An event filter which includes events matching a
@@ -91,7 +90,7 @@ public class ClassMatchFilter
*/
public boolean matches (Event event)
{
- Object type = event.getParameter (ReferenceTypeId.class);
+ Object type = event.getParameter (Event.EVENT_CLASS);
if (type != null)
{
Class eventClass = (Class) type;
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java
index e4bf06cf961..455cac6c04c 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java
@@ -87,7 +87,7 @@ public class ClassOnlyFilter
*/
public boolean matches (Event event)
{
- Object type = event.getParameter (ReferenceTypeId.class);
+ Object type = event.getParameter (Event.EVENT_CLASS);
if (type != null)
{
try
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
index cf6c0704daf..8bb56ed78f7 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
@@ -1,5 +1,5 @@
-/* ExceptionOnlyFilter.java --
- Copyright (C) 2005 Free Software Foundation
+/* ExceptionOnlyFilter.java -- filter for excetions by caught/uncaught and type
+ Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ public class ExceptionOnlyFilter
/**
* Constructs a new ExceptionOnlyFilter
*
- * @param refId ID of the exception to report
+ * @param refId ID of the exception to report(null for all exceptions)
* @param caught Report caught exceptions
* @param uncaught Report uncaught exceptions
* @throws InvalidClassException if refid is invalid
@@ -70,8 +70,8 @@ public class ExceptionOnlyFilter
boolean uncaught)
throws InvalidClassException
{
- if (refId == null || refId.getReference().get () == null)
- throw new InvalidClassException (refId.getId ());
+ if (refId != null && refId.getReference().get() == null)
+ throw new InvalidClassException(refId.getId());
_refId = refId;
_caught = caught;
@@ -88,34 +88,36 @@ public class ExceptionOnlyFilter
return _refId;
}
- /**
- * Report caught exceptions?
- *
- * @return whether to report caught exceptions
- */
- public boolean forCaught ()
- {
- return _caught;
- }
-
- /**
- * Report uncaught exceptions?
- *
- * @return whether to report uncaught exceptions
- */
- public boolean forUncaught ()
- {
- return _uncaught;
- }
-
+
/**
* Does the given event match the filter?
- *
- * @param event the <code>Event</code> to scrutinize
+ *
+ * @param event the <code>Event</code> to scrutinize
*/
- public boolean matches (Event event)
+ public boolean matches(Event event)
{
- // FIXME
- throw new RuntimeException ("ExceptionOnlyFilter.matches not implemented");
+ boolean classMatch = true;
+
+ // if not allowing all exceptions check if the exception matches
+ if (_refId != null)
+ {
+ try
+ {
+ Class klass
+ = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS);
+ classMatch = klass == _refId.getType();
+ }
+ catch (InvalidClassException ex)
+ {
+ classMatch = false;
+ }
+ }
+
+ // check against the caught and uncaught options
+ Boolean caught
+ = (Boolean) event.getParameter(Event.EVENT_EXCEPTION_CAUGHT);
+
+ return classMatch && ((caught.booleanValue()) ? _caught : _uncaught);
}
+
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java
index 130749b4b8a..bda5b27d6c1 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java
@@ -89,7 +89,7 @@ public class InstanceOnlyFilter
*/
public boolean matches (Event event)
{
- Object eventInstance = event.getParameter (ObjectId.class);
+ Object eventInstance = event.getParameter (Event.EVENT_INSTANCE);
if (eventInstance != null)
{
Object myInstance = _instance.getReference().get ();
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
index 2c7a0f1359e..bc1eab883d3 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
@@ -65,7 +65,7 @@ public class ThreadOnlyFilter
public ThreadOnlyFilter (ThreadId tid)
throws InvalidThreadException
{
- if (tid.getReference().get () == null)
+ if (tid == null || tid.getReference().get () == null)
throw new InvalidThreadException (tid.getId ());
_tid = tid;
@@ -88,7 +88,7 @@ public class ThreadOnlyFilter
*/
public boolean matches (Event event)
{
- Object thread = event.getParameter (ThreadId.class);
+ Object thread = event.getParameter (Event.EVENT_THREAD);
if (thread != null)
{
Thread eventThread = (Thread) thread;
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
index f60da7b7021..a3a7ca05e59 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
@@ -106,8 +106,12 @@ public class ClassTypeCommandSet
Class clazz = refId.getType();
Class superClazz = clazz.getSuperclass();
- ReferenceTypeId clazzId = idMan.getReferenceTypeId(superClazz);
- clazzId.write(os);
+ if (superClazz == null) {
+ os.writeLong(0L);
+ } else {
+ ReferenceTypeId clazzId = idMan.getReferenceTypeId(superClazz);
+ clazzId.write(os);
+ }
}
private void executeSetValues(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
index e4b1b602ef5..59cfb94d39b 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
@@ -147,7 +147,7 @@ public class EventRequestCommandSet
if (id == 0)
refId = null;
else
- refId = idMan.readReferenceTypeId(bb);
+ refId = idMan.getReferenceType(id);
boolean caught = (bb.get() == 0) ? false : true;
boolean unCaught = (bb.get() == 0) ? false : true;
filter = new ExceptionOnlyFilter(refId, caught, unCaught);
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java b/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java
index 9e281f217f2..4df3f472875 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java
@@ -1,6 +1,6 @@
/* PacketProcessor.java -- a thread which processes command packets
from the debugger
- Copyright (C) 2005 Free Software Foundation
+ Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -137,6 +137,10 @@ public class PacketProcessor
*/
public Object run ()
{
+ // Notify initialization thread (gnu.classpath.jdwp.Jdwp) that
+ // the PacketProcessor thread is ready.
+ Jdwp.getDefault().subcomponentInitialized ();
+
try
{
while (!_shutdown)
@@ -144,7 +148,7 @@ public class PacketProcessor
_processOnePacket ();
}
}
- catch (IOException ex)
+ catch (Exception ex)
{
ex.printStackTrace();
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
index ba36251f665..103199a2b6e 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
@@ -103,8 +103,12 @@ public class ThreadGroupReferenceCommandSet
ObjectId oid = idMan.readObjectId(bb);
ThreadGroup group = (ThreadGroup) oid.getObject();
ThreadGroup parent = group.getParent();
- ObjectId parentId = idMan.getObjectId(parent);
- parentId.write(os);
+ if (parent == null) {
+ os.writeLong(0L);
+ } else {
+ ObjectId parentId = idMan.getObjectId(parent);
+ parentId.write(os);
+ }
}
private void executeChildren(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java b/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java
index f008bbd00ca..82a2380bb7b 100644
--- a/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java
+++ b/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java
@@ -1,5 +1,5 @@
/* JdwpConnection.java -- A JDWP-speaking connection
- Copyright (C) 2005 Free Software Foundation
+ Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
@@ -165,6 +165,10 @@ public class JdwpConnection
*/
public void run ()
{
+ // Notify initialization thread (gnu.classpath.jdwp.Jdwp) that
+ // the JdwpConnection thread is ready.
+ Jdwp.getDefault().subcomponentInitialized ();
+
while (!_shutdown)
{
try
diff --git a/libjava/classpath/gnu/classpath/jdwp/util/Location.java b/libjava/classpath/gnu/classpath/jdwp/util/Location.java
index 005b12c2bb2..89e81e563a1 100644
--- a/libjava/classpath/gnu/classpath/jdwp/util/Location.java
+++ b/libjava/classpath/gnu/classpath/jdwp/util/Location.java
@@ -94,18 +94,40 @@ public class Location
* @param os stream to write to
* @throws IOException when an error occurs writing to the stream
*/
- public void write(DataOutputStream os)
+ public void write(DataOutputStream os)
throws IOException
{
- VMIdManager idm = VMIdManager.getDefault();
- ClassReferenceTypeId crti = (ClassReferenceTypeId)
- idm.getReferenceTypeId(method.getDeclaringClass());
-
- crti.writeTagged(os);
- method.writeId(os);
- os.writeLong(index);
+ // check if this is an empty location
+ if (method != null)
+ {
+ VMIdManager idm = VMIdManager.getDefault();
+ ClassReferenceTypeId crti =
+ (ClassReferenceTypeId)
+ idm.getReferenceTypeId(method.getDeclaringClass());
+
+ crti.writeTagged(os);
+ method.writeId(os);
+ os.writeLong(index);
+ }
+ else
+ {
+ os.writeByte(1);
+ os.writeLong((long) 0);
+ os.writeLong((long) 0);
+ os.writeLong((long) 0);
+ }
}
-
+
+ /**
+ * Sets up an empty location
+ *
+ * @return new Location (setup as empty)
+ */
+ public static Location getEmptyLocation()
+ {
+ return new Location(null, 0);
+ }
+
/**
* Gets the method of this location
*
OpenPOWER on IntegriCloud