jde.debugger.spec
Class EventRequestSpec

java.lang.Object
  |
  +--jde.debugger.spec.EventRequestSpec
All Implemented Interfaces:
Protocol
Direct Known Subclasses:
BreakpointSpec, ExceptionSpec, WatchpointSpec

public abstract class EventRequestSpec
extends java.lang.Object
implements Protocol

EventRequestSpec.java

A request specification. This is used for watchpoints, exception-catches, and breakpoints, and provides a mechanism for implementing deferral.

The intuition is that the user should be allowed to specify things like breakpoints, even though the corresponding classes haven't been loaded yet.

When the user does a, for example, "break on_line test.Test 42", jdebug tries to find if test.Test has been loaded. If it has, it tries to set the breakpoint, and sends an error on failure.

If, however, no class matching test.Test exists, jdebug places this "spec" in a list, and each time a class is prepared, matches the class with the spec. If the spec matches, it tries to set the breakpoint / watchpoint / exception-catch. If it works, fine, else it sends the error over to jde.

This also allows for neat things like setting breakpoints on source file + line number combinations, since each reference type (given it was compiled with debug info) also contains the source file name in it.

Information that would normally be stuck right into the actual requests, for example a thread filter, is stored in the spec until the time it can resolve the request. At that time, it is set in #setRequest.

XXX

Note that as of now, when the doc is being written, there is no way of ascertaining if the user mistyped the referencetype name/pattern, since jdebug will just wait ad infinitum for that class to be prepared.

Created: Thu Jul 15 12:17:34 1999

Since:
0.1
Version:
 
Author:
Amit Kumar

Field Summary
static java.lang.Object expressionKey
          While setting some specs, the user is allowed to specify a boolean expression that must evaluate to true if the event is to be passed on to the user.
static java.lang.Object specPropertyKey
          Used to cross-reference the EventRequest to its spec.
static java.lang.Object threadKey
          For specs that allow for it, the thread object is either null, a Long, or a String.
 
Fields inherited from interface jde.debugger.Protocol
APP_IO, ATTACH_SHMEM, ATTACH_SOCKET, BR, BREAK, CANCEL_TRACE_CLASSES, CANCEL_TRACE_METHODS, CANCEL_TRACE_THREADS, CLEAR, CMD_NOK, CMD_OK, COMMAND_ERROR, COMMAND_RESULT, COMMANDS, CONNECTED_TO_VM, DEBUG, ERROR, EVALUATE, EVENT_BREAKPOINT_HIT, EVENT_CLASS_PREPARE, EVENT_CLASS_UNLOAD, EVENT_EXCEPTION, EVENT_METHOD_ENTRY, EVENT_METHOD_EXIT, EVENT_OTHER, EVENT_STEP_COMPLETED, EVENT_THREAD_DEATH, EVENT_THREAD_START, EVENT_VM_DEATH, EVENT_VM_DISCONNECT, EVENT_VM_START, EVENT_WATCHPOINT_HIT, EVENTS, EVENTSET, EXCEPTION, EXIT, FINISH, FRAMEWORK, GET_ARRAY, GET_LOADED_CLASSES, GET_LOCALS, GET_OBJECT, GET_OBJECT_MONITORS, GET_PATH_INFORMATION, GET_STRING, GET_THREAD, GET_THREADS, GUI, INTERRUPT, INVALID, JDE_BUG, JDE_INIT_DEBUG_SESSION, JDE_PIPE, KILL_THREAD, LAUNCH, LISTEN_SHMEM, LISTEN_SOCKET, MESSAGE, NONE, NOQUOTE, QUIT, QUOTE, REPORT_IDS_IN_USE, RESUME, RUN, SPEC_RESOLVED, STEP, SUSPEND, TRACE_CLASSES, TRACE_EXCEPTIONS, TRACE_METHODS, TRACE_THREADS, WARNING, WATCH
 
Constructor Summary
EventRequestSpec(ReferenceTypeSpec refSpec)
           
 
Method Summary
 void attemptResolve(com.sun.jdi.ReferenceType refType, java.lang.Integer procID)
          This function is called after each new class is loaded.
 com.sun.jdi.request.EventRequest getEventRequest()
           
 java.lang.Long getID()
          get the id corresponding to this spec
 boolean isResolved()
           
 void setClassExFilters(java.util.List filters)
           
 void setClassFilters(java.util.List filters)
           
 void setExpression(java.lang.String expr)
           
 void setIsResolved(java.lang.Integer procID)
          set resolved status and notify Emacs.
 void setSuspendPolicy(int policy)
           
 void setThread(java.lang.Object thread)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expressionKey

public static final java.lang.Object expressionKey
While setting some specs, the user is allowed to specify a boolean expression that must evaluate to true if the event is to be passed on to the user. This expression is stored in the EventRequest object as a property. On an event, the EventRequest object is also passed, and the property can then be extracted, evaluated, and handled correspondingly

threadKey

public static final java.lang.Object threadKey
For specs that allow for it, the thread object is either null, a Long, or a String. Depending on the type, it is matched at the time the breakpoint is hit. If it matches the thread, the breakpoint is deemed non-hit.

specPropertyKey

public static final java.lang.Object specPropertyKey
Used to cross-reference the EventRequest to its spec.
Constructor Detail

EventRequestSpec

public EventRequestSpec(ReferenceTypeSpec refSpec)
Method Detail

setExpression

public void setExpression(java.lang.String expr)

setThread

public void setThread(java.lang.Object thread)

setSuspendPolicy

public void setSuspendPolicy(int policy)

setClassFilters

public void setClassFilters(java.util.List filters)

setClassExFilters

public void setClassExFilters(java.util.List filters)

getID

public java.lang.Long getID()
get the id corresponding to this spec

getEventRequest

public com.sun.jdi.request.EventRequest getEventRequest()

attemptResolve

public void attemptResolve(com.sun.jdi.ReferenceType refType,
                           java.lang.Integer procID)
                    throws JDEException
This function is called after each new class is loaded. If this spec hasn't been resolved yet, it's attempted to be resolved. the handling is almost exactly the same as that in #attemptImmediateResolve


isResolved

public boolean isResolved()
Returns:
true if this spec has been resolved.

setIsResolved

public void setIsResolved(java.lang.Integer procID)
set resolved status and notify Emacs.