Showing the changes to java/pkg/com/sun/tools/example/debug/event (17 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,263 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | import com.sun.jdi.request.*; | ||
| 31 | |||
| 32 | import java.util.*; | ||
| 33 | |||
| 34 | public abstract class AbstractEventSet extends EventObject implements EventSet { | ||
| 35 | |||
| 36 | private static final long serialVersionUID = 2772717574222076977L; | ||
| 37 | private final EventSet jdiEventSet; | ||
| 38 | final Event oneEvent; | ||
| 39 | |||
| 40 | /** | ||
| 41 | */ | ||
| 42 | AbstractEventSet(EventSet jdiEventSet) { | ||
| 43 | super(jdiEventSet.virtualMachine()); | ||
| 44 | this.jdiEventSet = jdiEventSet; | ||
| 45 | this.oneEvent = eventIterator().nextEvent(); | ||
| 46 | } | ||
| 47 | |||
| 48 | public static AbstractEventSet toSpecificEventSet(EventSet jdiEventSet) { | ||
| 49 | Event evt = jdiEventSet.eventIterator().nextEvent(); | ||
| 50 | if (evt instanceof LocatableEvent) { | ||
| 51 | if (evt instanceof ExceptionEvent) { | ||
| 52 | return new ExceptionEventSet(jdiEventSet); | ||
| 53 | } else if (evt instanceof WatchpointEvent) { | ||
| 54 | if (evt instanceof AccessWatchpointEvent) { | ||
| 55 | return new AccessWatchpointEventSet(jdiEventSet); | ||
| 56 | } else { | ||
| 57 | return new ModificationWatchpointEventSet(jdiEventSet); | ||
| 58 | } | ||
| 59 | } else { | ||
| 60 | return new LocationTriggerEventSet(jdiEventSet); | ||
| 61 | } | ||
| 62 | } else if (evt instanceof ClassPrepareEvent) { | ||
| 63 | return new ClassPrepareEventSet(jdiEventSet); | ||
| 64 | } else if (evt instanceof ClassUnloadEvent) { | ||
| 65 | return new ClassUnloadEventSet(jdiEventSet); | ||
| 66 | } else if (evt instanceof ThreadDeathEvent) { | ||
| 67 | return new ThreadDeathEventSet(jdiEventSet); | ||
| 68 | } else if (evt instanceof ThreadStartEvent) { | ||
| 69 | return new ThreadStartEventSet(jdiEventSet); | ||
| 70 | } else if (evt instanceof VMDeathEvent) { | ||
| 71 | return new VMDeathEventSet(jdiEventSet); | ||
| 72 | } else if (evt instanceof VMDisconnectEvent) { | ||
| 73 | return new VMDisconnectEventSet(jdiEventSet); | ||
| 74 | } else if (evt instanceof VMStartEvent) { | ||
| 75 | return new VMStartEventSet(jdiEventSet); | ||
| 76 | } else { | ||
| 77 | throw new IllegalArgumentException("Unknown event " + evt); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | public abstract void notify(JDIListener listener); | ||
| 82 | |||
| 83 | // Implement Mirror | ||
| 84 | |||
| 85 | @Override | ||
| 86 | public VirtualMachine virtualMachine() { | ||
| 87 | return jdiEventSet.virtualMachine(); | ||
| 88 | } | ||
| 89 | |||
| 90 | public VirtualMachine getVirtualMachine() { | ||
| 91 | return jdiEventSet.virtualMachine(); | ||
| 92 | } | ||
| 93 | |||
| 94 | // Implement EventSet | ||
| 95 | |||
| 96 | /** | ||
| 97 | * Returns the policy used to suspend threads in the target VM | ||
| 98 | * for this event set. This policy is selected from the suspend | ||
| 99 | * policies for each event's request. The one that suspends the | ||
| 100 | * most threads is chosen when the event occurs in the target VM | ||
| 101 | * and that policy is returned here. See | ||
| 102 | * com.sun.jdi.request.EventRequest for the possible policy values. | ||
| 103 | * | ||
| 104 | * @return the integer suspendPolicy | ||
| 105 | */ | ||
| 106 | public int getSuspendPolicy() { | ||
| 107 | return jdiEventSet.suspendPolicy(); | ||
| 108 | } | ||
| 109 | |||
| 110 | @Override | ||
| 111 | public void resume() { | ||
| 112 | jdiEventSet.resume(); | ||
| 113 | } | ||
| 114 | |||
| 115 | @Override | ||
| 116 | public int suspendPolicy() { | ||
| 117 | return jdiEventSet.suspendPolicy(); | ||
| 118 | } | ||
| 119 | |||
| 120 | public boolean suspendedAll() { | ||
| 121 | return jdiEventSet.suspendPolicy() == EventRequest.SUSPEND_ALL; | ||
| 122 | } | ||
| 123 | |||
| 124 | public boolean suspendedEventThread() { | ||
| 125 | return jdiEventSet.suspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD; | ||
| 126 | } | ||
| 127 | |||
| 128 | public boolean suspendedNone() { | ||
| 129 | return jdiEventSet.suspendPolicy() == EventRequest.SUSPEND_NONE; | ||
| 130 | } | ||
| 131 | |||
| 132 | /** | ||
| 133 | * Return an iterator specific to {@link Event} objects. | ||
| 134 | */ | ||
| 135 | @Override | ||
| 136 | public EventIterator eventIterator() { | ||
| 137 | return jdiEventSet.eventIterator(); | ||
| 138 | } | ||
| 139 | |||
| 140 | |||
| 141 | // Implement java.util.Set (by pass through) | ||
| 142 | |||
| 143 | /** | ||
| 144 | * Returns the number of elements in this set (its cardinality). If this | ||
| 145 | * set contains more than <tt>Integer.MAX_VALUE</tt> elements, returns | ||
| 146 | * <tt>Integer.MAX_VALUE</tt>. | ||
| 147 | * | ||
| 148 | * @return the number of elements in this set (its cardinality). | ||
| 149 | */ | ||
| 150 | @Override | ||
| 151 | public int size() { | ||
| 152 | return jdiEventSet.size(); | ||
| 153 | } | ||
| 154 | |||
| 155 | /** | ||
| 156 | * Returns <tt>true</tt> if this set contains no elements. | ||
| 157 | * | ||
| 158 | * @return <tt>true</tt> if this set contains no elements. | ||
| 159 | */ | ||
| 160 | @Override | ||
| 161 | public boolean isEmpty() { | ||
| 162 | return jdiEventSet.isEmpty(); | ||
| 163 | } | ||
| 164 | |||
| 165 | /** | ||
| 166 | * Returns <tt>true</tt> if this set contains the specified element. More | ||
| 167 | * formally, returns <tt>true</tt> if and only if this set contains an | ||
| 168 | * element <code>e</code> such that <code>(o==null ? e==null : | ||
| 169 | * o.equals(e))</code>. | ||
| 170 | * | ||
| 171 | * @return <tt>true</tt> if this set contains the specified element. | ||
| 172 | */ | ||
| 173 | @Override | ||
| 174 | public boolean contains(Object o) { | ||
| 175 | return jdiEventSet.contains(o); | ||
| 176 | } | ||
| 177 | |||
| 178 | /** | ||
| 179 | * Returns an iterator over the elements in this set. The elements are | ||
| 180 | * returned in no particular order (unless this set is an instance of some | ||
| 181 | * class that provides a guarantee). | ||
| 182 | * | ||
| 183 | * @return an iterator over the elements in this set. | ||
| 184 | */ | ||
| 185 | @Override | ||
| 186 | public Iterator<Event> iterator() { | ||
| 187 | return jdiEventSet.iterator(); | ||
| 188 | } | ||
| 189 | |||
| 190 | /** | ||
| 191 | * Returns an array containing all of the elements in this set. | ||
| 192 | * Obeys the general contract of the <tt>Collection.toArray</tt> method. | ||
| 193 | * | ||
| 194 | * @return an array containing all of the elements in this set. | ||
| 195 | */ | ||
| 196 | @Override | ||
| 197 | public Object[] toArray() { | ||
| 198 | return jdiEventSet.toArray(); | ||
| 199 | } | ||
| 200 | |||
| 201 | /** | ||
| 202 | * Returns an array containing all of the elements in this set whose | ||
| 203 | * runtime type is that of the specified array. Obeys the general | ||
| 204 | * contract of the <tt>Collection.toArray(Object[])</tt> method. | ||
| 205 | * | ||
| 206 | * @param a the array into which the elements of this set are to | ||
| 207 | * be stored, if it is big enough { | ||
| 208 | return jdiEventSet.XXX(); | ||
| 209 | } otherwise, a new array of the | ||
| 210 | * same runtime type is allocated for this purpose. | ||
| 211 | * @return an array containing the elements of this set. | ||
| 212 | * @throws ArrayStoreException the runtime type of a is not a supertype | ||
| 213 | * of the runtime type of every element in this set. | ||
| 214 | */ | ||
| 215 | @Override | ||
| 216 | public <T> T[] toArray(T a[]) { | ||
| 217 | return jdiEventSet.toArray(a); | ||
| 218 | } | ||
| 219 | |||
| 220 | // Bulk Operations | ||
| 221 | |||
| 222 | /** | ||
| 223 | * Returns <tt>true</tt> if this set contains all of the elements of the | ||
| 224 | * specified collection. If the specified collection is also a set, this | ||
| 225 | * method returns <tt>true</tt> if it is a <i>subset</i> of this set. | ||
| 226 | * | ||
| 227 | * @param c collection to be checked for containment in this set. | ||
| 228 | * @return <tt>true</tt> if this set contains all of the elements of the | ||
| 229 | * specified collection. | ||
| 230 | */ | ||
| 231 | @Override | ||
| 232 | public boolean containsAll(Collection<?> c) { | ||
| 233 | return jdiEventSet.containsAll(c); | ||
| 234 | } | ||
| 235 | |||
| 236 | |||
| 237 | // Make the rest of Set unmodifiable | ||
| 238 | |||
| 239 | @Override | ||
| 240 | public boolean add(Event e){ | ||
| 241 | throw new UnsupportedOperationException(); | ||
| 242 | } | ||
| 243 | @Override | ||
| 244 | public boolean remove(Object o) { | ||
| 245 | throw new UnsupportedOperationException(); | ||
| 246 | } | ||
| 247 | @Override | ||
| 248 | public boolean addAll(Collection<? extends Event> coll) { | ||
| 249 | throw new UnsupportedOperationException(); | ||
| 250 | } | ||
| 251 | @Override | ||
| 252 | public boolean removeAll(Collection<?> coll) { | ||
| 253 | throw new UnsupportedOperationException(); | ||
| 254 | } | ||
| 255 | @Override | ||
| 256 | public boolean retainAll(Collection<?> coll) { | ||
| 257 | throw new UnsupportedOperationException(); | ||
| 258 | } | ||
| 259 | @Override | ||
| 260 | public void clear() { | ||
| 261 | throw new UnsupportedOperationException(); | ||
| 262 | } | ||
| 263 | } | ||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.event.*; | ||
| 29 | |||
| 30 | public class AccessWatchpointEventSet extends WatchpointEventSet { | ||
| 31 | |||
| 32 | private static final long serialVersionUID = -2620394219156607673L; | ||
| 33 | |||
| 34 | AccessWatchpointEventSet(EventSet jdiEventSet) { | ||
| 35 | super(jdiEventSet); | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | public void notify(JDIListener listener) { | ||
| 40 | listener.accessWatchpoint(this); | ||
| 41 | } | ||
| 42 | } | ||
| @@ -0,0 +1,64 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | public class ClassPrepareEventSet extends AbstractEventSet { | ||
| 32 | |||
| 33 | private static final long serialVersionUID = 5958493423581010491L; | ||
| 34 | |||
| 35 | ClassPrepareEventSet(EventSet jdiEventSet) { | ||
| 36 | super(jdiEventSet); | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Returns the thread in which this event has occurred. | ||
| 41 | * | ||
| 42 | * @return a {@link ThreadReference} which mirrors the event's thread in | ||
| 43 | * the target VM. | ||
| 44 | */ | ||
| 45 | public ThreadReference getThread() { | ||
| 46 | return ((ClassPrepareEvent)oneEvent).thread(); | ||
| 47 | } | ||
| 48 | |||
| 49 | |||
| 50 | /** | ||
| 51 | * Returns the reference type for which this event was generated. | ||
| 52 | * | ||
| 53 | * @return a {@link ReferenceType} which mirrors the class, interface, or | ||
| 54 | * array which has been linked. | ||
| 55 | */ | ||
| 56 | public ReferenceType getReferenceType() { | ||
| 57 | return ((ClassPrepareEvent)oneEvent).referenceType(); | ||
| 58 | } | ||
| 59 | |||
| 60 | @Override | ||
| 61 | public void notify(JDIListener listener) { | ||
| 62 | listener.classPrepare(this); | ||
| 63 | } | ||
| 64 | } | ||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.event.*; | ||
| 29 | |||
| 30 | public class ClassUnloadEventSet extends AbstractEventSet { | ||
| 31 | |||
| 32 | private static final long serialVersionUID = 8370341450345835866L; | ||
| 33 | |||
| 34 | ClassUnloadEventSet(EventSet jdiEventSet) { | ||
| 35 | super(jdiEventSet); | ||
| 36 | } | ||
| 37 | |||
| 38 | /** | ||
| 39 | * Returns the name of the class that has been unloaded. | ||
| 40 | */ | ||
| 41 | public String getClassName() { | ||
| 42 | return ((ClassUnloadEvent)oneEvent).className(); | ||
| 43 | } | ||
| 44 | |||
| 45 | /** | ||
| 46 | * Returns the JNI-style signature of the class that has been unloaded. | ||
| 47 | */ | ||
| 48 | public String getClassSignature() { | ||
| 49 | return ((ClassUnloadEvent)oneEvent).classSignature(); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | public void notify(JDIListener listener) { | ||
| 54 | listener.classUnload(this); | ||
| 55 | } | ||
| 56 | } | ||
| @@ -0,0 +1,84 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | public class ExceptionEventSet extends LocatableEventSet { | ||
| 32 | |||
| 33 | private static final long serialVersionUID = 5328140167954640711L; | ||
| 34 | |||
| 35 | ExceptionEventSet(EventSet jdiEventSet) { | ||
| 36 | super(jdiEventSet); | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Gets the thrown exception object. The exception object is | ||
| 41 | * an instance of java.lang.Throwable or a subclass in the | ||
| 42 | * target VM. | ||
| 43 | * | ||
| 44 | * @return an {@link ObjectReference} which mirrors the thrown object in | ||
| 45 | * the target VM. | ||
| 46 | */ | ||
| 47 | public ObjectReference getException() { | ||
| 48 | return ((ExceptionEvent)oneEvent).exception(); | ||
| 49 | } | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Gets the location where the exception will be caught. An exception | ||
| 53 | * is considered to be caught if, at the point of the throw, the | ||
| 54 | * current location is dynamically enclosed in a try statement that | ||
| 55 | * handles the exception. (See the JVM specification for details). | ||
| 56 | * If there is such a try statement, the catch location is the | ||
| 57 | * first code index of the appropriate catch clause. | ||
| 58 | * <p> | ||
| 59 | * If there are native methods in the call stack at the time of the | ||
| 60 | * exception, there are important restrictions to note about the | ||
| 61 | * returned catch location. In such cases, | ||
| 62 | * it is not possible to predict whether an exception will be handled | ||
| 63 | * by some native method on the call stack. | ||
| 64 | * Thus, it is possible that exceptions considered uncaught | ||
| 65 | * here will, in fact, be handled by a native method and not cause | ||
| 66 | * termination of the target VM. Also, it cannot be assumed that the | ||
| 67 | * catch location returned here will ever be reached by the throwing | ||
| 68 | * thread. If there is | ||
| 69 | * a native frame between the current location and the catch location, | ||
| 70 | * the exception might be handled and cleared in that native method | ||
| 71 | * instead. | ||
| 72 | * | ||
| 73 | * @return the {@link Location} where the exception will be caught or null if | ||
| 74 | * the exception is uncaught. | ||
| 75 | */ | ||
| 76 | public Location getCatchLocation() { | ||
| 77 | return ((ExceptionEvent)oneEvent).catchLocation(); | ||
| 78 | } | ||
| 79 | |||
| 80 | @Override | ||
| 81 | public void notify(JDIListener listener) { | ||
| 82 | listener.exception(this); | ||
| 83 | } | ||
| 84 | } | ||
| @@ -0,0 +1,80 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | /** | ||
| 29 | * The adapter which receives JDI event sets. The methods in this | ||
| 30 | * class are empty; this class is provided as a convenience for | ||
| 31 | * easily creating listeners by extending this class and overriding | ||
| 32 | * only the methods of interest. | ||
| 33 | */ | ||
| 34 | public class JDIAdapter implements JDIListener { | ||
| 35 | |||
| 36 | @Override | ||
| 37 | public void accessWatchpoint(AccessWatchpointEventSet e) { | ||
| 38 | } | ||
| 39 | |||
| 40 | @Override | ||
| 41 | public void classPrepare(ClassPrepareEventSet e) { | ||
| 42 | } | ||
| 43 | |||
| 44 | @Override | ||
| 45 | public void classUnload(ClassUnloadEventSet e) { | ||
| 46 | } | ||
| 47 | |||
| 48 | @Override | ||
| 49 | public void exception(ExceptionEventSet e) { | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | public void locationTrigger(LocationTriggerEventSet e) { | ||
| 54 | } | ||
| 55 | |||
| 56 | @Override | ||
| 57 | public void modificationWatchpoint(ModificationWatchpointEventSet e) { | ||
| 58 | } | ||
| 59 | |||
| 60 | @Override | ||
| 61 | public void threadDeath(ThreadDeathEventSet e) { | ||
| 62 | } | ||
| 63 | |||
| 64 | @Override | ||
| 65 | public void threadStart(ThreadStartEventSet e) { | ||
| 66 | } | ||
| 67 | |||
| 68 | @Override | ||
| 69 | public void vmDeath(VMDeathEventSet e) { | ||
| 70 | } | ||
| 71 | |||
| 72 | @Override | ||
| 73 | public void vmDisconnect(VMDisconnectEventSet e) { | ||
| 74 | } | ||
| 75 | |||
| 76 | @Override | ||
| 77 | public void vmStart(VMStartEventSet e) { | ||
| 78 | } | ||
| 79 | |||
| 80 | } | ||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import java.util.EventListener; | ||
| 29 | |||
| 30 | public interface JDIListener extends EventListener { | ||
| 31 | void accessWatchpoint(AccessWatchpointEventSet e); | ||
| 32 | void classPrepare(ClassPrepareEventSet e); | ||
| 33 | void classUnload(ClassUnloadEventSet e); | ||
| 34 | void exception(ExceptionEventSet e); | ||
| 35 | void locationTrigger(LocationTriggerEventSet e); | ||
| 36 | void modificationWatchpoint(ModificationWatchpointEventSet e); | ||
| 37 | void threadDeath(ThreadDeathEventSet e); | ||
| 38 | void threadStart(ThreadStartEventSet e); | ||
| 39 | void vmDeath(VMDeathEventSet e); | ||
| 40 | void vmDisconnect(VMDisconnectEventSet e); | ||
| 41 | void vmStart(VMStartEventSet e); | ||
| 42 | } | ||
| @@ -0,0 +1,62 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * Abstract event set for events with location and thread. | ||
| 33 | */ | ||
| 34 | public abstract class LocatableEventSet extends AbstractEventSet { | ||
| 35 | |||
| 36 | private static final long serialVersionUID = 1027131209997915620L; | ||
| 37 | |||
| 38 | LocatableEventSet(EventSet jdiEventSet) { | ||
| 39 | super(jdiEventSet); | ||
| 40 | } | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Returns the {@link Location} of this mirror. Depending on context | ||
| 44 | * and on available debug information, this location will have | ||
| 45 | * varying precision. | ||
| 46 | * | ||
| 47 | * @return the {@link Location} of this mirror. | ||
| 48 | */ | ||
| 49 | public Location getLocation() { | ||
| 50 | return ((LocatableEvent)oneEvent).location(); | ||
| 51 | } | ||
| 52 | |||
| 53 | /** | ||
| 54 | * Returns the thread in which this event has occurred. | ||
| 55 | * | ||
| 56 | * @return a {@link ThreadReference} which mirrors the event's thread in | ||
| 57 | * the target VM. | ||
| 58 | */ | ||
| 59 | public ThreadReference getThread() { | ||
| 60 | return ((LocatableEvent)oneEvent).thread(); | ||
| 61 | } | ||
| 62 | } | ||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.event.*; | ||
| 29 | |||
| 30 | public class LocationTriggerEventSet extends LocatableEventSet { | ||
| 31 | |||
| 32 | private static final long serialVersionUID = -3674631710485872487L; | ||
| 33 | |||
| 34 | LocationTriggerEventSet(EventSet jdiEventSet) { | ||
| 35 | super(jdiEventSet); | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | public void notify(JDIListener listener) { | ||
| 40 | listener.locationTrigger(this); | ||
| 41 | } | ||
| 42 | } | ||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | public class ModificationWatchpointEventSet extends WatchpointEventSet { | ||
| 32 | |||
| 33 | private static final long serialVersionUID = -680889300856154719L; | ||
| 34 | |||
| 35 | ModificationWatchpointEventSet(EventSet jdiEventSet) { | ||
| 36 | super(jdiEventSet); | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Value that will be assigned to the field when the instruction | ||
| 41 | * completes. | ||
| 42 | */ | ||
| 43 | public Value getValueToBe() { | ||
| 44 | return ((ModificationWatchpointEvent)oneEvent).valueToBe(); | ||
| 45 | } | ||
| 46 | |||
| 47 | @Override | ||
| 48 | public void notify(JDIListener listener) { | ||
| 49 | listener.modificationWatchpoint(this); | ||
| 50 | } | ||
| 51 | } | ||
| @@ -0,0 +1,53 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | public class ThreadDeathEventSet extends AbstractEventSet { | ||
| 32 | |||
| 33 | private static final long serialVersionUID = -8801604712308151331L; | ||
| 34 | |||
| 35 | ThreadDeathEventSet(EventSet jdiEventSet) { | ||
| 36 | super(jdiEventSet); | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Returns the thread which is terminating. | ||
| 41 | * | ||
| 42 | * @return a {@link ThreadReference} which mirrors the event's thread in | ||
| 43 | * the target VM. | ||
| 44 | */ | ||
| 45 | public ThreadReference getThread() { | ||
| 46 | return ((ThreadDeathEvent)oneEvent).thread(); | ||
| 47 | } | ||
| 48 | |||
| 49 | @Override | ||
| 50 | public void notify(JDIListener listener) { | ||
| 51 | listener.threadDeath(this); | ||
| 52 | } | ||
| 53 | } | ||
| @@ -0,0 +1,53 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | public class ThreadStartEventSet extends AbstractEventSet { | ||
| 32 | |||
| 33 | private static final long serialVersionUID = -3802096132294933502L; | ||
| 34 | |||
| 35 | ThreadStartEventSet(EventSet jdiEventSet) { | ||
| 36 | super(jdiEventSet); | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Returns the thread which has started. | ||
| 41 | * | ||
| 42 | * @return a {@link ThreadReference} which mirrors the event's thread in | ||
| 43 | * the target VM. | ||
| 44 | */ | ||
| 45 | public ThreadReference getThread() { | ||
| 46 | return ((ThreadStartEvent)oneEvent).thread(); | ||
| 47 | } | ||
| 48 | |||
| 49 | @Override | ||
| 50 | public void notify(JDIListener listener) { | ||
| 51 | listener.threadStart(this); | ||
| 52 | } | ||
| 53 | } | ||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.event.*; | ||
| 29 | |||
| 30 | public class VMDeathEventSet extends AbstractEventSet { | ||
| 31 | |||
| 32 | private static final long serialVersionUID = 1163097303940092229L; | ||
| 33 | |||
| 34 | VMDeathEventSet(EventSet jdiEventSet) { | ||
| 35 | super(jdiEventSet); | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | public void notify(JDIListener listener) { | ||
| 40 | listener.vmDeath(this); | ||
| 41 | } | ||
| 42 | } | ||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.event.*; | ||
| 29 | |||
| 30 | public class VMDisconnectEventSet extends AbstractEventSet { | ||
| 31 | |||
| 32 | private static final long serialVersionUID = 7968123152344675342L; | ||
| 33 | |||
| 34 | VMDisconnectEventSet(EventSet jdiEventSet) { | ||
| 35 | super(jdiEventSet); | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | public void notify(JDIListener listener) { | ||
| 40 | listener.vmDisconnect(this); | ||
| 41 | } | ||
| 42 | } | ||
| @@ -0,0 +1,53 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | public class VMStartEventSet extends AbstractEventSet { | ||
| 32 | |||
| 33 | private static final long serialVersionUID = -3384957227835478191L; | ||
| 34 | |||
| 35 | VMStartEventSet(EventSet jdiEventSet) { | ||
| 36 | super(jdiEventSet); | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Returns the initial thread of the VM which has started. | ||
| 41 | * | ||
| 42 | * @return a {@link ThreadReference} which mirrors the event's | ||
| 43 | * thread in the target VM. | ||
| 44 | */ | ||
| 45 | public ThreadReference getThread() { | ||
| 46 | return ((VMStartEvent)oneEvent).thread(); | ||
| 47 | } | ||
| 48 | |||
| 49 | @Override | ||
| 50 | public void notify(JDIListener listener) { | ||
| 51 | listener.vmStart(this); | ||
| 52 | } | ||
| 53 | } | ||
| @@ -0,0 +1,66 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.tools.example.debug.event; | ||
| 27 | |||
| 28 | import com.sun.jdi.*; | ||
| 29 | import com.sun.jdi.event.*; | ||
| 30 | |||
| 31 | public abstract class WatchpointEventSet extends LocatableEventSet { | ||
| 32 | |||
| 33 | private static final long serialVersionUID = 5606285209703845409L; | ||
| 34 | |||
| 35 | WatchpointEventSet(EventSet jdiEventSet) { | ||
| 36 | super(jdiEventSet); | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Returns the field that is about to be accessed/modified. | ||
| 41 | * | ||
| 42 | * @return a {@link Field} which mirrors the field | ||
| 43 | * in the target VM. | ||
| 44 | */ | ||
| 45 | public Field getField() { | ||
| 46 | return ((WatchpointEvent)oneEvent).field(); | ||
| 47 | } | ||
| 48 | |||
| 49 | /** | ||
| 50 | * Returns the object whose field is about to be accessed/modified. | ||
| 51 | * Return null is the access is to a static field. | ||
| 52 | * | ||
| 53 | * @return a {@link ObjectReference} which mirrors the event's | ||
| 54 | * object in the target VM. | ||
| 55 | */ | ||
| 56 | public ObjectReference getObject() { | ||
| 57 | return ((WatchpointEvent)oneEvent).object(); | ||
| 58 | } | ||
| 59 | |||
| 60 | /** | ||
| 61 | * Current value of the field. | ||
| 62 | */ | ||
| 63 | public Value getValueCurrent() { | ||
| 64 | return ((WatchpointEvent)oneEvent).valueCurrent(); | ||
| 65 | } | ||
| 66 | } | ||
| @@ -0,0 +1,23 @@ | |||
| 1 | <../../../../../../../../mkconfig | ||
| 2 | |||
| 3 | TARG=\ | ||
| 4 | AbstractEventSet.dis\ | ||
| 5 | AccessWatchpointEventSet.dis\ | ||
| 6 | ClassPrepareEventSet.dis\ | ||
| 7 | ClassUnloadEventSet.dis\ | ||
| 8 | ExceptionEventSet.dis\ | ||
| 9 | JDIAdapter.dis\ | ||
| 10 | JDIListener.dis\ | ||
| 11 | LocatableEventSet.dis\ | ||
| 12 | LocationTriggerEventSet.dis\ | ||
| 13 | ModificationWatchpointEventSet.dis\ | ||
| 14 | ThreadDeathEventSet.dis\ | ||
| 15 | ThreadStartEventSet.dis\ | ||
| 16 | VMDeathEventSet.dis\ | ||
| 17 | VMDisconnectEventSet.dis\ | ||
| 18 | VMStartEventSet.dis\ | ||
| 19 | WatchpointEventSet.dis\ | ||
| 20 | |||
| 21 | DISBIN=$ROOT/java/dis/java/java/com/sun/tools/example/debug/event | ||
| 22 | |||
| 23 | <$ROOT/mkfiles/mkjava | ||