diff options
Diffstat (limited to 'gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters')
12 files changed, 1195 insertions, 0 deletions
diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java new file mode 100644 index 000000000..c8ec51c75 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java @@ -0,0 +1,75 @@ +/* ClassExcludeFilter.java -- filter on class name (exclusive) + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidStringException; + +/** + * An event filter which excludes events matching a + * specified class pattern (exact match or start/end with "*"). + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class ClassExcludeFilter + extends ClassMatchFilter +{ + /** + * Constructs a new <code>ClassExcludeFilter</code> + * + * @param pattern the pattern to use + * @throws InvalidStringException if pattern is invalid + */ + public ClassExcludeFilter (String pattern) + throws InvalidStringException + { + super (pattern); + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + return !super.matches (event); + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java new file mode 100644 index 000000000..a89843169 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java @@ -0,0 +1,112 @@ +/* ClassMatchFilter.java -- filter on class name (inclusive) + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidStringException; + +/** + * An event filter which includes events matching a + * specified class pattern (exact match or start/end with "*"). + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class ClassMatchFilter + implements IEventFilter +{ + // Pattern to match + private String _pattern; + + /** + * Constructs a new <code>ClassMatchFilter</code> + * + * @param pattern the pattern to use + * @throws InvalidStringException if pattern is invalid + */ + public ClassMatchFilter (String pattern) + throws InvalidStringException + { + int index = pattern.indexOf ('*'); + if (index != -1 && index != 0 && index != (pattern.length () - 1)) + { + // '*' must be first char or last char + throw new InvalidStringException ("pattern may be an exact match or " + + "start/end with \"*\""); + } + _pattern = pattern; + } + + /** + * Returns the pattern to be matched + * + * @return the pattern + */ + public String getPattern () + { + return _pattern; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + Object type = event.getParameter (Event.EVENT_CLASS); + if (type != null) + { + Class eventClass = (Class) type; + String name = eventClass.getName (); + + if (_pattern.startsWith ("*")) + return name.endsWith (_pattern.substring (1)); + else if (_pattern.endsWith ("*")) + { + int end = _pattern.length () - 1; + return name.startsWith (_pattern.substring (0, end)); + } + else + return name.matches (_pattern); + } + + return false; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java new file mode 100644 index 000000000..455cac6c0 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java @@ -0,0 +1,109 @@ +/* ClassOnlyFilter.java -- filter on specific class + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidClassException; +import gnu.classpath.jdwp.id.ReferenceTypeId; + +/** + * An event filter which filters out events in uninteresting + * classes. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class ClassOnlyFilter + implements IEventFilter +{ + // Class ID for which to filter + private ReferenceTypeId _id; + + /** + * Constructs a new <code>ClassOnlyFilter</code> + * + * @param refId the reference type id for a class for which events + * will be reported + * @throws InvalidClassException if the ID is no longer valid + */ + public ClassOnlyFilter (ReferenceTypeId refId) + throws InvalidClassException + { + // validity check + refId.getType (); + _id = refId; + } + + /** + * Returns the class to which to restrict events + * + * @return the class's ID + */ + public ReferenceTypeId getType () + { + return _id; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + Object type = event.getParameter (Event.EVENT_CLASS); + if (type != null) + { + try + { + Class clazz = _id.getType (); + Class eventClass = (Class) type; + if (clazz.isAssignableFrom (eventClass)) + return true; + } + catch (InvalidClassException ice) + { + // class is no longer valid + return false; + } + } + + return false; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ConditionalFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ConditionalFilter.java new file mode 100644 index 000000000..645a70f42 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ConditionalFilter.java @@ -0,0 +1,82 @@ +/* ConditionalFilter.java -- conditional expression filter + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.NotImplementedException; + +/** + * An event filter which allows expression conditionals. + * Note that in JDWP 1.4, this class is marked "for the + * future". + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class ConditionalFilter + implements IEventFilter +{ + // private ConditionalId _exprId; + + /** + * Constructs a new <code>ConditionalFilter</code> with the + * given conditional. + * + * <p><b>NOTE:</b> This filter is marked "for the future", + * i.e, there is no way to actually use this yet. + * + * @param conditional the conditional expression + * @throws NotImplementedException if used + */ + public ConditionalFilter (Object conditional) + throws NotImplementedException + { + throw new NotImplementedException ("conditional filters"); + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + return false; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/CountFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/CountFilter.java new file mode 100644 index 000000000..46148a504 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/CountFilter.java @@ -0,0 +1,95 @@ +/* CountFilter.java -- a step filter + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidCountException; + +/** + * An ignore count filter. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class CountFilter + implements IEventFilter +{ + // the count + private int _count; + + /** + * Constructs a new <code>CountFilter</code> with the given count. + * + * @param count the number of times the event will be ignored + * @throws InvalidCountException if count is invalid (< 1) + */ + public CountFilter (int count) + throws InvalidCountException + { + // Check for valid count + if (count < 1) + throw new InvalidCountException (count); + + _count = count; + } + + /** + * Returns the ignore count + * + * @return the number of times the event should be ignored + */ + public int getCount () + { + return _count; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + // This filter only relies on its count + if (--_count == 0) + return true; + + return false; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java new file mode 100644 index 000000000..8bb56ed78 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java @@ -0,0 +1,123 @@ +/* ExceptionOnlyFilter.java -- filter for excetions by caught/uncaught and type + Copyright (C) 2005, 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidClassException; +import gnu.classpath.jdwp.id.ReferenceTypeId; + +/** + * Restricts reported exceptions by their class and whether they are caught + * or uncaught. + * + * This modifier can be used with exception event kinds only. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class ExceptionOnlyFilter + implements IEventFilter +{ + private ReferenceTypeId _refId; + private boolean _caught; + private boolean _uncaught; + + /** + * Constructs a new ExceptionOnlyFilter + * + * @param refId ID of the exception to report(null for all exceptions) + * @param caught Report caught exceptions + * @param uncaught Report uncaught exceptions + * @throws InvalidClassException if refid is invalid + */ + public ExceptionOnlyFilter (ReferenceTypeId refId, boolean caught, + boolean uncaught) + throws InvalidClassException + { + if (refId != null && refId.getReference().get() == null) + throw new InvalidClassException(refId.getId()); + + _refId = refId; + _caught = caught; + _uncaught = uncaught; + } + + /** + * Returns the exception class to report (<code>null</code> for all) + * + * @return the class's ID + */ + public ReferenceTypeId getType () + { + return _refId; + } + + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches(Event event) + { + boolean classMatch = true; + + // if not allowing all exceptions check if the exception matches + if (_refId != null) + { + try + { + Class klass + = (Class) event.getParameter(Event.EVENT_EXCEPTION_CLASS); + classMatch = klass == _refId.getType(); + } + catch (InvalidClassException ex) + { + classMatch = false; + } + } + + // check against the caught and uncaught options + Boolean caught + = (Boolean) event.getParameter(Event.EVENT_EXCEPTION_CAUGHT); + + return classMatch && ((caught.booleanValue()) ? _caught : _uncaught); + } + +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java new file mode 100644 index 000000000..20a9edf22 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java @@ -0,0 +1,112 @@ +/* FieldOnlyFilter.java -- filter on field + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidClassException; +import gnu.classpath.jdwp.exception.InvalidFieldException; +import gnu.classpath.jdwp.id.ReferenceTypeId; + +/** + * Restricts reported events to those that occur for a given field. + * + * This modifier can be used with field access and field modification event + * kinds only. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class FieldOnlyFilter + implements IEventFilter +{ + private ReferenceTypeId _refId; + private ReferenceTypeId _fieldId; + + /** + * Constructs a new <code>FieldOnlyFilter</code>. + * + * @param refId class for field + * @param fid field + * @throws InvalidClassException if class is invalid + * @throws InvalidFieldException if field is invalid + */ + public FieldOnlyFilter (ReferenceTypeId refId, /*Field*/ReferenceTypeId fid) + throws InvalidClassException, InvalidFieldException + { + if (refId == null || refId.getReference().get () == null) + throw new InvalidClassException (refId.getId ()); + + if (fid == null) + throw new InvalidFieldException (fid.getId ()); + + _refId = refId; + _fieldId = fid; + } + + /** + * Returns the class in which the field is declared + * + * @return the class's id + */ + public ReferenceTypeId getType () + { + return _refId; + } + + /** + * Returns the field for which to restrict events + * + * @return the field's id + */ + public ReferenceTypeId getField () + { + return _fieldId; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + // FIXME + throw new RuntimeException ("FieldOnlyFilter.matches not implemented"); + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/IEventFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/IEventFilter.java new file mode 100644 index 000000000..4a2b5431b --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/IEventFilter.java @@ -0,0 +1,65 @@ +/* IEventFilter.java -- an interface for event filters + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; + +/** + * An interface for event filters. The debugger registers an event + * filter for a given event when it is interested in receiving + * notifications about that event from the VM. + * + * <p>Filters are attached to {@link gnu.classpath.jdwp.event.EventRequest}s + * in order to allow the debugger to specify that an event should be sent + * only when the filters for the event request all match. + * + * <p>No filters means "send all notifications". + * + * @author Keith Seitz (keiths@redhat.com) + */ +public interface IEventFilter +{ + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event); +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java new file mode 100644 index 000000000..bda5b27d6 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java @@ -0,0 +1,101 @@ +/* InstanceOnlyFilter.java -- filter on instance + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidObjectException; +import gnu.classpath.jdwp.id.ObjectId; + +/** + * Restricts reported events to those whose active 'this' object is the + * given object. Match value is the null object for static methods. + * + * This modifier can be used with any event kind except class prepare, + * class unload, thread start, and thread end. Introduced in JDWP version 1.4. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class InstanceOnlyFilter + implements IEventFilter +{ + private ObjectId _instance; + + /** + * Constructs a new <code>InstanceOnlyFilter</code>. + * + * @param oid the object to which to restrict events (may be null) + * @throws InvalidObjectException if Object is invalid + */ + public InstanceOnlyFilter (ObjectId oid) + throws InvalidObjectException + { + if (oid != null && oid.getReference().get () == null) + throw new InvalidObjectException (oid.getId ()); + + _instance = oid; + } + + /** + * Returns the instance to which to restrict events + * + * @return the object's ID + */ + public ObjectId getInstance () + { + return _instance; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + Object eventInstance = event.getParameter (Event.EVENT_INSTANCE); + if (eventInstance != null) + { + Object myInstance = _instance.getReference().get (); + return ((myInstance != null) && (myInstance == eventInstance)); + } + + return false; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java new file mode 100644 index 000000000..a3125371c --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java @@ -0,0 +1,94 @@ +/* LocationOnlyFilter.java -- filter on location + Copyright (C) 2005, 2006, 2007 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidLocationException; +import gnu.classpath.jdwp.util.Location; + +/** + * Restricts reported events to those that occur at the given location. + * + * May be used with breakpoint, field access, field modification, step, + * and exception event kinds. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class LocationOnlyFilter + implements IEventFilter +{ + private Location _location; + + /** + * Constructs a new <code>LocationOnlyFilter</code>. + * + * @param loc the location for which to report events + * @throws InvalidLocationException if location is invalid + */ + public LocationOnlyFilter (Location loc) + throws InvalidLocationException + { + _location = loc; + } + + /** + * Returns the location at which to restrict events + * + * @return the location + */ + public Location getLocation () + { + return _location; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches(Event event) + { + Location loc = (Location) event.getParameter(Event.EVENT_LOCATION); + if (loc != null) + return (getLocation().equals(loc)); + + return false; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java new file mode 100644 index 000000000..fd412716c --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java @@ -0,0 +1,126 @@ +/* StepFilter.java -- a step filter + Copyright (C) 2005, 2007 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidThreadException; +import gnu.classpath.jdwp.id.ThreadId; + +/** + * "An event filter which restricts reported step events to those which + * satisfy depth and size constraints. This modifier can only be used with + * step event kinds." + * + * This "filter" is not really a filter. It is simply a way to communicate + * stepping information in a convenient way between the JDWP backend and + * the virtual machine. + * + * Consequently, this "filter" always matches. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class StepFilter + implements IEventFilter +{ + private ThreadId _tid; + private int _size; + private int _depth; + + /** + * Constructs a new StepFilter + * + * @param tid ID of the thread in which to step + * @param size size of each step + * @param depth relative call stack limit + * @throws InvalidThreadException if thread is invalid + */ + public StepFilter (ThreadId tid, int size, int depth) + throws InvalidThreadException + { + if (tid.getReference().get () == null) + throw new InvalidThreadException (tid.getId ()); + + _tid = tid; + _size = size; + _depth = depth; + } + + /** + * Returns the thread in which to step + * + * @return the thread's ID + */ + public ThreadId getThread () + { + return _tid; + } + + /** + * Returns the size of each step (insn, line) + * + * @return the step size + * @see gnu.classpath.jdwp.JdwpConstants.StepSize + */ + public int getSize () + { + return _size; + } + + /** + * Returns the relative call stack limit (into, over, out) + * + * @return how to step + * @see gnu.classpath.jdwp.JdwpConstants.StepDepth + */ + public int getDepth () + { + return _depth; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + return true; + } +} diff --git a/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java new file mode 100644 index 000000000..bc1eab883 --- /dev/null +++ b/gcc-4.4.3/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java @@ -0,0 +1,101 @@ +/* ThreadOnlyFilter.java -- a thread filter + Copyright (C) 2005 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.filters; + +import gnu.classpath.jdwp.event.Event; +import gnu.classpath.jdwp.exception.InvalidThreadException; +import gnu.classpath.jdwp.id.ThreadId; + +/** + * An event filter which allows only events within a specific + * thread + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class ThreadOnlyFilter + implements IEventFilter +{ + // the thread + private ThreadId _tid; + + /** + * Constructs a new <code>ThreadOnlyFilter</code> for the given + * thread id + * + * @param tid ID of the thread on which to filter + * @throws InvalidThreadException if the thread is not valid + */ + public ThreadOnlyFilter (ThreadId tid) + throws InvalidThreadException + { + if (tid == null || tid.getReference().get () == null) + throw new InvalidThreadException (tid.getId ()); + + _tid = tid; + } + + /** + * Returns the thread in which to restrict events + * + * @return the thread's ID + */ + public ThreadId getThread () + { + return _tid; + } + + /** + * Does the given event match the filter? + * + * @param event the <code>Event</code> to scrutinize + */ + public boolean matches (Event event) + { + Object thread = event.getParameter (Event.EVENT_THREAD); + if (thread != null) + { + Thread eventThread = (Thread) thread; + Thread myThread = (Thread) _tid.getReference().get (); + return (eventThread == myThread); + } + + return false; + } +} |