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 -0000 1.2
+++ gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java 27 Apr 2007 20:47:21 -0000
@@ -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 <code>Event</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 -0000 1.4
+++ gnu/classpath/jdwp/util/Location.java 27 Apr 2007 20:47:21 -0000
@@ -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 -0000 1.3
+++ vm/reference/gnu/classpath/jdwp/VMMethod.java 27 Apr 2007 20:47:21 -0000
@@ -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;
+ }
}