Re: Questions about jvmti.h header

2009-11-12 Thread Keith Seitz

On 11/03/2009 04:27 AM, Michael Starzinger wrote:


* Are there any plans to install the jvmti.h file (just like it is done
with jni.h) or are there circumstances preventing such an installation?


That is probably just an oversight.


* Why does the mentioned header include jvmti_md.h? All
machine-dependent definitions should have already been covered by
jni_md.h. Should the missing jvmti_md.h file be provided by the VM?


A VM may need to specialize some behavior in jvmti.h. Gcj did this, and 
it provides the missing jvmti_md.h. If jni_md.h supplies everything 
necessary, a blank/nop jvmti_md.h will suffice.



I also stumbled upon a mailing list post[1] dealing with this topic. But
it seems to me that only a small part[2] actually made it into the GNU
Classpath source, the rest remained in the GCJ source.


I think this is self-explanatory now: jvmti_md.h is VM-dependent and 
should be supplied by the VM vendor. That's why that file never made it 
into classpath. It wouldn't help any other VM.


Keith



[cp-patches] [PATCH/JDWP] StringValue buglets

2007-06-19 Thread Keith Seitz

Hi,

I've committed that attached patch which fixes two little buglets in 
gnu.classpath.jdwp.value.StringValue: 1) we were recording the tag byte 
as OBJECT instead of STRING and 2) String values are written on the wire 
as a one byte signature tag followed by an object ID.


If there are any problems with this, please let me know.

Keith

ChangeLog
2007-07-19  Keith Seitz  [EMAIL PROTECTED]

* classpath/gnu/classpath/jdwp/value/StringValue.java
(StringValue): Tag of StringValue is STRING not OBJECT.
(write): String values are written to the wire as tag byte
and object ID, not JdwpString.
Index: gnu/classpath/jdwp/value/StringValue.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/value/StringValue.java,v
retrieving revision 1.1
diff -u -p -r1.1 StringValue.java
--- gnu/classpath/jdwp/value/StringValue.java	9 Mar 2007 21:23:10 -	1.1
+++ gnu/classpath/jdwp/value/StringValue.java	19 Jun 2007 22:10:24 -
@@ -38,7 +38,8 @@ exception statement from your version. *
 package gnu.classpath.jdwp.value;
 
 import gnu.classpath.jdwp.JdwpConstants;
-import gnu.classpath.jdwp.util.JdwpString;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.id.ObjectId;
 
 import java.io.DataOutputStream;
 import java.io.IOException;
@@ -61,7 +62,7 @@ public final class StringValue
*/
   public StringValue(String value)
   {
-super(JdwpConstants.Tag.OBJECT);
+super(JdwpConstants.Tag.STRING);
 _value = value;
   }
   
@@ -95,6 +96,8 @@ public final class StringValue
   protected void write(DataOutputStream os)
 throws IOException
   {
-JdwpString.writeString(os, _value);
+ObjectId oid = VMIdManager.getDefault().getObjectId (_value);
+oid.write (os);
+
   }
 }


[commit-cp] classpath ChangeLog gnu/classpath/jdwp/processo...

2007-06-19 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/06/19 21:57:16

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/processor: ClassTypeCommandSet.java 
  ObjectReferenceCommandSet.java 
gnu/classpath/jdwp/util: MethodResult.java 
gnu/classpath/jdwp/value: ObjectValue.java 
vm/reference/gnu/classpath/jdwp: VMVirtualMachine.java 

Log message:
* gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
(executeInvokeMethod): No need to use ValueFactory any more;
MethodResult.getReturnedValue now returns a Value.
(executeNewInstance): Double-check that return result is
an ObjectValue; throw JdwpInternalErrorException if it is not.
(invokeMethod): Method IDs come from VMMethod, not VMIdManager.
Arguments are Values not Objects.
Use ValueFactory to create arguments.
Pass invocation options to VMVirtualMachine.executeMethod.
Don't do any thread suspend/resume work: VMVM.executeMethod
will take care of it.
* gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
(executeInvokeMethod): Method IDs come from VMMethod, not
VMIdManager.
Arguments should be Values instead of Objects.
Use ValueFactory to create Values.
Remove specific option handling and pass options to
VMVirtualMachine.executeMethod.
Remove thread suspension.
Use MethodResult.getReturnedValue to get method's result.
* gnu/classpath/jdwp/util/MethodResult.java
(returnedValue): Change type to Value.
(thrownException): Change type to Throwable.
(resType): Remove.
(MethodResult): New constructor.
(setReturnedValue): Remove.
(SetThrownException): Remove.
(getResultType): Remove.
(setResultType): Remove.
* gnu/classpath/jdwp/value/ObjectValue.java (getValue):
New method.
* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
(executeMethod): Replace nonVirtual parameter with more
generic options parameter.
Replace java.lang.reflect.Method parameter with VMMethod.
Replace Objet[] parameter with Value[] parameter.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9324r2=1.9325
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java?cvsroot=classpathr1=1.7r2=1.8
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java?cvsroot=classpathr1=1.8r2=1.9
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/util/MethodResult.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/value/ObjectValue.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java?cvsroot=classpathr1=1.10r2=1.11




[commit-cp] classpath ChangeLog gnu/classpath/jdwp/value/St...

2007-06-19 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/06/19 22:11:10

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/value: StringValue.java 

Log message:
* classpath/gnu/classpath/jdwp/value/StringValue.java
(StringValue): Tag of StringValue is STRING not OBJECT.
(write): String values are written to the wire as tag byte
and object ID, not JdwpString.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9325r2=1.9326
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/value/StringValue.java?cvsroot=classpathr1=1.1r2=1.2




Re: [cp-patches] [RFA/JDWP] Fix ReferenceType.Methods to work with interfaces

2007-05-11 Thread Keith Seitz

Kyle Galloway wrote:

2007-05-11  Kyle Galloway  [EMAIL PROTECTED]

* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet
(executeMethods): Remove cast to ClassReferenceTypeId.

Questions/Issues?


Good catch. Please commit.

Keith



Re: [cp-patches] [RFA/JDWP] Fix VMFrame this pointer

2007-05-08 Thread Keith Seitz

Kyle Galloway wrote:


ChangeLog
2007-05-08  Kyle Galloway  [EMAIL PROTECTED]

* vm/reference/VMFrame.java (init): Add a parameter for the this
pointer of the frame.

Questions/Issues?


Not with your patch! Please commit.

Thank you for digging through this.

Keith




[cp-patches] [PATCH] Implement send multiple JDWP events

2007-05-03 Thread Keith Seitz

Hi,

I have committed the attached patch, which although a little kludgy, 
adds the ability for the VM to send multiple events in a single packet 
(what events to send and whether they are legal to send together is the 
responsibility of the VM).


We should not need a queue to deal with this: the VM *should* know when 
it is appropriate to use this. Right now, as far as I can tell, that 
means with MethodEntry/Exit, SingleStep, and Breakpoint. One is supposed 
to be able to send multiple ThreadStart/End, ClassPrepare, and other 
events together (as long as they're all the same thread and class), but 
Sun's HotSpot VM does not do it this way. It sends a packet for each event.


Largely it is a refactoring of the old code.

Keith

ChangeLog
2007-05-03  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/Jdwp.java (notify): Rewrite to call
new array-based method.
(notify): New function.
(sendEvent): Rewrite to use sendEvents.
(sendEvents): New method.
* gnu/classpath/jdwp/event/Event.java (toPacket): Make static.
Change parameters to use arrays for events and requests.
Add suspendPolicy parameter.
Move per-event data transformation to...
(_toData): ... here.
* gnu/classpath/jdwp/transport/JdwpConnection.java
(sendEvent): Renamed to ...
(sendEvents): ... this.
Change parameters to use arrays for events and requests.
Add suspendPolicy parameter.
Index: gnu/classpath/jdwp/Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.9
diff -u -p -r1.9 Jdwp.java
--- gnu/classpath/jdwp/Jdwp.java	27 Apr 2007 21:30:59 -	1.9
+++ gnu/classpath/jdwp/Jdwp.java	3 May 2007 22:46:21 -
@@ -51,6 +51,7 @@ import gnu.classpath.jdwp.transport.Tran
 
 import java.io.IOException;
 import java.security.AccessController;
+import java.util.ArrayList;
 import java.util.HashMap;
 
 /**
@@ -207,7 +208,6 @@ public class Jdwp
* The event is filtered through the event manager before being
* sent.
*
-   * FIXME: Probably need logic to send multiple (different) events
* @param event the event to report
*/
   public static void notify(Event event)
@@ -235,6 +235,62 @@ public class Jdwp
   }
   
   /**
+   * Notify the debugger of co-located events. This method should
+   * not be called if debugging is not active (but it would not
+   * cause any harm). Places where event notifications occur
+   * should check isDebugging before doing anything.
+   *
+   * The events are filtered through the event manager before being
+   * sent.
+   *
+   * @param events the events to report
+   */
+  public static void notify(Event[] events)
+  {
+Jdwp jdwp = getDefault();
+
+if (jdwp != null)
+  {
+	byte suspendPolicy = JdwpConstants.SuspendPolicy.NONE;
+	EventManager em = EventManager.getDefault();
+	ArrayList allEvents = new ArrayList ();
+	ArrayList allRequests = new ArrayList ();
+	for (int i = 0; i  events.length; ++i)
+	  {
+	EventRequest[] r = em.getEventRequests(events[i]);
+	for (int j = 0; j  r.length; ++j)
+	  {
+		/* This is hacky, but it's not clear whether this
+		   can really happen, and if it does, what should
+		   occur. */
+		allEvents.add (events[i]);
+		allRequests.add (r[j]);
+
+		// Perhaps this is overkill?
+		if (r[j].getSuspendPolicy()  suspendPolicy)
+		  suspendPolicy = r[j].getSuspendPolicy();
+	  }
+	  }
+
+	try
+	  {
+	Event[] e = new Event[allEvents.size()];
+	allEvents.toArray(e);
+	EventRequest[] r = new EventRequest[allRequests.size()];
+	allRequests.toArray(r);
+	sendEvents(r, e, suspendPolicy);
+	jdwp._enforceSuspendPolicy(suspendPolicy);
+	  }
+	catch (Exception e)
+	  {
+	/* Really not much we can do. For now, just print out
+	   a warning to the user. */
+	System.out.println (Jdwp.notify: caught exception:  + e);
+	  }
+  }
+  }
+
+  /**
* Sends the event to the debugger.
*
* This method bypasses the event manager's filtering.
@@ -246,13 +302,30 @@ public class Jdwp
   public static void sendEvent (EventRequest request, Event event)
   throws IOException
   {
-Jdwp jdwp = getDefault ();
+sendEvents (new EventRequest[] { request }, new Event[] { event },
+		request.getSuspendPolicy());
+  }
+
+  /**
+   * Sends the events to the debugger.
+   *
+   * This method bypasses the event manager's filtering.
+   *
+   * @param  requests  list of debugger requests for the events
+   * @param  eventsthe events to send
+   * @param  suspendPolicy the suspendPolicy enforced by the VM
+   * @throws IOException if a communications failure occurs
+   */
+  public static void sendEvents (EventRequest[] requests, Event[] events,
+ byte suspendPolicy)
+throws IOException
+  {
+Jdwp jdwp = getDefault();
 if (jdwp != null)
   {
-	// !! May need to implement send

[commit-cp] classpath ChangeLog gnu/classpath/jdwp/Jdwp.jav...

2007-05-03 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/05/03 23:59:31

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp: Jdwp.java 
gnu/classpath/jdwp/event: Event.java 
gnu/classpath/jdwp/transport: JdwpConnection.java 

Log message:
* gnu/classpath/jdwp/Jdwp.java (notify): Rewrite to call
new array-based method.
(notify): New function.
(sendEvent): Rewrite to use sendEvents.
(sendEvents): New method.
* gnu/classpath/jdwp/event/Event.java (toPacket): Make static.
Change parameters to use arrays for events and requests.
Add suspendPolicy parameter.
Move per-event data transformation to...
(_toData): ... here.
* gnu/classpath/jdwp/transport/JdwpConnection.java
(sendEvent): Renamed to ...
(sendEvents): ... this.
Change parameters to use arrays for events and requests.
Add suspendPolicy parameter.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9293r2=1.9294
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/Jdwp.java?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/Event.java?cvsroot=classpathr1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java?cvsroot=classpathr1=1.6r2=1.7




[cp-patches] [PATCH/JDWP] Implement LocationOnlyFilter.matches

2007-04-27 Thread Keith Seitz

Hi,

Despite my original assessment of how all this would unfold, 
LocationOnlyFilter.matches *does* need to be properly implemented. This 
patch does just that.


Keith

ChangeLog
2007-04-27  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java
(matches): Use Location.equals to determine equality.
* vm/reference/gnu/classpath/jdwp/VMMethod.java (equals):
New method.
* gnu/classpath/jdwp/util/Location.java (equals):
New method.
Index: gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java,v
retrieving revision 1.2
diff -u -p -r1.2 LocationOnlyFilter.java
--- gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java	15 Mar 2006 23:45:55 -	1.2
+++ gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java	27 Apr 2007 20:47:21 -
@@ -1,5 +1,5 @@
 /* LocationOnlyFilter.java -- filter on location
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -49,13 +49,6 @@ import gnu.classpath.jdwp.util.Location;
  * May be used with breakpoint, field access, field modification, step,
  * and exception event kinds.
  *
- * This filter is not really a filter. It is simply a way to communicate
- * location information for supported events in a generic way to ease 
- * the burden of special casing several things in
- * EventReqeustCommandSet.executeSet.
- * 
- * Consequently, this filter always matches any event.
- * 
  * @author Keith Seitz  ([EMAIL PROTECTED])
  */
 public class LocationOnlyFilter
@@ -90,9 +83,12 @@ public class LocationOnlyFilter
*
* @param event  the codeEvent/code to scrutinize
*/
-  public boolean matches (Event event)
+  public boolean matches(Event event)
   {
-// This filter always matches. See comments in class javadoc.
-return true;
+Location loc = (Location) event.getParameter(Event.EVENT_LOCATION);
+if (loc != null)
+  return (getLocation().equals(loc));
+
+return false;
   }
 }
Index: gnu/classpath/jdwp/util/Location.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/util/Location.java,v
retrieving revision 1.4
diff -u -p -r1.4 Location.java
--- gnu/classpath/jdwp/util/Location.java	27 Jul 2006 14:45:37 -	1.4
+++ gnu/classpath/jdwp/util/Location.java	27 Apr 2007 20:47:21 -
@@ -1,5 +1,5 @@
 /* Location.java -- class to read/write JDWP locations
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -153,4 +153,16 @@ public class Location
   {
 return method.toString () + . + index;
   }
+
+  public boolean equals(Object obj)
+  {
+if (obj instanceof Location)
+  {
+	Location l = (Location) obj;
+	return (getMethod().equals(l.getMethod())
+		 getIndex() == l.getIndex());
+  }
+
+return false;
+  }
 }
Index: vm/reference/gnu/classpath/jdwp/VMMethod.java
===
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMMethod.java,v
retrieving revision 1.3
diff -u -p -r1.3 VMMethod.java
--- vm/reference/gnu/classpath/jdwp/VMMethod.java	9 Mar 2006 23:18:29 -	1.3
+++ vm/reference/gnu/classpath/jdwp/VMMethod.java	27 Apr 2007 20:47:21 -
@@ -1,5 +1,5 @@
 /* VMMethod.java -- a method in a virtual machine
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -175,4 +175,15 @@ public class VMMethod
   {
 return VMVirtualMachine.getClassMethod(klass, bb.getLong());
   }
+
+  public boolean equals(Object obj)
+  {
+if (obj instanceof VMMethod)
+  {
+	VMMethod m = (VMMethod) obj;
+	return (getId() == m.getId());
+  }
+
+return false;
+  }
 }


[cp-patches] [PATCH/JDWP] Allow multiple events

2007-04-27 Thread Keith Seitz

Hi,

Well, there was a FIXME listed in Jdwp.notify about dealing with 
multiple events. Recent testing with Eclipse has shown that we *do* need 
to deal with multiple events (of the same kind). Despite what I would 
have thought, when multiple breakpoints are set in a method with 
Eclipse, JDT debug will set a CLASS_PREPARE event request for each 
breakpoint. Go figure.


The attached patch fixes this poor assumption.

Keith

ChangeLog
2007-04-27  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/event/EventManager.java
(getEventRequest): Rename to...
(getEventRequests): ...this.
Change return type to array of requests.
Construct a list of all matching events and return
them all.
* gnu/classpath/jdwp/Jdwp.java (notify): Use getEventRequests
and send event notifications for all matching requests.
Index: gnu/classpath/jdwp/event/EventManager.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/EventManager.java,v
retrieving revision 1.6
diff -u -p -r1.6 EventManager.java
--- gnu/classpath/jdwp/event/EventManager.java	18 Jan 2007 01:11:06 -	1.6
+++ gnu/classpath/jdwp/event/EventManager.java	27 Apr 2007 21:25:04 -
@@ -44,6 +44,7 @@ import gnu.classpath.jdwp.VMVirtualMachi
 import gnu.classpath.jdwp.exception.InvalidEventTypeException;
 import gnu.classpath.jdwp.exception.JdwpException;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -146,39 +147,39 @@ public class EventManager
   }
 
   /**
-   * Returns a request for the given event. This method will only
+   * Returns all requests for the given event. This method will only
* be used if the codeEventManager/code is handling event filtering.
*
* @param  event  the event
-   * @return request that was interested in this event
+   * @return requests that are interested in this event
* or codenull/code if none (and event should not be sent)
* @throws IllegalArgumentException for invalid event kind
*/
-  public EventRequest getEventRequest (Event event)
+  public EventRequest[] getEventRequests(Event event)
   {
-EventRequest interestedRequest = null;
+ArrayList interestedEvents = new ArrayList();
 Hashtable requests;
-Byte kind = new Byte (event.getEventKind ());
-requests = (Hashtable) _requests.get (kind);
+Byte kind = new Byte(event.getEventKind());
+requests = (Hashtable) _requests.get(kind);
 if (requests == null)
   {
 	// Did not get a valid event type
-	throw new IllegalArgumentException (invalid event kind:  + kind);
+	throw new IllegalArgumentException(invalid event kind:  + kind);
   }
-boolean match = false;
 
 // Loop through the requests. Must look at ALL requests in order
 // to evaluate all filters (think count filter).
-// TODO: What if multiple matches? Spec isn't so clear on this.
-Iterator rIter = requests.values().iterator ();
-while (rIter.hasNext ())
+Iterator rIter = requests.values().iterator();
+while (rIter.hasNext())
   {
-	EventRequest request = (EventRequest) rIter.next ();
-	if (request.matches (event))
-	  interestedRequest = request;
+	EventRequest request = (EventRequest) rIter.next();
+	if (request.matches(event))
+	  interestedEvents.add(request);
   }
 
-return interestedRequest;
+EventRequest[] r = new EventRequest[interestedEvents.size()];
+interestedEvents.toArray(r);
+return r;
   }
 
   /**
Index: gnu/classpath/jdwp/Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.8
diff -u -p -r1.8 Jdwp.java
--- gnu/classpath/jdwp/Jdwp.java	16 Jun 2006 19:40:04 -	1.8
+++ gnu/classpath/jdwp/Jdwp.java	27 Apr 2007 21:25:04 -
@@ -1,5 +1,5 @@
 /* Jdwp.java -- Virtual machine to JDWP back-end programming interface
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -207,23 +207,22 @@ public class Jdwp
* The event is filtered through the event manager before being
* sent.
*
-   * FIXME: Probably need logic to send multiple events
+   * FIXME: Probably need logic to send multiple (different) events
* @param event the event to report
*/
-  public static void notify (Event event)
+  public static void notify(Event event)
   {
-Jdwp jdwp = getDefault ();
+Jdwp jdwp = getDefault();
 if (jdwp != null)
   {
-	EventManager em = EventManager.getDefault ();
-	EventRequest request = em.getEventRequest (event);
-	if (request != null)
+	EventManager em = EventManager.getDefault();
+	EventRequest[] requests = em.getEventRequests(event);
+	for (int i = 0; i  requests.length; ++i)
 	  {
 	try
 	  {
-		System.out.println

[commit-cp] classpath ChangeLog gnu/classpath/jdwp/Jdwp.jav...

2007-04-27 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/04/27 21:30:59

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp: Jdwp.java 
gnu/classpath/jdwp/event: EventManager.java 

Log message:
* gnu/classpath/jdwp/event/EventManager.java
(getEventRequest): Rename to...
(getEventRequests): ...this.
Change return type to array of requests.
Construct a list of all matching events and return
them all.
* gnu/classpath/jdwp/Jdwp.java (notify): Use getEventRequests
and send event notifications for all matching requests.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9288r2=1.9289
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/Jdwp.java?cvsroot=classpathr1=1.8r2=1.9
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/EventManager.java?cvsroot=classpathr1=1.6r2=1.7




Re: [cp-patches] [RFA/JDWP] Fix ReferenceType.SourceFile

2007-04-11 Thread Keith Seitz

Kyle Galloway wrote:

ChangeLog
2007-04-11  Kyle Galloway  [EMAIL PROTECTED]

   * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
   (executeSourceFile): Throw an exception if no source file was found.

Questions/comments/concerns?


Hmm. I'm not convinced this is the right way to do this... My initial 
reaction is to have VMVirtualMachine.getSourceFile throw the exception 
instead of the return value being reinterpreted. After all, it should 
know the *exact* reason it cannot return the requested information. All 
VMVirtualMachine methods are declared throwing JdwpException for this 
reason.


But perhaps you considered this already and discounted it for some reason?

Keith

PS. Along similar lines, I think that there are a lot of hidden problems 
with gcj's implementation of VMVirtualMachine. All the unimplemented 
stub functions return NULL or 0 (or some such thing) instead of throwing 
NotImplementedException. I think this just confuses things.




Re: [cp-patches] [RFA/JDWP] Fix ReferenceType.SourceFile

2007-04-11 Thread Keith Seitz

Kyle Galloway wrote:

I'm definitely seeing this come up, but I'm not sure it will get us 
around having to implment some things right away.  For example I think 
we're going to need VirtualMachine.AllClasses since I don't think having 
it throw an unimplemented exception is going to go over very well with 
the debugger, however, this is something I wil need to check out.


Ugh. I was afraid that this was going to be an all or nothing kind of 
thing. I was hoping we'd _only_ have to do 90% of it. O:-)


Keith



Re: [cp-patches] [RFA] Add ArrayValue for JDWP

2007-04-03 Thread Keith Seitz

Kyle Galloway wrote:


ChangeLog
2007-04-03  Kyle Galloway  [EMAIL PROTECTED]

   * gnu/classpath/jdwp/value/ArrayValue.java: New file.

Questions/comments/concerns?


Looks good. Please commit.

Keith



Re: [cp-patches] [RFA] Fix JDWP variable table

2007-03-30 Thread Keith Seitz

Kyle Galloway wrote:
This fix changes two values in gnu.classpath.jdwp.util.VariableTable so 
that they are correctly ints instead of longs.


ChangeLog
2007-3-30
   * gnu/classpath/jdwp/util/VariableTable.java: Make argCnt and slots 
ints.

   (write): Replace writeLong with writeInt for above.

Questions/comments/concerns?


Just double-check your changelog formatting. [Is it your mailer mangling 
 tabs?]


Otherwise, mea culpa. Looks like I let another one slip by me a long, 
long time ago...


Thanks,
Keith



Re: [cp-patches] [RFA] Fix JDWP variable table

2007-03-30 Thread Keith Seitz

Kyle Galloway wrote:
It seem Thunderbird (at least my version) doesn't believe in tabs.  When 
I hit TAB, it places three spaces.  Take solace though, I am aware 
of this and I do use tabs in the actual ChangeLogs.  This patch has been 
committed.


One more thing... Update the copyright notice at the top... Sheesh. It's 
Friday, all right...


Keith



[cp-patches] [PATCH/JDWP] FIx typo and transport address tweak

2007-03-29 Thread Keith Seitz

Hi,

I've committed the attached patch which addresses one bug and something 
that has just been plain irritating me:


1) The bug: gnu.classpath.jdwp.event.ThreadStartEvent was mistakenly 
using THREAD_END for event notifications. This really confuses Eclipse. 
:-) Thanks to Kyle Galloway for catching that.


2) I've made the address handling of 
gnu.classpath.jdwp.transport.SocketTransport a little more robust. 
Previously, we were really only handling server=n cases. I've now 
added handling for address specifications of :port and port (in 
addition to host:port, which we already support). Now someone can say 
something like transport=dt_socket,address=12345 and it will assume 
localhost.


[Whoops. And I foobar'd the checkin by checking in the wrong 
SocketTransport patch... Grr. Multiple repositories... I've attached

the diff with the final/real version.]

Keith

ChangeLog
2007-03-29  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/event/ThreadStartEvent.java (Event):
Event type is THREAD_START not THERAD_END.

* gnu/classpath/jdwp/transport/SocketTransport.java (ITransport):
Handle configure strings :port and port.
Index: gnu/classpath/jdwp/transport/SocketTransport.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/transport/SocketTransport.java,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -p -r1.3 -r1.5
--- gnu/classpath/jdwp/transport/SocketTransport.java	3 Sep 2005 00:22:30 -	1.3
+++ gnu/classpath/jdwp/transport/SocketTransport.java	30 Mar 2007 00:05:24 -	1.5
@@ -1,5 +1,5 @@
 /* SocketTransport.java -- a socket transport
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -89,27 +89,36 @@ class SocketTransport
* @param  properties  the properties of the JDWP session
* @throws TransportException for any configury errors
*/
-  public void configure (HashMap properties)
+  public void configure(HashMap properties)
 throws TransportException
   {
-// Get address [form: hostname:port]
-String p = (String) properties.get (_PROPERTY_ADDRESS);
+// Get server [form: y or n]
+String p = (String) properties.get(_PROPERTY_SERVER);
 if (p != null)
   {
-	String[] s = p.split (:);
-	if (s.length == 2)
-	  {
-	_host = s[0];
-	_port = Integer.parseInt (s[1]);
-	  }
+	if (p.toLowerCase().equals(y))
+	  _server = true;
   }
 
-// Get server [form: y or n]
-p = (String) properties.get (_PROPERTY_SERVER);
+// Get address [form: hostname:port]
+p = (String) properties.get(_PROPERTY_ADDRESS);
 if (p != null)
   {
-	if (p.toLowerCase().equals (y))
-	  _server = true;
+	String[] s = p.split(:);
+	if (s.length == 1)
+	  {
+	// Port number only. Assume localhost
+	_port = Integer.parseInt(s[0]);
+	_host = localhost;
+	  }
+	else
+	  {
+	if (s[0].length() == 0)
+	  _host = localhost;
+	else
+	  _host = s[0];
+	_port = Integer.parseInt(s[1]);
+	  }
   }
   }
 
Index: gnu/classpath/jdwp/event/ThreadStartEvent.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- gnu/classpath/jdwp/event/ThreadStartEvent.java	12 Jun 2006 19:43:26 -	1.3
+++ gnu/classpath/jdwp/event/ThreadStartEvent.java	29 Mar 2007 23:49:49 -	1.4
@@ -1,6 +1,6 @@
 /* ThreadStartEvent.java -- An event specifying that a new thread
has started in the virtual machine
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -75,7 +75,7 @@ public class ThreadStartEvent
* @param thread  the thread ID in which event occurred
*/
   public ThreadStartEvent (Thread thread) {
-super (JdwpConstants.EventKind.THREAD_END);
+super (JdwpConstants.EventKind.THREAD_START);
 _thread = thread;
   }
 


[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/Th...

2007-03-29 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/03/29 23:49:49

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/event: ThreadStartEvent.java 
gnu/classpath/jdwp/transport: SocketTransport.java 

Log message:
* gnu/classpath/jdwp/event/ThreadStartEvent.java (Event):
Event type is THREAD_START not THERAD_END.

* gnu/classpath/jdwp/transport/SocketTransport.java 
(ITransport):
Handle configure strings :port and port.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9183r2=1.9184
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/transport/SocketTransport.java?cvsroot=classpathr1=1.3r2=1.4




[commit-cp] classpath/gnu/classpath/jdwp/transport SocketTr...

2007-03-29 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/03/30 00:05:25

Modified files:
gnu/classpath/jdwp/transport: SocketTransport.java 

Log message:
Grr. Wrong patch. Ignore the previous version.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/transport/SocketTransport.java?cvsroot=classpathr1=1.4r2=1.5




Re: [cp-patches] [RFA] Fix JDWP ResumeThread

2007-03-27 Thread Keith Seitz

Kyle Galloway wrote:
This patch fixes JDWP so when a Resume command is sent to a thread, it 
will correctly call VMVirtualMachine.resumeThread instead of calling  
VMVirtualMachine.suspendThread again.  Currently, it is impossible to 
Resume a thread once you have suspended it with JDWP, this patch fixes 
that problem.


ChangeLog
2007-03-27  Kyle Galloway  [EMAIL PROTECTED]
   * gnu/classpth/jdwp/processor/ThreadReferenceCommandSet.java
   (executeResume): Cheange to call VMVirtualMachine.resumeThread.

Questions/comments/concerns?


Sheesh. How did I let that slip by me?

Hmm. I wonder why I've never noticed this before. Because I always use 
VirtualMachine.resume?


Wow. Definitely check this in. [Double-check changelog indentation  fix 
typo (cheange)...]


Keith



[cp-patches] Guidelines for annotations?

2007-03-09 Thread Keith Seitz

Hi,

The Classpath Hacker's Guide doesn't mention anything about annotations. 
Doing a quick grep of the sources, I see that, e.g., the @Override 
annotation is being handled in several different ways:


@Override
public void foo();

@Override public void foo();

public @Override void foo();

Do we have a standard?

Keith



Re: [cp-patches] Guidelines for annotations?

2007-03-09 Thread Keith Seitz

Tom Tromey wrote:

Mario == Mario Torre [EMAIL PROTECTED] writes:



@Override
public void foo(); 


Me too.  Three votes... maybe the motion passes?  :)


So that's several votes for this style already. One last question: what 
about comments/javadoc?


1) Before
@Override
/**
 * foo
 */

2) After
/**
 * foo
 */
@Override

I presume most people would prefer #1?

Keith



Re: [cp-patches] Guidelines for annotations?

2007-03-09 Thread Keith Seitz

Mario Torre wrote:

Il giorno ven, 09/03/2007 alle 12.05 -0800, Keith Seitz ha scritto:


2) After
/**
  * foo
  */
@Override

I presume most people would prefer #1?

Keith



I speak for myself, but I think most of us agree here, doing #1 would
make things to lost easily, for example in case of longs comments. It
looks like it is a natural place to put the annotation right before the
method declaration (after the comments: #2)


[cough] I actually did mean #2 (annotation after javadoc). I reworded my 
 message and flipped the numbers around.


Okay, so there seems to be universal agreement on that. All we need now 
is for Mark to chime in and disagree. :-)


Thanks all!
Keith



Re: [cp-patches] [RFA] Fix JDWP Values

2007-03-09 Thread Keith Seitz

[my apologies for the delay in getting back to you]

Kyle Galloway wrote:

Keith Seitz wrote:


I see that this method can throw InvalidObjectException if the object 
ID is not known by the ID manager. How is JdwpInternalErrorException 
thrown?

This gets thrown by JdwpString.readString().


Ah... Missed that.

I see what your saying, and I gave it some thought, but there is a big 
difference between having the value already packaged in an object and 
having to take it out of the byte buffer.  If I were to make a common 
method, I would first have to go through like this is the ByteBuffer case:


if (it's an int)
 new Integer(bb.getInt)
else if (it's a float)
 new Float (bb.getFloat)
etc...

which is just as much wasted code space, so I think keeping the object 
as a special case is the best bet.


Hmm. Yeah. I guess I was hoping generics would help here, but it doesn't 
really. Oh, well, never mind that.



I have attached a new patch.


Okay, you saw this coming... :-)


+  @Override
+  /**
+   * Return an object representing this type
+   * 
+   * @return an Object represntation of this value

+   */
+  protected Object getObject()
+  {
+return new Integer(_value);
+  }


The consensus appears to be to put the annotation just before the method 
declaration/after the javadoc.



Index: gnu/classpath/jdwp/value/ValueFactory.java
===
RCS file: gnu/classpath/jdwp/value/ValueFactory.java
diff -N gnu/classpath/jdwp/value/ValueFactory.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/value/ValueFactory.java  1 Jan 1970 00:00:00 -
+  public static Value createFromTagged(ByteBuffer bb)
+throws JdwpInternalErrorException, InvalidObjectException
+  {
+return create(bb, bb.get());
+  }


A little (useless?) paranoia here. Perhaps this method should throw 
JdwpException, just in case the tag is invalid?



+  private static Value create(ByteBuffer bb, byte tag)
+throws JdwpInternalErrorException, InvalidObjectException
+  {
+Value val = null;
+switch(tag)
+{

[snip]

I think we should add a default case an throw InvalidTagException (which 
doesn't exist yet).



Index: gnu/classpath/jdwp/value/Value.java
===
RCS file: gnu/classpath/jdwp/value/Value.java
diff -N gnu/classpath/jdwp/value/Value.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/value/Value.java 1 Jan 1970 00:00:00 -



+  /**
+   * Return an object representing this type


Returns


+  /**
+   * Get an untageed object from the ByteBuffer


untagged


+  /**
+   * Get an untageed object from the ByteBuffer


untagged

With the above changes, please commit.

Keith



Re: [cp-patches] [RFA] Fix JDWP Values

2007-03-05 Thread Keith Seitz

Kyle Galloway wrote:


Questions/Comments/Concerns?


I like it. Just some minor nits (some cosmetic, even).


Index: gnu/classpath/jdwp/value/Value.java
===
RCS file: gnu/classpath/jdwp/value/Value.java
diff -N gnu/classpath/jdwp/value/Value.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/value/Value.java 2 Mar 2007 18:21:24 -
+  /**
+   * Calls the dervied classes writeValue method to write its value to the 
+   * DataOutputStream.
+   * 
+   * @param os write the value here

+   * @throws IOException
+   */  
+  public void writeUntaggedValue(DataOutputStream os)

+throws IOException
+  {
+writeValue(os);
+  }


Can we shorten this to just writeUntagged. It's just a nit: I hate to 
type, and the ID system already uses this convention for un/tagged 
object ids.



+  /**
+   * Will write the given object as a tagged value to the DataOutputStream.
+   * 
+   * @param os write the value here

+   * @param obj the Object to write
+   * @throws IOException
+   */
+  public void writeTaggedValue(DataOutputStream os)
+throws IOException
+  {
+os.write (_tag);
+writeValue(os);
+  }


Same here: writeTagged.


+  protected abstract void writeValue(DataOutputStream os)
+throws IOException;


Here I go again. Any need for the Value part of the name? It seems 
redundant.



+  /**
+   * Creates a new Value of appropriate type for the value in the ByteBuffer
+   * 
+   * @param bb contains the Object

+   * @param tag a byte tag indicating the type of the value in the ByteBuffer
+   * @return The Object referenced by the value
+   * @throws JdwpInternalErrorException
+   * @throws InvalidObjectException
+   */
+  public static Value createValueTagged(ByteBuffer bb, byte tag)
+throws JdwpInternalErrorException, InvalidObjectException


I see that this method can throw InvalidObjectException if the object ID 
is not known by the ID manager. How is JdwpInternalErrorException thrown?


Another little nit. The name of this method is: Value.createValueTagged. 
Redundant and a little vague (to me at least). Can we rename this 
Value.createFromTagged? [Likewise with the untagged variety.]


Hmm. This is really rather a factory method, isn't it? Perhaps we should 
consider moving this method to a proper factory class. It's probably not 
really worth it, but I could see it making the code a little 
clearer/obvious. What do you think?


This method and the other static ones seem to all be declared something 
like:


public static Object/Value METHODNAME (ByteBuffer bb, byte tag);

Yet every time one of these methods is called, it is always called like 
so: foo = METHODNAME(bb, bb.get()); I'd much rather see the methods 
read from the ByteBuffer entirely, i.e., drop the byte tag part -- 
unless, of course, this is used somewhere else that I don't see yet.


 +  case JdwpConstants.Tag.VOID:
 +val = new VoidValue();
 +  case JdwpConstants.Tag.ARRAY:
 +  case JdwpConstants.Tag.THREAD:
 +  case JdwpConstants.Tag.OBJECT:
 +  case JdwpConstants.Tag.THREAD_GROUP:
 +  case JdwpConstants.Tag.CLASS_LOADER:
 +  case JdwpConstants.Tag.CLASS_OBJECT:
 +ObjectId oid = VMIdManager.getDefault().readObjectId(bb);
 +val = new ObjectValue(oid.getObject());
 +  case JdwpConstants.Tag.STRING:
 +val = new StringValue(JdwpString.readString(bb));

Missing a break for these cases. Did the compiler not output any 
warnings? Please double-check.



+  public static Value createValueFromObject(Object value, Class klass)


This method is really, really similar to createValueTagged. Can you 
rewrite so that this method uses getTagForClass and call 
createValueTagged (or probably a common method)? [Obviously, you'll need 
to tweak createValueTagged a little bit.]



+  public static Object getUntaggedObj(ByteBuffer bb, Class type)
+throws JdwpInternalErrorException, InvalidObjectException


To parallel the tagged version of this method, please change the name to 
getUntaggedObject. As with the untagged version of this, I think I 
might rather see these static methods go into a separate factory class.



Index: include/gnu_java_awt_peer_gtk_CairoSurface.h
===
RCS file: 
/sources/classpath/classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h,v
retrieving revision 1.9
diff -u -r1.9 gnu_java_awt_peer_gtk_CairoSurface.h
--- include/gnu_java_awt_peer_gtk_CairoSurface.h21 Feb 2007 21:47:37 
-  1.9
+++ include/gnu_java_awt_peer_gtk_CairoSurface.h2 Mar 2007 18:21:26 
-


:-)

Keith



[cp-patches] [PATCH/JDWP] Small cleanups to processor package

2007-02-28 Thread Keith Seitz

Hi,

I've committed the attached patch which does some simple housekeeping 
cleanup to make the code more consistent, and fix some silly error 
message cut-n-paste faux pas.


Keith

ChangeLog
2007-02-28  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/processor/MethodCommandSet.java
(executeLineTable): Use ReferenceTypeId instead of
ClassReferenceTypeId.
(executeVariableTable): Likewise.
(executeVariableTableWithGeneric): Fix error message.
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
(executeSignatureWithGeneric): Fix error message.
(executeFieldWithGeneric): Likewise.
(executeMethodsWithGeneric): Likewise.
* gnu/classpath/jdwp/processor/StackFrameCommandSet.java
(executeGetValues): Use ThreadId instead of ObjectId.
(executeSetValues): Likewise.
(executeThisObject): Likewise.
Index: gnu/classpath/jdwp/processor/MethodCommandSet.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java,v
retrieving revision 1.5
diff -u -p -r1.5 MethodCommandSet.java
--- gnu/classpath/jdwp/processor/MethodCommandSet.java	10 Mar 2006 00:14:05 -	1.5
+++ gnu/classpath/jdwp/processor/MethodCommandSet.java	28 Feb 2007 21:29:30 -
@@ -1,5 +1,5 @@
 /* MethodCommandSet.java -- class to implement the Method Command Set
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -43,7 +43,7 @@ import gnu.classpath.jdwp.VMMethod;
 import gnu.classpath.jdwp.exception.JdwpException;
 import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
 import gnu.classpath.jdwp.exception.NotImplementedException;
-import gnu.classpath.jdwp.id.ClassReferenceTypeId;
+import gnu.classpath.jdwp.id.ReferenceTypeId;
 import gnu.classpath.jdwp.util.LineTable;
 import gnu.classpath.jdwp.util.VariableTable;
 
@@ -99,8 +99,7 @@ public class MethodCommandSet
   private void executeLineTable(ByteBuffer bb, DataOutputStream os)
   throws JdwpException, IOException
   {
-ClassReferenceTypeId refId
-  = (ClassReferenceTypeId) idMan.readReferenceTypeId(bb);
+ReferenceTypeId refId = idMan.readReferenceTypeId(bb);
 Class clazz = refId.getType();
 
 VMMethod method = VMMethod.readId(clazz, bb);
@@ -111,8 +110,7 @@ public class MethodCommandSet
   private void executeVariableTable(ByteBuffer bb, DataOutputStream os)
   throws JdwpException, IOException
   {
-   ClassReferenceTypeId refId
- = (ClassReferenceTypeId) idMan.readReferenceTypeId(bb);
+ReferenceTypeId refId = idMan.readReferenceTypeId(bb);
 Class clazz = refId.getType();
 
 VMMethod method = VMMethod.readId(clazz, bb);
@@ -143,7 +141,7 @@ public class MethodCommandSet
   {
 // We don't have generics yet
 throw new NotImplementedException(
-  Command SourceDebugExtension not implemented.);
+  Command VariableTableWithGeneric not implemented.);
   }
 
 }
Index: gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java,v
retrieving revision 1.7
diff -u -p -r1.7 ReferenceTypeCommandSet.java
--- gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java	14 Mar 2006 03:50:08 -	1.7
+++ gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java	28 Feb 2007 21:29:30 -
@@ -1,6 +1,6 @@
 /* ReferenceTypeCommandSet.java -- class to implement the ReferenceType
Command Set
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -314,7 +314,7 @@ public class ReferenceTypeCommandSet
   {
 // We don't have generics yet
 throw new NotImplementedException(
-  Command SourceDebugExtension not implemented.);
+  Command SignatureWithGeneric not implemented.);
   }
 
   private void executeFieldWithGeneric(ByteBuffer bb, DataOutputStream os)
@@ -322,7 +322,7 @@ public class ReferenceTypeCommandSet
   {
 // We don't have generics yet
 throw new NotImplementedException(
-  Command SourceDebugExtension not implemented.);
+  Command executeFieldWithGeneric not implemented.);
   }
 
   private void executeMethodsWithGeneric(ByteBuffer bb, DataOutputStream os)
@@ -330,6 +330,6 @@ public class ReferenceTypeCommandSet
   {
 // We don't have generics yet
 throw new NotImplementedException(
-  Command SourceDebugExtension not implemented.);
+  Command executeMethodsWithGeneric not implemented.);
   }
 }
Index: gnu/classpath/jdwp/processor/StackFrameCommandSet.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java,v

[cp-patches] [PATCH/JDWP] Add VM capabilities

2007-02-28 Thread Keith Seitz

Hi,

This has been bugging me for a long time, so I've finally taken some 
time to fix it properly. This patch adds a bunch of constants to 
VMVirtualMachine (and several new methods) to deal properly with the 
JDWP VirtualMachine.Capabilites and .CapabilitiesNew commands.


I've gone through the processor code, too, and implemented all the 
previously optional methods that were waiting for this fix.


Keith

ChangeLog
2007-02-28  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/processor/EventRequestCommandSet.java
(executeSet): Check if VM has capability for field access
or modification events.
* gnu/classpath/jdwp/processor/MethodCommandSet.java
(executeByteCodes): Check if VM has capability and
implement.
* gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
(executeMonitorInfo): Likewise.
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
(executeSourceDebugExtension): Likewise.
* gnu/classpath/jdwp/processor/StackFrameCommandSet.java
(executePopFrames): Likewise.
* gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
(executeOwnedMonitors): Likewise.
(executeCurrentContendedMonitor): Likewise.
* gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
(executeCapabilities): Rewrite using new VMVirtualMachine
capabilities.
(executeRedefineClasses): Check if VM has capability and
implement.
(executeSetDefaultStratum): Likewise.
* gnu/classpath/jdwp/util/MonitorInfo.java; New file.
* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
(canWatchFieldModification): New class constant.
(canWatchFieldAccess): Likewise.
(canGetBytecodes): Likewise.
(canGetSyntheticAttribute): Likewise.
(canGetOwnedMonitorInfo): Likewise.
(canGetCurrentContendedMonitor): Likewise.
(canGetMonitorInfo): Likewise.
(canRedefineClasses): Likewise.
(canAddMethod): Likewise.
(canUnrestrictedlyRedefineClasses): Likewise.
(canPopFrames): Likewise.
(canUseInstanceFilters): Likewise.
(canGetSourceDebugExtension): Likewise.
(canRequestVMDeathEvent): Likewise.
(canSetDefaultStratum): Likewise.
(redefineClasses): New method.
(setDefaultStratum): Likewise.
(getSourceDebugExtension): Likewise.
(getBytecodes): Likewise.
(getMonitorInfo): Likewise.
(getOwnedMonitors): Likewise.
(getCurrentContendedMonitor): Likewise.
(popFrames): Likewise.
Index: gnu/classpath/jdwp/processor/EventRequestCommandSet.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java,v
retrieving revision 1.5
diff -u -p -r1.5 EventRequestCommandSet.java
--- gnu/classpath/jdwp/processor/EventRequestCommandSet.java	2 Jun 2006 01:04:24 -	1.5
+++ gnu/classpath/jdwp/processor/EventRequestCommandSet.java	28 Feb 2007 22:41:22 -
@@ -1,6 +1,6 @@
 /* EventRequestCommandSet.java -- class to implement the EventRequest Command
Set
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2007 Free Software Foundation
  
 This file is part of GNU Classpath.
 
@@ -40,6 +40,7 @@ exception statement from your version. *
 package gnu.classpath.jdwp.processor;
 
 import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMVirtualMachine;
 import gnu.classpath.jdwp.event.EventManager;
 import gnu.classpath.jdwp.event.EventRequest;
 import gnu.classpath.jdwp.event.filters.ClassExcludeFilter;
@@ -113,6 +114,28 @@ public class EventRequestCommandSet
 byte suspendPolicy = bb.get();
 int modifiers = bb.getInt();
 
+switch (eventKind)
+  {
+	case JdwpConstants.EventKind.FIELD_ACCESS:
+	if (!VMVirtualMachine.canWatchFieldAccess)
+	  {
+	String msg = watching field accesses is not supported;
+	throw new NotImplementedException(msg);
+	  }
+	break;
+
+	case JdwpConstants.EventKind.FIELD_MODIFICATION:
+	if (!VMVirtualMachine.canWatchFieldModification)
+	  {
+	String msg = watching field modifications is not supported;
+	throw new NotImplementedException(msg);
+	  }
+	break;
+
+  default:
+	// okay
+  }
+
 EventRequest eventReq = new EventRequest(eventKind, suspendPolicy);
 IEventFilter filter = null;
 ReferenceTypeId refId;
Index: gnu/classpath/jdwp/processor/MethodCommandSet.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java,v
retrieving revision 1.6
diff -u -p -r1.6 MethodCommandSet.java
--- gnu/classpath/jdwp/processor/MethodCommandSet.java	28 Feb 2007 21:32:34 -	1.6
+++ gnu/classpath/jdwp/processor/MethodCommandSet.java	28 Feb 2007 22:41:22 -
@@ -40,6 +40,7 @@ package

[commit-cp] classpath ChangeLog gnu/classpath/jdwp/processo...

2007-02-28 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/02/28 21:32:34

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/processor: MethodCommandSet.java 
  ReferenceTypeCommandSet.java 
  StackFrameCommandSet.java 

Log message:
* gnu/classpath/jdwp/processor/MethodCommandSet.java
(executeLineTable): Use ReferenceTypeId instead of
ClassReferenceTypeId.
(executeVariableTable): Likewise.
(executeVariableTableWithGeneric): Fix error message.
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
(executeSignatureWithGeneric): Fix error message.
(executeFieldWithGeneric): Likewise.
(executeMethodsWithGeneric): Likewise.
* gnu/classpath/jdwp/processor/StackFrameCommandSet.java
(executeGetValues): Use ThreadId instead of ObjectId.
(executeSetValues): Likewise.
(executeThisObject): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9133r2=1.9134
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java?cvsroot=classpathr1=1.7r2=1.8
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java?cvsroot=classpathr1=1.8r2=1.9




[commit-cp] classpath ChangeLog vm/reference/gnu/classpath/...

2007-02-28 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/03/01 02:02:36

Modified files:
.  : ChangeLog 
vm/reference/gnu/classpath/jdwp: VMVirtualMachine.java 
gnu/classpath/jdwp/processor: EventRequestCommandSet.java 
  MethodCommandSet.java 
  ObjectReferenceCommandSet.java 
  ReferenceTypeCommandSet.java 
  StackFrameCommandSet.java 
  ThreadReferenceCommandSet.java 
  VirtualMachineCommandSet.java 
Added files:
gnu/classpath/jdwp/util: MonitorInfo.java 

Log message:
* gnu/classpath/jdwp/processor/EventRequestCommandSet.java
(executeSet): Check if VM has capability for field access
or modification events.
* gnu/classpath/jdwp/processor/MethodCommandSet.java
(executeByteCodes): Check if VM has capability and
implement.
* gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
(executeMonitorInfo): Likewise.
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
(executeSourceDebugExtension): Likewise.
* gnu/classpath/jdwp/processor/StackFrameCommandSet.java
(executePopFrames): Likewise.
* gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
(executeOwnedMonitors): Likewise.
(executeCurrentContendedMonitor): Likewise.
* gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
(executeCapabilities): Rewrite using new VMVirtualMachine
capabilities.
(executeRedefineClasses): Check if VM has capability and
implement.
(executeSetDefaultStratum): Likewise.
* gnu/classpath/jdwp/util/MonitorInfo.java; New file.
* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
(canWatchFieldModification): New class constant.
(canWatchFieldAccess): Likewise.
(canGetBytecodes): Likewise.
(canGetSyntheticAttribute): Likewise.
(canGetOwnedMonitorInfo): Likewise.
(canGetCurrentContendedMonitor): Likewise.
(canGetMonitorInfo): Likewise.
(canRedefineClasses): Likewise.
(canAddMethod): Likewise.
(canUnrestrictedlyRedefineClasses): Likewise.
(canPopFrames): Likewise.
(canUseInstanceFilters): Likewise.
(canGetSourceDebugExtension): Likewise.
(canRequestVMDeathEvent): Likewise.
(canSetDefaultStratum): Likewise.
(redefineClasses): New method.
(setDefaultStratum): Likewise.
(getSourceDebugExtension): Likewise.
(getBytecodes): Likewise.
(getMonitorInfo): Likewise.
(getOwnedMonitors): Likewise.
(getCurrentContendedMonitor): Likewise.
(popFrames): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9136r2=1.9137
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/util/MonitorInfo.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java?cvsroot=classpathr1=1.6r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java?cvsroot=classpathr1=1.6r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java?cvsroot=classpathr1=1.8r2=1.9
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java?cvsroot=classpathr1=1.7r2=1.8
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java?cvsroot=classpathr1=1.9r2=1.10




Re: [cp-patches] [RFA] JDWP Null values

2007-02-27 Thread Keith Seitz

Kyle Galloway wrote:


ChangeLog
2007-02-27  Kyle Galloway  [EMAIL PROTECTED]

   * gnu/classpath/jdwp/id/NullObjectId.java: New class.
   * gnu/classpath/jdwp/util/NullObject.java: New class.
   * vm/reference/gnu/classpath/jdwp/VMIdManager.java (getObjectId): 
Handle null object.

   (get): Handle objectId of 0.



Index: gnu/classpath/jdwp/id/NullObjectId.java
===
RCS file: gnu/classpath/jdwp/id/NullObjectId.java
diff -N gnu/classpath/jdwp/id/NullObjectId.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/id/NullObjectId.java 1 Jan 1970 00:00:00 -


This file is missing the header information which includes the copyright 
notice.



Index: gnu/classpath/jdwp/util/NullObject.java
===
RCS file: gnu/classpath/jdwp/util/NullObject.java
diff -N gnu/classpath/jdwp/util/NullObject.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/util/NullObject.java 1 Jan 1970 00:00:00 -


Same here. As trivial as this file is, please add the appropriate notices.

Otherwise, it looks fine. Thank you.

Keith



Re: [cp-patches] [RFA] JDWP Changes to VMFrame.getValue

2007-02-22 Thread Keith Seitz

Kyle Galloway wrote:

Hi,

This patch changes VMFrame::getValues to take a signature byte as well 
as a slot when getting local variables.  This is done for use in type 
checking when interfacing with the VM.


Questions/comments/concerns?


Yeah, that's logical. Please commit.

Keith



[cp-patches] [PATCH/JDWP] Clean up VMVirtualMachine.getAllLoadedClasses

2007-02-22 Thread Keith Seitz

Hi,

I've committed the attached patch which cleans up an otherwise 
troublesome implementation of VMVirtualMachine.getAllLoadedClasses. I 
don't know the reason why this was done this way when it was committed, 
but now that I've actually tried to implement it in gcj, I don't like it.


So I'm changing it. :-)

Keith

ChangeLog
2007-02-22  Keith Seitz  [EMAIL PROTECTED]

* vm/refernece/gnu/classpath/jdwp/VMVirtualMachine.java
(getAllLoadedClassesCount): Remove.
(getAllLoadedClasses): Return a Collection.
* gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
(executeClassesBySignature): VMVirtualMachine.getAllLoadedClasses
now returns Collection.
(executeAllClasses): Likewise.
Get size of return from Colleciton instead of calling
getAllLoadedClassesCount.
Index: gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java,v
retrieving revision 1.8
diff -u -p -r1.8 VirtualMachineCommandSet.java
--- gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java	17 Feb 2006 14:49:06 -	1.8
+++ gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java	22 Feb 2007 23:27:34 -
@@ -1,6 +1,6 @@
 /* VirtualMachineCommandSet.java -- class to implement the VirtualMachine
Command Set
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
  
 This file is part of GNU Classpath.
 
@@ -54,6 +54,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.Properties;
 
@@ -179,7 +180,8 @@ public class VirtualMachineCommandSet
 ArrayList allMatchingClasses = new ArrayList();
 
 // This will be an Iterator over all loaded Classes
-Iterator iter = VMVirtualMachine.getAllLoadedClasses();
+Collection classes = VMVirtualMachine.getAllLoadedClasses();
+Iterator iter = classes.iterator ();
 
 while (iter.hasNext())
   {
@@ -203,22 +205,11 @@ public class VirtualMachineCommandSet
   private void executeAllClasses(ByteBuffer bb, DataOutputStream os)
 throws JdwpException, IOException
   {
-// Disable garbage collection while we're collecting the info on loaded
-// classes so we some classes don't get collected between the time we get
-// the count and the time we get the list
-//VMVirtualMachine.disableGarbageCollection();
+Collection classes = VMVirtualMachine.getAllLoadedClasses();
+os.writeInt(classes.size ());
 
-int classCount = VMVirtualMachine.getAllLoadedClassesCount();
-os.writeInt(classCount);
-
-// This will be an Iterator over all loaded Classes
-Iterator iter = VMVirtualMachine.getAllLoadedClasses();
-//VMVirtualMachine.enableGarbageCollection();
-int count = 0;
-
-// Note it's possible classes were created since out classCount so make
-// sure we don't write more classes than we told the debugger
-while (iter.hasNext()  count++  classCount)
+Iterator iter = classes.iterator ();
+while (iter.hasNext())
   {
 Class clazz = (Class) iter.next();
 ReferenceTypeId id = idMan.getReferenceTypeId(clazz);
Index: vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
===
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java,v
retrieving revision 1.8
diff -u -p -r1.8 VMVirtualMachine.java
--- vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	2 Feb 2007 14:45:53 -	1.8
+++ vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	22 Feb 2007 23:27:34 -
@@ -1,7 +1,7 @@
 /* VMVirtualMachine.java -- A reference implementation of a JDWP virtual
machine
 
-   Copyright (C) 2005, 2006 Free Software Foundation
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -48,7 +48,7 @@ import gnu.classpath.jdwp.util.MethodRes
 import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collection;
 
 /**
  * A virtual machine according to JDWP.
@@ -170,15 +170,9 @@ public class VMVirtualMachine
 throws JdwpException;
  
   /**
-   * Returns a count of the number of loaded classes in the VM
+   * Returns a Collection of all classes loaded in the VM
*/
-  public static native int getAllLoadedClassesCount()
-throws JdwpException;
-
-  /**
-   * Returns an iterator over all the loaded classes in the VM
-   */
-  public static native Iterator getAllLoadedClasses()
+  public static native Collection getAllLoadedClasses()
 throws JdwpException;
 
   /**


Re: [cp-patches] [RFA/JDWP] JDWP Stack tracing changes

2007-02-01 Thread Keith Seitz

Kyle Galloway wrote:


2007-02-01  Kyle Galloway  [EMAIL PROTECTED]

   * gnu/classpath/jdwp/processor/StackFrameCommandSet.java
   (executeGetValues): Changed getFrame to use a jlong to pass frameID.
   (executeSetValues): Ditto.
   (executeThisObject): Ditto.
   * vm/reference/gnu/classpath/jdwp/VMFrame.java: Added thread field and a
   constructor used to create VMFrames.
   (getThread): New method.
   * vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java(getFrame): 
Changed

   to take a long instead of a ByteBuffer to pass the frameID.

Comments?


That looks fine. Please commit.

[BTW, can you whack the space between function names and the opening 
parenthesis in VMVirtualMachine.getFrame while you're there?]


Keith



[cp-patches] [PATCH/JDWP] Implement StepFilter.matches and tweak

2007-01-17 Thread Keith Seitz

Hi,

This patch is actually two unrelated patches. The first implements the 
matches method from the StepFilter. Like the BreakpointFilter, 
StepFilter always matches. [See expanded comments in StepFilter or 
BreakpointFilter for more.]


The second deals with a tweak to EventManager to honor the startup 
suspend option. Originally I was dealing with this differently, but I 
see no reason why this should be necessary.


Keith

ChangeLog
2007-01-17  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/events/filters/StepFilter.java:
Update javadoc.
(matches): Implement.

* gnu/classpath/jdwp/event/EventManager.java (EventManager): Honor
agent startup suspension for VM_INIT.


[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/fi...

2007-01-17 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths07/01/18 01:11:06

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/event/filters: StepFilter.java 
gnu/classpath/jdwp/event: EventManager.java 

Log message:
* gnu/classpath/jdwp/events/filters/StepFilter.java:
Update javadoc.
(matches): Implement.

* gnu/classpath/jdwp/event/EventManager.java (EventManager): 
Honor
agent startup suspension for VM_INIT.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9065r2=1.9066
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/EventManager.java?cvsroot=classpathr1=1.5r2=1.6




Re: [cp-patches] [RFA/JDWP]: Add TypeMismatchException

2007-01-16 Thread Keith Seitz

Kyle Galloway wrote:

Comments, concerns, or is this ok to commit?


Ok, but please double-check the indentation before you commit. It may 
just be my mailer, but the String-based constructor looks mis-indented.


Keith



Re: [cp-patches] [RFC/JDWP]: Add InvalidSlotException

2007-01-15 Thread Keith Seitz

Kyle Galloway wrote:


Comments, concerns, or is this ok to commit?


Looks okay.

Do you have commit access, or do you need me to check it in for you?

Keith



Re: [cp-patches] [RFC/JDWP]: Add AbsentInformationException

2007-01-15 Thread Keith Seitz

Kyle Galloway wrote:


Comments, concerns, or is this ok to commit?


Okay

Keith





Re: [cp-patches] [RFC/JDWP]: Add InvalidFrameException

2007-01-15 Thread Keith Seitz

Kyle Galloway wrote:

Comments, concerns, or is this ok to commit?


Okay

Keith



[cp-patches] [PATCH/jvmti.h] Fix some typos

2006-08-31 Thread Keith Seitz

Hi,

I received this patch from Martin Platter a while ago. Since he has not 
submitted it here, I am checking it in myself. All it does is fix 
several typos in include/jvmti.h.


Keith

ChangeLog
2006-08-31  Keith Seitz  [EMAIL PROTECTED]

From Martin Platter  [EMAIL PROTECTED]:
* Makefile.am (include_HEADERS): Include jvmti.h.
* include/jvmti.h (jvmtiEnv) [!__cplusplus]: Add missing '*'.
(jvmtiError): Remove superfluous comma after last entry.
(jvmtiEvent): It's BREAKPOINT not BERAKPOINT.
(_Jv_jvmtiEnv.StopThread): Add missing exception parameter.
(_Jv_jvmtiEnv.RawMonitorWait): Add missing millis parameter.
(_Jv_jvmtiEnv.GetSourceFileName): source_name_ptr is pointer to
character pointer.
(_Jv_JVMTIEnv::StopThread): Add missing exception parameter.
(_Jv_JVMTIEnv::RawMonitorWait): Add missing millis parameter.
(_Jv_JVMTIEnv::GetSourceFileName): source_name_ptr is pointer to
character pointer.

Index: include/jvmti.h
===
RCS file: /sources/classpath/classpath/include/jvmti.h,v
retrieving revision 1.2
diff -u -p -r1.2 jvmti.h
--- include/jvmti.h	19 Jul 2006 23:29:30 -	1.2
+++ include/jvmti.h	31 Aug 2006 20:03:33 -
@@ -79,7 +79,7 @@ typedef struct _jvmtiAddrLocationMap jvm
 #ifdef __cplusplus
 typedef struct _Jv_JVMTIEnv jvmtiEnv;
 #else
-typedef const struct _Jv_jvmtiEnv jvmtiEnv;
+typedef const struct _Jv_jvmtiEnv *jvmtiEnv;
 #endif
 
 /*
@@ -140,7 +140,7 @@ typedef enum
   JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70,
   JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71,
   JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99,
-  JVMTI_ERROR_ILLEGAL_ARGUMENT = 103,
+  JVMTI_ERROR_ILLEGAL_ARGUMENT = 103
 } jvmtiError;
 
 /*
@@ -283,7 +283,7 @@ typedef enum
   JVMTI_EVENT_EXCEPTION_CATCH = 59,
   JVMTI_EVENT_SINGLE_STEP =  60,
   JVMTI_EVENT_FRAME_POP = 61,
-  JVMTI_EVENT_BERAKPOINT = 62,
+  JVMTI_EVENT_BREAKPOINT = 62,
   JVMTI_EVENT_FIELD_ACCESS = 63,
   JVMTI_EVENT_FIELD_MODIFICATION = 64,
   JVMTI_EVENT_METHOD_ENTRY = 65,
@@ -658,7 +658,8 @@ struct _Jv_jvmtiEnv
   jthread thread);
 
   jvmtiError (JNICALL *StopThread) (jvmtiEnv *env,
-jthread thread);
+jthread thread,
+jobject exception);
 
   jvmtiError (JNICALL *InterruptThread) (jvmtiEnv *env,
 	 jthread thread);
@@ -790,7 +791,8 @@ struct _Jv_jvmtiEnv
 	jrawMonitorID monitor);
 
   jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv *env,
-	jrawMonitorID monitor);
+	jrawMonitorID monitor,
+jlong millis);
 
   jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv *env,
 	  jrawMonitorID monitor);
@@ -844,7 +846,7 @@ struct _Jv_jvmtiEnv
 
   jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv *env,
 	   jclass klass,
-	   char *source_name_ptr);
+	   char **source_name_ptr);
 
   jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv *env,
 	   jclass klass,
@@ -1249,8 +1251,8 @@ class _Jv_JVMTIEnv
   jvmtiError ResumeThread (jthread thread)
   { return p-ResumeThread (this, thread); }
 
-  jvmtiError StopThread (jthread thread)
-  { return p-StopThread (this, thread); }
+  jvmtiError StopThread (jthread thread, jobject exception)
+  { return p-StopThread (this, thread, exception); }
 
   jvmtiError InterruptThread (jthread thread)
   { return p-InterruptThread (this, thread); }
@@ -1360,8 +1362,8 @@ class _Jv_JVMTIEnv
   jvmtiError RawMonitorExit (jrawMonitorID monitor)
   { return p-RawMonitorExit (this, monitor); }
 
-  jvmtiError RawMonitorWait (jrawMonitorID monitor)
-  { return p-RawMonitorWait (this, monitor); }
+  jvmtiError RawMonitorWait (jrawMonitorID monitor, jlong millis)
+  { return p-RawMonitorWait (this, monitor, millis); }
 
   jvmtiError RawMonitorNotify (jrawMonitorID monitor)
   { return p-RawMonitorNotify (this, monitor); }
@@ -1400,7 +1402,7 @@ class _Jv_JVMTIEnv
   jvmtiError GetClassStatus (jclass klass, jint *status_ptr)
   { return p-GetClassStatus (this, klass, status_ptr); }
 
-  jvmtiError GetSourceFileName (jclass klass, char *source_name_ptr)
+  jvmtiError GetSourceFileName (jclass klass, char **source_name_ptr)
   { return p-GetSourceFileName (this, klass, source_name_ptr); }
 
   jvmtiError GetClassModifiers (jclass klass, jint *modifiers_ptr)


[cp-patches] [PATCH/JVMTI] Include jvmti_md.h

2006-08-31 Thread Keith Seitz

Hi,

This simple patch simply includes another header file to actually give 
the VM a chance to define all those nice macros that are in jvmti.h!


Keith

ChangeLog
2006-08-31  Keith Seitz  [EMAIL PROTECTED]

* include/jvmti.h: Include jvmti_md.h.
Index: include/jvmti.h
===
RCS file: /sources/classpath/classpath/include/jvmti.h,v
retrieving revision 1.3
diff -u -p -r1.3 jvmti.h
--- include/jvmti.h	31 Aug 2006 21:15:24 -	1.3
+++ include/jvmti.h	31 Aug 2006 21:54:12 -
@@ -45,6 +45,8 @@ exception statement from your version. *
 #define _CLASSPATH_JVMTI_H
 #include jni.h
 
+#include jvmti_md.h
+
 /* The VM might define JVMTI base types */
 #ifndef _CLASSPATH_VM_JVMTI_TYPES_DEFINED
 


[commit-cp] classpath ChangeLog include/jvmti.h

2006-08-31 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/08/31 21:55:50

Modified files:
.  : ChangeLog 
include: jvmti.h 

Log message:
* include/jvmti.h: Include jvmti_md.h.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8482r2=1.8483
http://cvs.savannah.gnu.org/viewcvs/classpath/include/jvmti.h?cvsroot=classpathr1=1.3r2=1.4




Re: [cp-patches] [RFA/JVMTI] Add versioning information

2006-07-19 Thread Keith Seitz

Tom Tromey wrote:


This is fine.  IMO you don't need to ask for approval for future
additions, bug fixes, etc, to jvmti.h.


With any luck, this will be the only patch...

I've committed it.

Thanks,
Keith



[commit-cp] classpath ChangeLog include/jvmti.h

2006-07-19 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/07/19 23:29:30

Modified files:
.  : ChangeLog 
include: jvmti.h 

Log message:
* include/jvmti.h (JVMTI_VERSION_1_0): Define.
(JVMTI_VERSION): Define.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8169r2=1.8170
http://cvs.savannah.gnu.org/viewcvs/classpath/include/jvmti.h?cvsroot=classpathr1=1.1r2=1.2




Re: [cp-patches] [RFA] JVMTI

2006-07-15 Thread Keith Seitz

Tom Tromey wrote:

Keith == Keith Seitz [EMAIL PROTECTED] writes:


Keith The following patch adds jvmti.h to the classpath repository. It is
Keith very closely modeled on jni.h.

Looks great.  Please check it in.


With no further comments, I have committed this patch.

Thank you for taking a look at it, Tom!

Keith



[commit-cp] classpath ChangeLog NEWS doc/vmintegration.texi...

2006-07-15 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/07/15 17:26:12

Modified files:
.  : ChangeLog NEWS 
doc: vmintegration.texinfo 
Added files:
include: jvmti.h 

Log message:
* NEWS: Update for JVMTI and jvmti.h.
* doc/vmintegration.texinfo: Likewise.
* include/jvmti.h: New file.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8114r2=1.8115
http://cvs.savannah.gnu.org/viewcvs/classpath/NEWS?cvsroot=classpathr1=1.158r2=1.159
http://cvs.savannah.gnu.org/viewcvs/classpath/doc/vmintegration.texinfo?cvsroot=classpathr1=1.35r2=1.36
http://cvs.savannah.gnu.org/viewcvs/classpath/include/jvmti.h?cvsroot=classpathrev=1.1




Re: [cp-patches] [RFA] Fail configure if --enable-plugin and --disable-gtk-peer?

2006-06-17 Thread Keith Seitz

Paul Jenner wrote:

Hi Keith.

On Fri, 2006-06-16 at 15:09 -0700, Keith Seitz wrote:

Right now, the build fails if the user does:

$ ../classpath/configure --disable-gtk-peer


For info, this is also Classpath bug #27923 (caught me out too).


Ah, that looks like a better approach than what I did. I incorrectly 
assumed gtk-peers was needed. Not peers, just gtk.


Can someone look at Paul's patch in 27923: It is really quite small... 
Or suggest something better? This is a really big annoyance.


Keith



Re: [cp-patches] RFC JDWP ThreadOnlyFilter fix

2006-06-16 Thread Keith Seitz

Kyle Galloway wrote:
Small change to ThreadOnlyFilter to avoid a null pointer exception with 
null ThreadId.  Throws an invalid thread exception instead.


Sure. Thanks.

Keith



Re: [cp-patches] RFC JDWP Event Javadoc fixes

2006-06-16 Thread Keith Seitz

Kyle Galloway wrote:
This patch just fixes a repeated javadoc error in several of the JDWP 
Events.  Not sure if this needs to be approved by the list, but I 
figured I'd send it in anyway.


Please commit. For obvious things like this simple javadoc update (in 
JDWP, at least), just post your patch and changelog and check them in.


Keith



[cp-patches] [FYI] Delete ChangeLog CVS conflict markers

2006-06-16 Thread Keith Seitz

Hi,

Anyone else notice that there are CVS conflict markers in the ChangeLog?

cvs annotate shows:
1.7849   (tromey   16-Jun-06):  1.7848
1.7841   (rschuste 16-Jun-06):  1.7824
1.7841   (rschuste 16-Jun-06):  1.7799

I've deleted these lines and committed.

Tom and Robert: Would please you verify that your ChangeLog entries are 
correct around these markers?


Keith



Re: [cp-patches] RFC: JDWP startup synchronization (revisited)

2006-06-16 Thread Keith Seitz

Tom Tromey wrote:


I'm probably missing something, since it looks like your patch does
use wait/notify.


Oh, sorry. I wasn't clear. I meant wait/notify from the VM into JDWP, 
not within JDWP itself. (Calling jdwpThread-wait() would crash gij.)



I'm not overly concerned about the mechanics of how this works.  If
it doesn't satisfy some VM we can always revisit it.


Ok.


Keith + while (_initCount != 2)
Keith +   {
Keith + synchronized (_initLock)
Keith +   {
Keith + _initLock.wait ();
Keith +   }
Keith +   }

Probably put the synchronized around the loop instead of inside it,
so the _initCount check is synchronized.


Silly me. I've changed that and committed this patch.

Thank you for taking a moment to peek at this.

Keith



[cp-patches] [PATCH/JDWP] Move EventManager instantiation

2006-06-16 Thread Keith Seitz

Hi,

I've committed the following patch which changes how the EventManager is 
created. This was causing all kinds of nasty problems during startup 
with gij.


Keith

2006-06-16  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/event/EventManager.java (getDefault): Redo
instantiation so that EventManager is created when getDefault
is first called.
* gnu/classpath/jdwp/Jdwp.java (Thread): Force creation
of EventManager.
Index: gnu/classpath/jdwp/Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.7
diff -u -p -r1.7 Jdwp.java
--- gnu/classpath/jdwp/Jdwp.java	16 Jun 2006 18:32:48 -	1.7
+++ gnu/classpath/jdwp/Jdwp.java	16 Jun 2006 19:38:48 -
@@ -315,6 +315,13 @@ public class Jdwp
 	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;
   }
Index: gnu/classpath/jdwp/event/EventManager.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/EventManager.java,v
retrieving revision 1.4
diff -u -p -r1.4 EventManager.java
--- gnu/classpath/jdwp/event/EventManager.java	9 Mar 2006 23:18:29 -	1.4
+++ gnu/classpath/jdwp/event/EventManager.java	16 Jun 2006 19:38:49 -
@@ -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;
   }
 


[cp-patches] [RFA] Fail configure if --enable-plugin and --disable-gtk-peer?

2006-06-16 Thread Keith Seitz
: 
'gtk_message_dialog_format_secondary_text' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1093: error: 
'GTK_DIALOG' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1094: error: 
'GTK_STOCK_CANCEL' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1095: error: 
'GTK_RESPONSE_CANCEL' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1095: error: 
'gtk_dialog_add_button' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1098: error: 
'GTK_RESPONSE_OK' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1101: error: 
'GTK_RESPONSE_APPLY' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1102: error: 
'gtk_widget_grab_focus' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1104: error: 
'gtk_widget_show_all' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1105: error: 
'gtk_dialog_run' was not declared in this scope
../../../classpath/native/plugin/gcjwebplugin.cc:1106: error: 
'gtk_widget_destroy' was not declared in this scope

make[2]: *** [libgcjwebplugin_la-gcjwebplugin.lo] Error 1
make[2]: Leaving directory 
`/home/keiths/work/classpath/master/linux/native/plugin'

make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/keiths/work/classpath/master/linux/native'
make: *** [all-recursive] Error 1

Here's a simple patch for configure to fail if the user does this. While 
 I would really like for the build to just issue a warning and disable 
the plugin, I don't think that's particularly user friendly, but it 
would be easy enough to change.


Keith

ChangeLog
2006-06-16  Keith Seitz  [EMAIL PROTECTED]

* configure.ac: Fail if attempting to build gcjwebplugin without
GTK peers.

Index: configure.ac
===
RCS file: /sources/classpath/classpath/configure.ac,v
retrieving revision 1.162
diff -u -p -r1.162 configure.ac
--- configure.ac	15 Jun 2006 23:08:48 -	1.162
+++ configure.ac	16 Jun 2006 21:25:28 -
@@ -189,6 +189,9 @@ AC_ARG_ENABLE([plugin],
 *) COMPILE_PLUGIN=yes ;;
   esac],
   [COMPILE_PLUGIN=yes])
+if test x${COMPILE_PLUGIN} = xyes -a x${COMPILE_GTK_PEER} = xno; then
+AC_MSG_ERROR([gcjwebplugin requires --enable-gtk-peer])
+fi
 AM_CONDITIONAL(CREATE_PLUGIN, test x${COMPILE_PLUGIN} = xyes)
 
 dnl ---


[commit-cp] classpath ChangeLog gnu/classpath/jdwp/Jdwp.jav...

2006-06-16 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/16 18:32:49

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp: Jdwp.java 
gnu/classpath/jdwp/transport: JdwpConnection.java 
gnu/classpath/jdwp/processor: PacketProcessor.java 

Log message:
* gnu/classpath/jdwp/Jdwp.java (_initLock): New field.
(_initCount): New field.
(Jdwp): Don't set isDebugging until fully initialized.
(subcomponentInitialized): New method.
(run): Wait for PacketProcessor and JdwpConnection to
startup, then set isDebugging, and then let this thread
die.
* gnu/classpath/jdwp/transport/JdwpConnection.java
(run): Add synchronization notification.
* gnu/classpath/jdwp/processor/PacketProcessor.java
(run): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7851r2=1.7852
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/Jdwp.java?cvsroot=classpathr1=1.6r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java?cvsroot=classpathr1=1.5r2=1.6

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7851
retrieving revision 1.7852
diff -u -b -r1.7851 -r1.7852
--- ChangeLog   16 Jun 2006 18:28:45 -  1.7851
+++ ChangeLog   16 Jun 2006 18:32:48 -  1.7852
@@ -1,3 +1,17 @@
+2006-06-16  Keith Seitz  [EMAIL PROTECTED]
+
+   * gnu/classpath/jdwp/Jdwp.java (_initLock): New field.
+   (_initCount): New field.
+   (Jdwp): Don't set isDebugging until fully initialized.
+   (subcomponentInitialized): New method.
+   (run): Wait for PacketProcessor and JdwpConnection to
+   startup, then set isDebugging, and then let this thread
+   die.
+   * gnu/classpath/jdwp/transport/JdwpConnection.java
+   (run): Add synchronization notification.
+   * gnu/classpath/jdwp/processor/PacketProcessor.java
+   (run): Likewise.
+
 2006-06-16  Tom Tromey  [EMAIL PROTECTED]
 
* NEWS: Updated for JSR 166.

Index: gnu/classpath/jdwp/Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gnu/classpath/jdwp/Jdwp.java16 Mar 2006 23:26:10 -  1.6
+++ gnu/classpath/jdwp/Jdwp.java16 Jun 2006 18:32:48 -  1.7
@@ -56,6 +56,9 @@
 /**
  * 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 ([EMAIL PROTECTED])
  */
 public class Jdwp
@@ -65,7 +68,8 @@
   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 @@
   // 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,45 @@
   }
   }
 
+  /**
+   * 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);
   }
+
+// Now we are finally ready and initialized
+isDebugging = true;
   }
 
   // A helper function to process the configure string -Xrunjdwp:...

Index: gnu/classpath/jdwp/transport/JdwpConnection.java
===
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java,v

Re: [cp-patches] RFC Small fix to ExceptionOnlyFilter

2006-06-15 Thread Keith Seitz

Kyle Galloway wrote:
Small change to this filter to correct a logical bug that would occur 
when the Exception didn't match the filter and both caught and uncaught 
exceptions were selected.  Requesting approval so I can commit.


Doh! I totally missed that. Yes, please commit.

Keith



[cp-patches] RFC: JDWP startup synchronization (revisited)

2006-06-15 Thread Keith Seitz

Hello,

I would like to revisit this topic again. I don't know if anyone 
attempting to implement JDWP is having startup problems, but I certainly 
am with gij. Basically, we need to know exactly when the entire JDWP 
backend is ready to go, otherwise we end up trying to send event 
notifications before the debugger is attached and all kinds of other mess.


So I've come up with a rather hacky approach to do this synchronization. 
The idea is simple: gnu.classpath.jdwp.Jdwp, which already does 
initialization in its own thread, now contains basically a condition 
variable. When the condition variable hits a certain count (indicating 
that all subcomponents are initialized), the thread sets the global 
isDebugging flag, and exits. Thus the caller can simply join or 
WaitForSingleObject on that thread. When it exits, everything is ready.


While this *is* hacky (a thread exit doesn't really sound like a very 
explicit/obvious way of implementing this), but it is extremely simple. 
I tried using standard Object.wait-like stuff for this, but it seems 
to me that while this would be trivial to implement with gcj, it might 
be quite sloppy in other VMs which have to use JNI. [Besides I haven't 
gotten that to work properly with gij -- it seems I can't get 
something(s) set up sufficiently to allow Object.wait to be called.]


I've attached the patches for this scheme. What do people think? [I'll 
include a changelog entry for the heck of it, I guess.]


I would appreciate comments (for or against).

Keith

ChangeLog
2006-06-15  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/Jdwp.java (_initLock): New field.
(_initCount): New field.
(Jdwp): Don't set isDebugging until fully initialized.
(subcomponentInitialized): New method.
(run): Wait for PacketProcessor and JdwpConnection to
startup, then set isDebugging, and then let this thread
die.
* gnu/classpath/jdwp/transport/JdwpConnection.java
(run): Add synchronization notification.
* gnu/classpath/jdwp/processor/PacketProcessor.java
(run): Likewise.
Index: gnu/classpath/jdwp/Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.6
diff -u -p -r1.6 Jdwp.java
--- gnu/classpath/jdwp/Jdwp.java	16 Mar 2006 23:26:10 -	1.6
+++ gnu/classpath/jdwp/Jdwp.java	15 Jun 2006 22:00:34 -
@@ -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 ([EMAIL PROTECTED])
  */
 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,47 @@ 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. */
+	while (_initCount != 2)
+	  {
+	synchronized (_initLock)
+	  {
+		_initLock.wait ();
+	  }
+	  }
+	_initLock = null;
   }
 catch (Throwable t)
   {
 	System.out.println (Exception in JDWP back-end:  + t);
 	System.exit (1);
   }
+
+// Now we are finally ready and initialized
+isDebugging = true;
   }
 
   // A helper function to process the configure string -Xrunjdwp:...
Index: gnu/classpath/jdwp/transport/JdwpConnection.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java,v
retrieving revision 1.5
diff -u -p -r1.5 JdwpConnection.java
--- gnu/classpath/jdwp/transport/JdwpConnection.java	3 Sep 2005 00:22:30 -	1.5
+++ gnu/classpath/jdwp/transport/JdwpConnection.java	15 Jun 2006 22:00:34 -
@@ -1,5 +1,5 @@
 /* JdwpConnection.java -- A JDWP-speaking connection
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free

[cp-patches] Re: RFA JDWP ExceptionOnlyFilter

2006-06-13 Thread Keith Seitz

Kyle Galloway wrote:
The part that was removed upon commit actually introduced some logic 
changes to the constructor to allow it to filter on all exceptions.  
Here is another patch to correct the committed file.


2006-06-13  Kyle Galloway [EMAIL PROTECTED]

 * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: Changed
 the constructor to allow null to be passed signifying all exceptions
 should be allowed.


This change was not mentioned in the previous changelog, and I 
overlooked it entirely. Sorry.


I would trim your changelog comment to say something simple like Allow 
null refId. or some such and put the detailed explanation into a 
comment in the constructor's javadoc.





Index: ExceptionOnlyFilter.java
===
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java,v
retrieving revision 1.3
diff -u -r1.3 ExceptionOnlyFilter.java
--- ExceptionOnlyFilter.java12 Jun 2006 20:39:16 -  1.3
+++ ExceptionOnlyFilter.java13 Jun 2006 13:47:21 -
@@ -70,8 +70,8 @@
  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;


Aside from updating the javadoc to mention the null refId thing, this 
looks good.


Keith



[cp-patches] Re: RFA JDWP ClassUnloadEvent

2006-06-13 Thread Keith Seitz

Kyle Galloway wrote:
Ok, fixed that, I think this is probably the better way to do it, I 
hadn't though about when the event would get passed from the VM and this 
will work both ways.


I've committed this. Thanks.

Keith



[cp-patches] Re: RFA JDWP ExceptionOnlyFilter

2006-06-13 Thread Keith Seitz

Kyle Galloway wrote:

2006-06-13  Kyle Galloway [EMAIL PROTECTED]

* gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: Allow
   null refId.


Grr. I really hate to do this, but I just noticed... 
ExceptionOnlyFilter.matches doesn't handle the case where _refId is null.


Since you're updating ExceptionOnlyFilter to properly handle the all 
exceptions case, could you also update the matches method?


My bad,
Keith



Re: [cp-patches] RFA: JDWP BreakpointEvent

2006-06-13 Thread Keith Seitz

Kyle Galloway wrote:
Small fix for BreakpointEvent for filter compatibility. Requesting 
approval and commit.


- Kyle

2006-06-13  Kyle Galloway [EMAIL PROTECTED]

   * gnu/classpath/jdwp/event/BreakpointEvent.java : Added
   Object _instance for compatibility with filters.
   (getParameter): Modified to allow access to above.


Approved with one small addendum:


@@ -69,11 +72,12 @@
* @param thread  thread in which event occurred
* @param loc location where breakpoint occurred
*/
-  public BreakpointEvent(Thread thread, Location loc)
+  public BreakpointEvent(Thread thread, Location loc, Object instance)


Missing javadoc for instance parameter.

Keith



[cp-patches] Re: RFA JDWP ExceptionOnlyFilter

2006-06-13 Thread Keith Seitz

Kyle Galloway wrote:
Yeah, sorry, should have seen that before, I think when I changed the 
logic to compress it I may have destroyed that functionality.  Anyways 
fixed now.


Committed.

Keith



[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/Cl...

2006-06-13 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/13 15:17:08

Modified files:
.  : ChangeLog 
Added files:
gnu/classpath/jdwp/event: ClassUnloadEvent.java 

Log message:
From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/ClassUnloadEvent.java: New file.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7797r2=1.7798
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/ClassUnloadEvent.java?cvsroot=classpathrev=1.1

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7797
retrieving revision 1.7798
diff -u -b -r1.7797 -r1.7798
--- ChangeLog   13 Jun 2006 15:10:36 -  1.7797
+++ ChangeLog   13 Jun 2006 15:17:07 -  1.7798
@@ -1,3 +1,8 @@
+2006-06-13  Keith Seitz  [EMAIL PROTECTED]
+
+   From Kyle Galloway  [EMAIL PROTECTED]:
+   * gnu/classpath/jdwp/event/ClassUnloadEvent.java: New file.
+
 2006-06-13  David Gilbert  [EMAIL PROTECTED]
 
* javax/swing/plaf/basic/BasicSliderUI.java

Index: gnu/classpath/jdwp/event/ClassUnloadEvent.java
===
RCS file: gnu/classpath/jdwp/event/ClassUnloadEvent.java
diff -N gnu/classpath/jdwp/event/ClassUnloadEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/ClassUnloadEvent.java  13 Jun 2006 15:17:08 
-  1.1
@@ -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 ([EMAIL PROTECTED])
+ */
+public class ClassUnloadEvent
+extends Event
+{
+  //signature directly from VM
+  private String _signature;
+
+  /**
+   * Constructs a new codeClassUnloadEvent/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 codenull/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);
+  }
+
+}




[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/Br...

2006-06-13 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/13 18:08:21

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/event: BreakpointEvent.java 
gnu/classpath/jdwp/event/filters: ExceptionOnlyFilter.java 

Log message:
From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
(ExceptionOnlyFilter): Allow null refId.

* gnu/classpath/jdwp/event/BreakpointEvent.java: Added 
_instance for
compatibility with filters.
(getParameter): Modified to allow access to above.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7799r2=1.7800
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java?cvsroot=classpathr1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java?cvsroot=classpathr1=1.3r2=1.4

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7799
retrieving revision 1.7800
diff -u -b -r1.7799 -r1.7800
--- ChangeLog   13 Jun 2006 15:59:35 -  1.7799
+++ ChangeLog   13 Jun 2006 18:08:20 -  1.7800
@@ -1,3 +1,13 @@
+2006-06-13  Keith Seitz  [EMAIL PROTECTED]
+
+   From Kyle Galloway  [EMAIL PROTECTED]:
+   * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
+   (ExceptionOnlyFilter): Allow null refId.
+
+   * gnu/classpath/jdwp/event/BreakpointEvent.java: Added _instance for
+   compatibility with filters.
+   (getParameter): Modified to allow access to above. 
+
 2006-06-13  Sven de Marothy  [EMAIL PROTECTED]
 
* gnu/java/awt/peer/gtk/CairoSurface.java

Index: gnu/classpath/jdwp/event/BreakpointEvent.java
===
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gnu/classpath/jdwp/event/BreakpointEvent.java   12 Jun 2006 19:43:26 
-  1.2
+++ gnu/classpath/jdwp/event/BreakpointEvent.java   13 Jun 2006 18:08:21 
-  1.3
@@ -63,17 +63,22 @@
   // 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;
   }
 
   /**
@@ -89,6 +94,8 @@
   return _thread;
 else if (type == EVENT_LOCATION)
   return _location;
+else if (type == EVENT_INSTANCE)
+  return _instance;
 
 return null;
   }

Index: gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
===
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java   12 Jun 2006 
20:39:16 -  1.3
+++ gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java   13 Jun 2006 
18:08:21 -  1.4
@@ -61,7 +61,7 @@
   /**
* 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  caughtReport caught exceptions
* @param  uncaught  Report uncaught exceptions
* @throws InvalidClassException if refid is invalid
@@ -70,8 +70,8 @@
  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;
@@ -96,21 +96,28 @@
*/
   public boolean matches(Event event)
   {
-boolean classMatch;
+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);
+Class klass 
+  = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS);
 classMatch = klass == _refId.getType();
   }
 catch (InvalidClassException ex)
   {
 classMatch = false

Re: [cp-patches] RFC: New events for JDWP and small changes to Event internals

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:
I've made changes to fix problems with the patch and the changelog.  
This patch contains only the changes related to the change in Event.

Requesting approval and a commit.


Approved and committed.

Keith



[cp-patches] Re: RFA: JDWP ExceptionEvent

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:
Broke my previous patch into smaller patches(more to come) and fixed 
some minor issues.  This patch adds one event(ExceptionEvent).  
Requesting approval and a commit.


Approved and committed.

Keith



[cp-patches] Re: RFA JDWP MethodEntryEvent

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:

+  /**
+   * 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;
+
+return null;
+  }


I think something is missing. Can't this event be filtered using the 
Class*Filters? If so, EVENT_CLASS needs to be added to this...


Keith



[cp-patches] Re: RFA JDWP MethodExitEvent

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:


+  /**
+   * 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;
+
+return null;
+  }


Same thing as MethodEntry, I think: EVENT_CLASS needs to be added.

Keith



Re: [cp-patches] RFA JDWP SingleStepEvent

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:


+  /**
+   * 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;
+
+return null;
+  }



I think this is the same as Method*Events: EVENT_CLASS needs to be 
added. [Although I admit, it is silly. No one would ever do that.]


But, hey, I didn't write the spec. :-)

Keith



[cp-patches] Re: RFA JDWP ExceptionOnlyFilter

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:


2006-06-12  Kyle Galloway [EMAIL PROTECTED]

  * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
  (forCaught): removed useless accessor method
  (forUncaught): removed useless accessor method
  (matches): Implemented


This is approved with some slight modifications, which I've done for 
you: whack gratuitous whitespace changes, and wrap to 80 columns. I've 
attached what I've actually committed.


Keith
Index: gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java,v
retrieving revision 1.2
diff -u -p -r1.2 ExceptionOnlyFilter.java
--- gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java	9 Mar 2006 23:18:29 -	1.2
+++ gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java	12 Jun 2006 20:31:56 -
@@ -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.
 
@@ -88,34 +88,29 @@ 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 codeEvent/code to scrutinize
*/
-  public boolean matches (Event event)
+  public boolean matches(Event event)
   {
-// FIXME
-throw new RuntimeException (ExceptionOnlyFilter.matches not implemented);
+boolean classMatch;
+
+try
+  {
+	Class klass = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS);
+classMatch = klass == _refId.getType();
+  }
+catch (InvalidClassException ex)
+  {
+classMatch = false;
+  }
+
+Boolean caught
+  = (Boolean) event.getParameter(Event.EVENT_EXCEPTION_CAUGHT);
+
+return classMatch  (caught.booleanValue()) ? _caught : _uncaught;
   }
 }


[cp-patches] Re: RFA JDWP ClassUnloadEvent

2006-06-12 Thread Keith Seitz

Some questions about this...

Kyle Galloway wrote:


+  /**
+   * Constructs a new codeClassUnloadEvent/code
+   * 
+   * @param clazz class which was prepared

+   */
+  public ClassUnloadEvent(Class clazz)
+  {
+super(JdwpConstants.EventKind.CLASS_UNLOAD);
+_class = clazz;
+  }


Do you intend for this event to be generated just before the class is 
unloaded or just after? If after, the class's Class object will be gone, 
and this constructor cannot be used. If the constructor is going to take 
a Class argument, it should be documented that you expect this 
notification to happen just before the type is unloaded. [more on this 
later]



+  /**
+   * 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();
+ReferenceTypeId rid = idm.getReferenceTypeId(_class);
+
+rid.writeTagged(outStream);
+JdwpString.writeString(outStream, Signature.computeClassSignature(_class));
+  }
+
+}


I don't think we output the reference type id -- just the type's signature.

Back to the notification before/after the unload issue: I think we're 
probably safest just getting the type signature (as a String) from the 
VM instead of the Class object. That way, it won't matter whether the 
class has actually been unloaded or whether it is about to be.


Keith



[cp-patches] Re: RFA JDWP MethodExitEvent

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:

This one's fixed as well


And checked-in as well.

Keith



[cp-patches] Re: RFA JDWP MethodEntryEvent

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:

Fixed that, wow must have been half asleep this morning..


Thanks! I've checked this in.

Keith



Re: [cp-patches] RFA JDWP SingleStepEvent

2006-06-12 Thread Keith Seitz

Kyle Galloway wrote:

Fixed it here as well.


Excellent. Committed.

Keith



[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/Ev...

2006-06-12 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/12 19:43:26

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/event: Event.java BreakpointEvent.java 
  ClassPrepareEvent.java 
  ThreadEndEvent.java 
  ThreadStartEvent.java 
  VmDeathEvent.java VmInitEvent.java 
gnu/classpath/jdwp/event/filters: ClassMatchFilter.java 
  ClassOnlyFilter.java 
  InstanceOnlyFilter.java 
  ThreadOnlyFilter.java 

Log message:
From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/Event.java: Added constants for
type.
(getParameter): Changed parameter type from Class to int.
* gnu/classpath/jdwp/event/BreakpointEvent.java (getParameter):
Changed from Class type to constants.
* gnu/classpath/jdwp/event/ClassPrepareEventEvent.java 
(getParameter):
Likewise.
* gnu/classpath/jdwp/event/ThreadEndEvent.java (getParameter):
Likewise.
* gnu/classpath/jdwp/event/ThreadStartEvent.java (getParameter):
Likewise.
* gnu/classpath/jdwp/event/VmDeathEvent.java (getParameter):
Likewise.
* gnu/classpath/jdwp/event/VmInitEvent.java (getParameter):
Likewise.
* gnu/classpath/jdwp/event/ClassMatchFilter.java (matches):
Likewise.
* gnu/classpath/jdwp/event/ClassOnlyFilter.java (matches):
Likewise.
* gnu/classpath/jdwp/event/InstanceOnlyFilter.java (matches):
Likewise.
* gnu/classpath/jdwp/event/ThreadOnlyFilter.java (matches):
Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7784r2=1.7785
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/Event.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java?cvsroot=classpathr1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java?cvsroot=classpathr1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/VmInitEvent.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java?cvsroot=classpathr1=1.3r2=1.4

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7784
retrieving revision 1.7785
diff -u -b -r1.7784 -r1.7785
--- ChangeLog   12 Jun 2006 18:58:30 -  1.7784
+++ ChangeLog   12 Jun 2006 19:43:25 -  1.7785
@@ -1,3 +1,30 @@
+2006-06-12  Keith Seitz  [EMAIL PROTECTED]
+
+   From Kyle Galloway  [EMAIL PROTECTED]:
+   * gnu/classpath/jdwp/event/Event.java: Added constants for
+   type.
+   (getParameter): Changed parameter type from Class to int.
+   * gnu/classpath/jdwp/event/BreakpointEvent.java (getParameter):
+   Changed from Class type to constants.
+   * gnu/classpath/jdwp/event/ClassPrepareEventEvent.java (getParameter):
+   Likewise.
+   * gnu/classpath/jdwp/event/ThreadEndEvent.java (getParameter):
+   Likewise.
+   * gnu/classpath/jdwp/event/ThreadStartEvent.java (getParameter):
+   Likewise.
+   * gnu/classpath/jdwp/event/VmDeathEvent.java (getParameter):
+   Likewise.
+   * gnu/classpath/jdwp/event/VmInitEvent.java (getParameter):
+   Likewise.
+   * gnu/classpath/jdwp/event/ClassMatchFilter.java (matches):
+   Likewise.
+   * gnu/classpath/jdwp/event/ClassOnlyFilter.java (matches):
+   Likewise.
+   * gnu/classpath/jdwp/event/InstanceOnlyFilter.java (matches):
+   Likewise.
+   * gnu/classpath/jdwp/event

[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/Ex...

2006-06-12 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/12 19:59:43

Modified files:
.  : ChangeLog 
Added files:
gnu/classpath/jdwp/event: ExceptionEvent.java 

Log message:
From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/ExceptionEvent.java: New file.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7785r2=1.7786
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java?cvsroot=classpathrev=1.1

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7785
retrieving revision 1.7786
diff -u -b -r1.7785 -r1.7786
--- ChangeLog   12 Jun 2006 19:43:25 -  1.7785
+++ ChangeLog   12 Jun 2006 19:59:43 -  1.7786
@@ -1,6 +1,11 @@
 2006-06-12  Keith Seitz  [EMAIL PROTECTED]
 
From Kyle Galloway  [EMAIL PROTECTED]:
+   * gnu/classpath/jdwp/event/ExceptionEvent.java: New file.
+
+2006-06-12  Keith Seitz  [EMAIL PROTECTED]
+
+   From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/Event.java: Added constants for
type.
(getParameter): Changed parameter type from Class to int.

Index: gnu/classpath/jdwp/event/ExceptionEvent.java
===
RCS file: gnu/classpath/jdwp/event/ExceptionEvent.java
diff -N gnu/classpath/jdwp/event/ExceptionEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/ExceptionEvent.java12 Jun 2006 19:59:43 
-  1.1
@@ -0,0 +1,143 @@
+/* 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 ([EMAIL PROTECTED])
+ */
+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;
+
+  /**
+   * Constructs a new codeExceptionEvent/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
+   */
+  public ExceptionEvent(Throwable exception, Thread thread, Location location,
+Location

[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/fi...

2006-06-12 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/12 20:39:16

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/event/filters: ExceptionOnlyFilter.java 

Log message:
From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
(forCaught): Removed unused/unnecessary method.
(forUncaught): Likewise.
(matches): Implement.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7786r2=1.7787
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java?cvsroot=classpathr1=1.2r2=1.3

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7786
retrieving revision 1.7787
diff -u -b -r1.7786 -r1.7787
--- ChangeLog   12 Jun 2006 19:59:43 -  1.7786
+++ ChangeLog   12 Jun 2006 20:39:15 -  1.7787
@@ -1,6 +1,14 @@
 2006-06-12  Keith Seitz  [EMAIL PROTECTED]
 
From Kyle Galloway  [EMAIL PROTECTED]:
+   * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
+   (forCaught): Removed unused/unnecessary method.
+   (forUncaught): Likewise.
+   (matches): Implement.
+
+2006-06-12  Keith Seitz  [EMAIL PROTECTED]
+
+   From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/ExceptionEvent.java: New file.
 
 2006-06-12  Keith Seitz  [EMAIL PROTECTED]

Index: gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java
===
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java   9 Mar 2006 
23:18:29 -   1.2
+++ gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java   12 Jun 2006 
20:39:16 -  1.3
@@ -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.
 
@@ -88,34 +88,29 @@
 return _refId;
   }
 
+  
   /**
-   * Report caught exceptions?
+   * Does the given event match the filter?
*
-   * @return whether to report caught exceptions
+   * @param event  the codeEvent/code to scrutinize
*/
-  public boolean forCaught ()
+  public boolean matches(Event event)
   {
-return _caught;
-  }
+boolean classMatch;
 
-  /**
-   * Report uncaught exceptions?
-   *
-   * @return whether to report uncaught exceptions
-   */
-  public boolean forUncaught ()
+try
   {
-return _uncaught;
+   Class klass = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS);
+classMatch = klass == _refId.getType();
   }
-
-  /**
-   * Does the given event match the filter?
-   *
-   * @param event  the codeEvent/code to scrutinize
-   */
-  public boolean matches (Event event)
+catch (InvalidClassException ex)
   {
-// FIXME
-throw new RuntimeException (ExceptionOnlyFilter.matches not implemented);
+classMatch = false;
+  }
+
+Boolean caught
+  = (Boolean) event.getParameter(Event.EVENT_EXCEPTION_CAUGHT);
+
+return classMatch  (caught.booleanValue()) ? _caught : _uncaught;
   }
 }




[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/Me...

2006-06-12 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/12 21:25:14

Modified files:
.  : ChangeLog 
Added files:
gnu/classpath/jdwp/event: MethodEntryEvent.java 
  MethodExitEvent.java 

Log message:
From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/MethodEntryEvent.java: New file.

* gnu/classpath/jdwp/event/MethodExitEvent.java: New file.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7789r2=1.7790
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/MethodEntryEvent.java?cvsroot=classpathrev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/MethodExitEvent.java?cvsroot=classpathrev=1.1

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7789
retrieving revision 1.7790
diff -u -b -r1.7789 -r1.7790
--- ChangeLog   12 Jun 2006 21:14:48 -  1.7789
+++ ChangeLog   12 Jun 2006 21:25:14 -  1.7790
@@ -1,3 +1,10 @@
+2006-06-12  Keith Seitz  [EMAIL PROTECTED]
+
+   From Kyle Galloway  [EMAIL PROTECTED]:
+   * gnu/classpath/jdwp/event/MethodEntryEvent.java: New file.
+
+   * gnu/classpath/jdwp/event/MethodExitEvent.java: New file.
+
 2006-06-12  Roman Kennke  [EMAIL PROTECTED]
 
* javax/swing/JComponent.java

Index: gnu/classpath/jdwp/event/MethodEntryEvent.java
===
RCS file: gnu/classpath/jdwp/event/MethodEntryEvent.java
diff -N gnu/classpath/jdwp/event/MethodEntryEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/MethodEntryEvent.java  12 Jun 2006 21:25:14 
-  1.1
@@ -0,0 +1,117 @@
+/* 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 ([EMAIL PROTECTED])
+ */
+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 codeMethodEntryEvent/code
+   * 
+   * @param thread the thread where the exception occurred
+   * @param location the location single stepped to
+   */
+  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

[commit-cp] classpath ChangeLog gnu/classpath/jdwp/event/Si...

2006-06-12 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Keith Seitz keiths06/06/12 21:29:39

Modified files:
.  : ChangeLog 
Added files:
gnu/classpath/jdwp/event: SingleStepEvent.java 

Log message:
From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/SingleStepEvent.java: New file.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.7790r2=1.7791
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/classpath/jdwp/event/SingleStepEvent.java?cvsroot=classpathrev=1.1

Patches:
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7790
retrieving revision 1.7791
diff -u -b -r1.7790 -r1.7791
--- ChangeLog   12 Jun 2006 21:25:14 -  1.7790
+++ ChangeLog   12 Jun 2006 21:29:38 -  1.7791
@@ -1,6 +1,11 @@
 2006-06-12  Keith Seitz  [EMAIL PROTECTED]
 
From Kyle Galloway  [EMAIL PROTECTED]:
+   * gnu/classpath/jdwp/event/SingleStepEvent.java: New file.
+
+2006-06-12  Keith Seitz  [EMAIL PROTECTED]
+
+   From Kyle Galloway  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/event/MethodEntryEvent.java: New file.
 
* gnu/classpath/jdwp/event/MethodExitEvent.java: New file.

Index: gnu/classpath/jdwp/event/SingleStepEvent.java
===
RCS file: gnu/classpath/jdwp/event/SingleStepEvent.java
diff -N gnu/classpath/jdwp/event/SingleStepEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/SingleStepEvent.java   12 Jun 2006 21:29:39 
-  1.1
@@ -0,0 +1,120 @@
+/* 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 ([EMAIL PROTECTED])
+ */
+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 codeSingleStepEvent/code
+   * 
+   * @param thread the thread where the exception occurred
+   * @param location the location single stepped to
+   */
+  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

Re: [cp-patches] RFC: New events for JDWP and small changes to Event internals

2006-06-09 Thread Keith Seitz

Kyle Galloway wrote:

ChangeLog:
2006-06-09   Kyle Galloway   [EMAIL PROTECTED]

   * gnu/classpath/jdwp/event/BreakpointEvent.java: Added Object
   _instance for filter compatibility
   * gnu/classpath/jdwp/event/BreakpointEvent.java(getParameter):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/ClassPrepareEventEvent.java(getParameter):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/Event.java: Added constants for
   type and changed the abstract method getParameters to match
   * gnu/classpath/jdwp/event/ThreadEndEvent.java(getParameter):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/ThreadStartEvent.java(getParameter):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/VmDeathEvent.java(getParameter):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/VmInitEvent.java(getParameter):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/ClassMatchFilter.java(matches):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/ClassOnlyFilter.java(matches):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/InstanceOnlyFilter.java(matches):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/ThreadOnlyFilter.java(matches):
   changed from Class type to constants
   * gnu/classpath/jdwp/event/ExceptionEvent.java: New file


Need a space between filename and methods in changelog entries. 
nitpickAlso a blank line between the last entry, since it is not 
related to those above it./nitpick


All the Event changes to getParameter are approved. [Boy, don't we wish 
we could finally use an enum!]



Index: gnu/classpath/jdwp/event/ExceptionEvent.java
===
RCS file: gnu/classpath/jdwp/event/ExceptionEvent.java
diff -N gnu/classpath/jdwp/event/ExceptionEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/ExceptionEvent.java1 Jan 1970 00:00:00 
-


[snip]


+package gnu.classpath.jdwp.event;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.id.ThreadId;
+import gnu.classpath.jdwp.util.Location;
+import gnu.classpath.jdwp.id.ObjectId;


Okay, this is kinda nit-pickity, but it *is* in the classpath hacker's 
guide: ObjectId is out of alphabetical order.



+  /**
+   * Writes the event to the given stream
+   * 
+   * @param outStream the output stream to write the event to

+   */


Missing @throws in javadoc. I'm probably very guilty of forgetting this 
a lot, too.



+  protected void _writeData(DataOutputStream outStream) throws IOException


throws should be on next line.

Otherwise it looks good. Got a savannah account yet?


Keith



Re: [cp-patches] RFC: JDWP ExceptionOnlyFilter

2006-06-09 Thread Keith Seitz

Kyle Galloway wrote:

Here is a patch to complete the functionality of this filter.


So that everyone knows, I've emailed Kyle privately about this patch, 
and I think he's going to submit a new patch for this (mainly without 
all the whitespace diffs).


Kyle feel free to correct me if I am mistaken. :-)

Keith



Re: [cp-patches] RFC: 3 more JDWP events

2006-06-09 Thread Keith Seitz

Kyle Galloway wrote:

A few nits, mainly typos and other frivolity.


Index: gnu/classpath/jdwp/event/MethodEntryEvent.java
===
RCS file: gnu/classpath/jdwp/event/MethodEntryEvent.java
diff -N gnu/classpath/jdwp/event/MethodEntryEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/MethodEntryEvent.java  1 Jan 1970 00:00:00 
-
@@ -0,0 +1,113 @@
+/* MethodEntryEvent.java -- n event specifying that a method has been invoked


typo


+/**
+ * Notification from the VM that that a method has been invoked
+ * 
+ * @author Kyle Galloway ([EMAIL PROTECTED])

+ */
+public class MethodEntryEvent
+extends Event
+{
+  // The thread where the event occurred
+  Thread _thread;
+
+  // the location where the event occurred
+  Location _location;
+
+  //object instance
+  Object _instance;


Should these be private?


+  /**
+   * Writes the event to the given stream
+   * 
+   * @param outStream the output stream to write the event to

+   */
+  protected void _writeData(DataOutputStream outStream) throws IOException


The throws thing again.


Index: gnu/classpath/jdwp/event/MethodExitEvent.java
===
RCS file: gnu/classpath/jdwp/event/MethodExitEvent.java
diff -N gnu/classpath/jdwp/event/MethodExitEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/MethodExitEvent.java   1 Jan 1970 00:00:00 
-
@@ -0,0 +1,110 @@
+/* MethodExitEvent.java -- n event specifying that a method has returned


Same typo :-)


+/**
+ * Notification from the VM that that a method has returned
+ * 
+ * @author Kyle Galloway ([EMAIL PROTECTED])

+ */
+public class MethodExitEvent
+extends Event
+{
+  // The thread where the event occurred
+  Thread _thread;
+
+  // the location where the event occurred
+  Location _location;
+
+  // object instance
+  Object _instance;


Same visibility question: private?



+  /**
+   * Writes the event to the given stream
+   * 
+   * @param outStream the output stream to write the event to

+   */
+  protected void _writeData(DataOutputStream outStream) throws IOException


:-)


Index: gnu/classpath/jdwp/event/SingleStepEvent.java
===
RCS file: gnu/classpath/jdwp/event/SingleStepEvent.java
diff -N gnu/classpath/jdwp/event/SingleStepEvent.java
--- /dev/null   1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/SingleStepEvent.java   1 Jan 1970 00:00:00 
-
@@ -0,0 +1,113 @@
+/**
+ * Notification from the VM that a single step has compleated including the
+ * thread and location stepped to
+ * 
+ * @author Kyle Galloway ([EMAIL PROTECTED])

+ */
+public class SingleStepEvent
+extends Event
+{
+  // the thread where the event occurred
+  Thread _thread;
+
+  // the location where the event occurred
+  Location _location;
+
+  //object instance
+  Object _instance;


Visibility again...


+  /**
+   * 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;
+
+return null;
+  }


Missing EVENT_INSTANCE? [Not that any debugger on the planet would ever 
use modifiers with a single step other than depth...]



+  /**
+   * Writes the event to the given stream
+   * 
+   * @param outStream the output stream to write the event to

+   */
+  protected void _writeData(DataOutputStream outStream) throws IOException


:-)

Otherwise, all looks good.

Keith



Re: [cp-patches] RFC: New events for JDWP

2006-06-08 Thread Keith Seitz

Kyle Galloway wrote:


ChangeLog:

2006-06-08   Kyle Galloway   [EMAIL PROTECTED]

   *gnu/classpath/jdwp/event/ExceptionEvent.java: New File.
   *gnu/classpath/jdwp/event/MethodEntryEvent.java: New File.
   *gnu/classpath/jdwp/event/MethodExitEvent.java: New File.
   *gnu/classpath/jdwp/event/SingleStepEvent.java: New File.


Need space between * and filename.

In general, all these things look quite good. They all share one major 
problem, though, I think: event filtering. According to my handy-dandy 
table of possible filters for events, ExceptionEvent, Method*Event, and 
SingleStepEvent can all be filtered using: CountFilter, 
ThreadOnlyFilter, ClassOnlyFilter, ClassMatchFilter, ClassExcludeFilter, 
LocationOnlyFilter, and InstanceOnlyFilter. [SingleStep can use one 
more, but that would not be part of this event class, I think.]


All I think you need to do is add an Object to the constructors of all 
of these that can be returned from getParameters. [Hmm. I don't think 
InstanceOnlyFilter is right, either. It should be able to use 
getParameter(Object.class) I think.]


The only other comment is that ExceptionEvents cannot be filtered by 
their caught locations: this location is only used for reporting it to 
the deubgger. So just drop all of that extra stuff.


Keith



Re: [cp-patches] jdwp processor bugfixes

2006-06-01 Thread Keith Seitz

Martin wrote:

Keith Seitz wrote:


No, I do not have write access to the classpath CVS.



I can commit for you.


I have committed your changes. Thanks for the patches!

Keith



[commit-cp] classpath ./ChangeLog gnu/classpath/jdwp/proces...

2006-06-01 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/06/02 01:04:24

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/processor: EventRequestCommandSet.java 
  ThreadGroupReferenceCommandSet.java 
  ClassTypeCommandSet.java 

Log message:
From Martin Platter  [EMAIL PROTECTED]:
* gnu/classpath/jdwp/processor/EventRequestCommandSet.java
(executeSet): Fix buffer underflow reading reference ID.
* gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
(executeParent): Fix  NPE if ThreadGroup is top-level ThreadGroup.
* gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
(executeSuperclass): Handle case of Object with ID zero.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.7629tr2=1.7630r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java.diff?tr1=1.4tr2=1.5r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java.diff?tr1=1.3tr2=1.4r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java.diff?tr1=1.5tr2=1.6r1=textr2=text




Re: [cp-patches] jdwp processor bugfixes

2006-05-27 Thread Keith Seitz

Martin wrote:

I have discovered two bugs in EventRequestCommandSet and 
ThreadGroupReferenceCommandSet.

In the attachment there is a patch to fix them.


I don't know if my say is needed for approval or whatnot, but FWIW these 
patches are correct. If you don't have CVS access, let me know and I 
will commit for you.


ChangeLog entry?
Keith



[cp-patches] [PATCH/JDWP] JDWP ThreadGroup thinkos

2006-03-16 Thread Keith Seitz

Hi,

This patch corrects two thinkos in VMVirtualMachine concerning thread 
suspension. First, the original code was using 
Thread.currentThread().getThreadGroup() as the JDWP thread group. This 
is obviously wrong in the case of event notifications, where the 
underlying executing thread is actually a user thread, not a JDWP 
thread. Second, we were always suspending the current thread. This 
should not be the case (once again) when the thread is part of the JDWP 
thread group, which it could be if the debugger requested the suspension 
of all threads.


The attached patch corrects these problems.
Keith

2006-03-16  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/Jdwp.java (getJdwpThreadGroup): New method.
* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
(suspendAllThreads): Use Jdwp.getJdwpThreadGroup.
Don't suspend the current thread unless it is not part of the
JDWP thread group.
Index: gnu/classpath/jdwp/Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.4
diff -u -r1.4 Jdwp.java
--- gnu/classpath/jdwp/Jdwp.java	9 Mar 2006 19:49:59 -	1.4
+++ gnu/classpath/jdwp/Jdwp.java	16 Mar 2006 20:50:47 -
@@ -112,6 +112,16 @@
   }
 
   /**
+   * Get the thread group used by JDWP threads
+   * 
+   * @return the thread group
+   */
+  public ThreadGroup getJdwpThreadGroup()
+  {
+return _group;
+  }
+  
+  /**
* Should the virtual machine suspend on startup?
*/
   public static boolean suspendOnStartup ()
Index: vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
===
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java,v
retrieving revision 1.6
diff -u -r1.6 VMVirtualMachine.java
--- vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	10 Mar 2006 00:14:05 -	1.6
+++ vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	16 Mar 2006 20:51:01 -
@@ -73,7 +73,7 @@
   {
 // Our JDWP thread group -- don't suspend any of those threads
 Thread current = Thread.currentThread ();
-ThreadGroup jdwpGroup = current.getThreadGroup ();
+ThreadGroup jdwpGroup = Jdwp.getDefault().getJdwpThreadGroup();
 
 // Find the root ThreadGroup
 ThreadGroup group = jdwpGroup;
@@ -105,7 +105,8 @@
   }
 
 // Now suspend the current thread
-suspendThread (current);
+if (current.getThreadGroup() != jdwpGroup)
+  suspendThread (current);
   }
 
   /**


[cp-patches] [PATCH/JDWP] Remove _mainThread from gnu.classpath.jdwp.Jdwp

2006-03-16 Thread Keith Seitz

Hi,

This is the final cleanup for a while (startup synchronization aside). 
It simply removes the whole main thread notion from JDWP. Instead, the 
VM will handle this when sending VM_INIT. [Aka: I changed my mind!]


Keith

ChangeLog
2006-03-16  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/Jdwp.java (_mainThread): Not needed. Removed
all references.
(run): Remove catch clause for InterruptedException. It is no
longer necessary.
Index: Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.5
diff -u -r1.5 Jdwp.java
--- Jdwp.java	16 Mar 2006 21:06:08 -	1.5
+++ Jdwp.java	16 Mar 2006 23:03:01 -
@@ -80,9 +80,6 @@
   // (-Xrunjdwp:..suspend=boolean)
   private static final String _PROPERTY_SUSPEND = suspend;
 
-  // User's main application thread
-  private Thread _mainThread;
-
   // Connection to debugger
   private JdwpConnection _connection;
 
@@ -141,11 +138,9 @@
* Configures the back-end
*
* @param configArgs  a string of configury options
-   * @param mainThread  the main application thread
*/
-  public void configure (String configArgs, Thread mainThread)
+  public void configure (String configArgs)
   {
-_mainThread = mainThread;
 _processConfigury (configArgs);
   }
 
@@ -281,17 +276,6 @@
 try
   {
 	_doInitialization ();
-
-	_mainThread.start ();
-
-	_mainThread.join ();
-  }
-catch (InterruptedException ie)
-  {
-	/* Shutting down. If we're in server mode, we should
-	   prepare for a new connection. Otherwise, we should
-	   simply exit. */
-	// FIXME
   }
 catch (Throwable t)
   {


[commit-cp] classpath gnu/classpath/jdwp/Jdwp.java ./Change...

2006-03-16 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/03/16 21:06:09

Modified files:
gnu/classpath/jdwp: Jdwp.java 
.  : ChangeLog 
vm/reference/gnu/classpath/jdwp: VMVirtualMachine.java 

Log message:
* gnu/classpath/jdwp/Jdwp.java (getJdwpThreadGroup): New method.
* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
(suspendAllThreads): Use Jdwp.getJdwpThreadGroup.
Don't suspend the current thread unless it is not part of the JDWP
thread group.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/Jdwp.java.diff?tr1=1.4tr2=1.5r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6769tr2=1.6770r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java.diff?tr1=1.6tr2=1.7r1=textr2=text




[commit-cp] classpath gnu/classpath/jdwp/Jdwp.java ./ChangeLog

2006-03-16 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/03/16 23:26:10

Modified files:
gnu/classpath/jdwp: Jdwp.java 
.  : ChangeLog 

Log message:
* gnu/classpath/jdwp/Jdwp.java (_mainThread): Not needed. Removed
all references.
(run): Remove catch clause for InterruptedException. It is no
longer necessary.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/Jdwp.java.diff?tr1=1.5tr2=1.6r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6771tr2=1.6772r1=textr2=text




[commit-cp] classpath gnu/classpath/jdwp/event/filters/Loca...

2006-03-16 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/03/15 23:45:56

Modified files:
gnu/classpath/jdwp/event/filters: LocationOnlyFilter.java 
.  : ChangeLog 

Log message:
* gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java:
Update javadoc.
(matches): Implement.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java.diff?tr1=1.1tr2=1.2r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6750tr2=1.6751r1=textr2=text




[cp-patches] [PATCH/JDWP] BreakpointEvent NativeMethodException

2006-03-15 Thread Keith Seitz

Hi,

I've committed the following two files which simply add two classes 
needed for breakpoints.


Keith

ChangeLog
2006-03-15  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/event/BreakpointEvent.java: New file.

* gnu/classpath/jdwp/exception/NativeMethodException.java: New 
file.
Index: gnu/classpath/jdwp/event/BreakpointEvent.java
===
RCS file: gnu/classpath/jdwp/event/BreakpointEvent.java
diff -N gnu/classpath/jdwp/event/BreakpointEvent.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/BreakpointEvent.java	1 Jan 1970 00:00:00 -
@@ -0,0 +1,110 @@
+/* BreakpointEvent.java -- An event specifying that the interpreter
+   has hit a breakpoint
+   Copyright (C) 2006 Free Software Foundation
+
+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
+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 of a breakpoint in the target VM. The breakpoint event is
+ * generated before the code at its location is executed.
+ *
+ * @author Keith Seitz  ([EMAIL PROTECTED])
+ */
+public class BreakpointEvent
+  extends Event
+{
+  // The thread in which this event occurred
+  private Thread _thread;
+
+  // Location where breakpoint occurred
+  private Location _location;
+
+  /**
+   * Constructs a new BreakpointEvent
+   *
+   * @param thread  thread in which event occurred
+   * @param loc location where breakpoint occurred
+   */
+  public BreakpointEvent(Thread thread, Location loc)
+  {
+super(JdwpConstants.EventKind.BREAKPOINT);
+_thread = thread;
+_location = loc;
+  }
+
+  /**
+   * 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(Class type)
+  {
+if (type == ThreadId.class)
+  return _thread;
+else if (type == Location.class)
+  return _location;
+
+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();
+ThreadId tid = (ThreadId) idm.getObjectId(_thread);
+
+tid.write(outStream);
+_location.write(outStream);
+  }
+}
Index: gnu/classpath/jdwp/exception/NativeMethodException.java
===
RCS file: gnu/classpath/jdwp/exception/NativeMethodException.java
diff -N gnu/classpath/jdwp/exception/NativeMethodException.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/exception/NativeMethodException.java	1 Jan 1970 00:00:00 -
@@ -0,0 +1,63 @@
+/* NativeMethodException.java -- a native method exception
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under

[cp-patches] [PATCH/JDWP] Update LocationOnlyFilter

2006-03-15 Thread Keith Seitz

Hello,

Initially, I committed a LoctionOnlyFilter that wasn't really 
implemented. Now after having actually used something that needs a 
LocationOnlyFilter, I understand better how this filter is going to 
work -- it will always match; it's just a bookkeeping artifact.


I've updated the javadoc for this class and implemented the matches 
method.


Keith

ChangeLog
* gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java:
Update javadoc.
(matches): Implement.
Index: LocationOnlyFilter.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java,v
retrieving revision 1.1
diff -u -r1.1 LocationOnlyFilter.java
--- LocationOnlyFilter.java	26 Aug 2005 21:52:28 -	1.1
+++ LocationOnlyFilter.java	15 Mar 2006 23:18:40 -
@@ -1,5 +1,5 @@
 /* LocationOnlyFilter.java -- filter on location
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -49,6 +49,13 @@
  * May be used with breakpoint, field access, field modification, step,
  * and exception event kinds.
  *
+ * This filter is not really a filter. It is simply a way to communicate
+ * location information for supported events in a generic way to ease 
+ * the burden of special casing several things in
+ * EventReqeustCommandSet.executeSet.
+ * 
+ * Consequently, this filter always matches any event.
+ * 
  * @author Keith Seitz  ([EMAIL PROTECTED])
  */
 public class LocationOnlyFilter
@@ -85,7 +92,7 @@
*/
   public boolean matches (Event event)
   {
-// FIXME
-throw new RuntimeException (LocationOnlyFilter.matches not implemented);
+// This filter always matches. See comments in class javadoc.
+return true;
   }
 }


[cp-patches] [PATCH/JDWP] Rewrite Location to use VMMethod

2006-03-15 Thread Keith Seitz

Hi,

This patch rewrites the majority of gnu.classpath.jdwp.util.Location to 
use VMMethod instead of a tag, classID, methodID, and index.


Keith

ChangeLog
2005-03-15  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/util/Location.java: Rewrite using VMMethod.
(Location): Index is a long, not an int.
(getMethod): New method.
(getIndex): New method.
(toString): New method.
Index: gnu/classpath/jdwp/util/Location.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/util/Location.java,v
retrieving revision 1.2
diff -u -r1.2 Location.java
--- gnu/classpath/jdwp/util/Location.java	25 Aug 2005 22:27:25 -	1.2
+++ gnu/classpath/jdwp/util/Location.java	16 Mar 2006 00:46:19 -
@@ -1,5 +1,5 @@
 /* Location.java -- class to read/write JDWP locations
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -39,13 +39,12 @@
 package gnu.classpath.jdwp.util;
 
 import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.VMMethod;
 import gnu.classpath.jdwp.exception.JdwpException;
 import gnu.classpath.jdwp.id.ClassReferenceTypeId;
-import gnu.classpath.jdwp.id.ObjectId;
 
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 
 /**
@@ -55,62 +54,81 @@
  */
 public class Location
 {
-
-  private ClassReferenceTypeId crti;
-
-  private int index;
-
-  private byte tag;
-
-  private ObjectId mid;
+  private VMMethod method;
+  private long index;
 
   /**
* Create a location with the given parameters.
* 
-   * @param tag the type of construct the location is in
-   * @param clazz the class the location is in
-   * @param meth the Method
+   * @param method the method
* @param index location in the method
-   * @throws JdwpException
*/
-  public Location(byte tag, Class clazz, Method meth, int index)
-  throws JdwpException
+  public Location(VMMethod method, long index)
   {
-this.tag = tag;
-this.crti = 
-  (ClassReferenceTypeId) VMIdManager.getDefault().getReferenceTypeId(clazz);
-this.mid = VMIdManager.getDefault().getObjectId(meth);
+this.method = method;
 this.index = index;
   }
 
   /**
* Read a location from the given bytebuffer, consists of a TAG (byte),
-   * followed by a ReferenceTypeId, a MethodId and an index (int).
+   * followed by a ReferenceTypeId, a MethodId and an index (long).
* 
* @param bb this holds the location
-   * @throws IOException
-   * @throws JdwpException
+   * @throws IOExceptionwhen an error occurs reading from the buffer
+   * @throws JdwpException  for invalid class or method IDs
*/
-  public Location(ByteBuffer bb) throws IOException, JdwpException
+  public Location(ByteBuffer bb)
+throws IOException, JdwpException
   {
-this.tag = bb.get();
-this.crti = 
+byte tag = bb.get();
+ClassReferenceTypeId classId = 
   (ClassReferenceTypeId) VMIdManager.getDefault().readReferenceTypeId(bb);
-this.mid = VMIdManager.getDefault().readObjectId(bb);
-this.index = bb.getInt();
+Class klass = classId.getType();
+method = VMMethod.readId(klass, bb);
+index = bb.getLong();
   }
 
   /**
* Write the given location to an output stream.
* 
* @param os stream to write to
-   * @throws IOException
+   * @throws IOException when an error occurs writing to the stream
+   */
+  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);
+  }
+
+  /**
+   * Gets the method of this location
+   * 
+   * @return the method
*/
-  public void write(DataOutputStream os) throws IOException
+  public VMMethod getMethod()
+  {
+return method;
+  }
+
+  /**
+   * Gets the code index of this location
+   * 
+   * @return the code index
+   */
+  public long getIndex ()
+  {
+return index;
+  }
+
+  // convenient for debugging
+  public String toString ()
   {
-os.writeByte(tag);
-crti.write(os);
-mid.write(os);
-os.writeInt(index);
+return method.toString () + . + index;
   }
 }


[cp-patches] [PATCH/JDWP] LineTable cleanup

2006-03-15 Thread Keith Seitz

Hi,

Another little random thing to get out of my sandbox. I just didn't like 
the redundant information that it required.


Keith

ChangeLog
2006-03-15  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/util/LineTable.java (lines): Remove all occurances
of this redundant variable.
(LineTable): Assert that the number of line numbers and the number of
code indicies is the same.
Index: LineTable.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/util/LineTable.java,v
retrieving revision 1.2
diff -u -r1.2 LineTable.java
--- LineTable.java	24 Aug 2005 22:57:07 -	1.2
+++ LineTable.java	16 Mar 2006 01:17:54 -
@@ -1,5 +1,5 @@
 /* LineTable.java -- A class representing a Line Table for a method
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -54,25 +54,24 @@
   private final long end;
   private final int[] lineNum;
   private final long[] lineCI;
-  private final int lines;
 
   /**
* Construct a line table with the given parameters.
* 
* @param start lowest code index for method, -1 if native
* @param end highest code index for method, -1 if native
-   * @param lines number of entries in line table
-   * @param lineCI code indexes for entries in line tables (of length lines)
-   * @param lineNum line numbers for in line tables (of length lines)
+   * @param lineNum line numbers for in line tables
+   * @param lineCI code indicies for entries in line tables
*/
-  public LineTable(long start, long end, int lines, long lineCI[],
-   int lineNum[])
+  public LineTable(long start, long end, int[] lineNum, long[] lineCI)
   {
+if (lineNum.length != lineCI.length)
+  throw new AssertionError(code index and line numbers tables 
+   + not same length);
 this.start = start;
 this.end = end;
-this.lines = lines;
-this.lineCI = lineCI;
 this.lineNum = lineNum;
+this.lineCI = lineCI;
   }
   
   /**
@@ -86,8 +85,8 @@
   {
 os.writeLong(start);
 os.writeLong(end);
-os.writeInt(lines);
-for (int i = 0; i  lines; i++)
+os.writeInt(lineNum.length);
+for (int i = 0; i  lineNum.length; i++)
   {
 os.writeLong(lineCI[i]);
 os.writeInt(lineNum[i]);


Synchronizing JDWP startup

2006-03-15 Thread Keith Seitz

Hi,

I have a simple, if naive, question about synchronizing JDWP startup. 
When a VM starts JDWP, two new threads are created to handle 
communications to the debugger. The VM must wait for these threads to be 
completely initialized and running before continuing (which would almost 
certainly include sending a VM_INIT event).


The question is: how do people think is the best way to do this?

Right now, I've got JdwpConnection and PacketProcessor essentially 
setting an I'm ready flag in gnu.classpath.jdwp.Jdwp. Libgcj then 
spins on a method call to Jdwp.isInitialized, sleeping for some short 
time if the return value is false.


This works for gcj, but I'm uncertain of what other VMs would prefer.

Does anyone have an opinion one way or the other about how this is done 
right now? [Aka, should we worry about it when it becomes a problem?]


Keith



Re: Synchronizing JDWP startup

2006-03-15 Thread Keith Seitz

Tom Tromey wrote:


Instead of sleeping, how about wait/notify?

In the VM startup:

if (debugging enabled)
   synchronized (whatever)
 while (! thread1_started || ! thread2_started)
   whatever.wait();

Then each thread will synchronize, set their flag, and notify().


For gcj specifically, this won't work because of the finnicky startup 
procedure. The JDWP threads must be created AND ready before the main 
user thread starts running.


So, for example, calling Object.wait causes a SEGV because there are no 
threads running yet. If it's a problem in gcj, I figure it's probably a 
problem in other VMs.


Perhaps some code will demonstrate approximately how gcj starts up. 
Here's _Jv_RunMain from gcj (I've left my original implementation for 
this intact but ifdef'd out):


void
_Jv_RunMain (JvVMInitArgs *vm_args, jclass klass, const char *name, int 
argc,

 const char **argv, bool is_jar)
{
#ifndef DISABLE_MAIN_ARGS
  _Jv_SetArgs (argc, argv);
#endif

  java::lang::Runtime *runtime = NULL;

  try
{
  if (_Jv_CreateJavaVM (vm_args)  0)
{
  fprintf (stderr, libgcj: couldn't create virtual machine\n);
  exit (1);
}

  // Get the Runtime here.  We want to initialize it before searching
  // for `main'; that way it will be set up if `main' is a JNI method.
  runtime = java::lang::Runtime::getRuntime ();

#ifdef DISABLE_MAIN_ARGS
  arg_vec = JvConvertArgv (0, 0);
#else
  arg_vec = JvConvertArgv (argc - 1, argv + 1);
#endif

  // Start JDWP
  if (remoteDebug)
{
  using namespace gnu::classpath::jdwp;
  Jdwp* jdwp = new Jdwp ();
  jdwp-setDaemon (true);
  jdwp-configure (JvNewStringLatin1 (jdwpOptions));
  jdwp-start ();

  // Wait for JDWP to initialize and start
#if 0   
  while (!gnu::classpath::jdwp::Jdwp::isInitialized ())
{
  struct timespec t;
  t.tv_sec = 0;
  t.tv_nsec = 1000 * 1000 * 50;
  nanosleep (t, NULL);
}
#else
  gnu::classpath::jdwp::Jdwp::waitForInitialization ();
#endif
}

  using namespace gnu::java::lang;
  if (klass)
main_thread = new MainThread (klass, arg_vec);
  else
main_thread = new MainThread (JvNewStringLatin1 (name),
  arg_vec, is_jar);

  // Send VmInit
  gnu::classpath::jdwp::event::VmInitEvent* event;
  event = new gnu::classpath::jdwp::event::VmInitEvent (main_thread);
  gnu::classpath::jdwp::Jdwp::notify (event);
}
  catch (java::lang::Throwable *t)
{
  java::lang::System::err-print (JvNewStringLatin1
(Exception during runtime initialization: ));
  java::lang::System::err-println(t);
  t-printStackTrace();
  if (runtime)
runtime-exit (1);
  // In case the runtime creation failed.
  ::exit (1);
}

  _Jv_AttachCurrentThread (main_thread);
  if (gnu::classpath::jdwp::Jdwp::isDebugging
   gnu::classpath::jdwp::Jdwp::suspendOnStartup ())
{
  // Suspend this thread for JDWP
  _Jv_ThreadDebugSuspend (_Jv_ThreadGetData (main_thread));
}
  _Jv_ThreadRun (main_thread);

  if (::gnu::classpath::jdwp::Jdwp::isDebugging)
{
  using namespace ::gnu::classpath::jdwp;
  event::VmDeathEvent* event = new event::VmDeathEvent ();
  Jdwp::notify (event);
}

  int status = (int) java::lang::ThreadGroup::had_uncaught_exception;
  runtime-exit (status);

  // If we got here then something went wrong, as MainThread is not
  // supposed to terminate.
  ::exit (1);
}

As you can see, the startup sequence remains relatively unchanged. We 
just create some new threads when JDWP is initialized and send two 
events to indicate that the VM is live/dead.


Keith



[commit-cp] classpath ./ChangeLog gnu/classpath/jdwp/event/...

2006-03-15 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/03/15 22:55:54

Modified files:
.  : ChangeLog 
Added files:
gnu/classpath/jdwp/event: BreakpointEvent.java 
gnu/classpath/jdwp/exception: NativeMethodException.java 

Log message:
* gnu/classpath/jdwp/event/BreakpointEvent.java: New file.

* gnu/classpath/jdwp/exception/NativeMethodException.java: New file.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/event/BreakpointEvent.java?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/exception/NativeMethodException.java?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6749tr2=1.6750r1=textr2=text




[commit-cp] classpath ./ChangeLog gnu/classpath/jdwp/util/L...

2006-03-15 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/03/16 01:01:18

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/util: Location.java 

Log message:
* gnu/classpath/jdwp/util/Location.java: Rewrite using VMMethod.
(Location): Index is a long, not an int.
(getMethod): New method.
(getIndex): New method.
(toString): New method.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6752tr2=1.6753r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/util/Location.java.diff?tr1=1.2tr2=1.3r1=textr2=text




[commit-cp] classpath gnu/classpath/jdwp/util/LineTable.jav...

2006-03-15 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/03/16 01:42:04

Modified files:
gnu/classpath/jdwp/util: LineTable.java 
.  : ChangeLog 

Log message:
* gnu/classpath/jdwp/util/LineTable.java (lines): Remove all occurances
of this redundant variable.
(LineTable): Assert that the number of line numbers and the number of
code indicies is the same.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/util/LineTable.java.diff?tr1=1.2tr2=1.3r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6754tr2=1.6755r1=textr2=text




[commit-cp] classpath ./ChangeLog gnu/classpath/jdwp/proces...

2006-03-13 Thread Keith Seitz
CVSROOT:/sources/classpath
Module name:classpath
Branch: 
Changes by: Keith Seitz [EMAIL PROTECTED] 06/03/14 03:50:08

Modified files:
.  : ChangeLog 
gnu/classpath/jdwp/processor: ReferenceTypeCommandSet.java 

Log message:
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
(executeMethods): Output number of methods.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6711tr2=1.6712r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java.diff?tr1=1.6tr2=1.7r1=textr2=text




  1   2   >