Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jde.debugger
Class Application

    java.lang.Object
      |
      +--jde.debugger.Application

public class Application
extends java.lang.Object
implements Protocol

Application.java

Is the most important class of the jdebug: it holds control of what and how happens to the application, as it reacts to commands it receives from the jde side, and the events it receives from the debugee vm side.

Created: Wed Jul 7 16:16:59 1999

Since:
  0.1

Field Summary
`(package private) EventHandler` | `eventHandler` The `EventHandler` manages the events received from the debugee vm
`(package private) EventRequestSpecList` | `eventRequestSpecs` `EventRequestSpecList` is responsible for keeping track of the events that the user is interested in.
`(package private) GeneralCommands` | `generalCommands`
`private long` | `id` Some classes require a unique ID with which to refer to objects they are tracking: for instance eventRequestSpecs, which need a spec ID with which to identify the specs, and identifiableSpecRequests (in ApplicationCommands)
`(package private) Jdebug` | `jdebug` Represents the jde.
`(package private) java.lang.Integer` | `my_id` The ID that uniquely identifies this application in jdebug.
`(package private) java.net.Socket` | `mySocket` Socket connection to do i/o
`(package private) java.util.Collection` | `pendingCommands` A collection of the commands for which the reply (result/error) has not been sent.
`private boolean` | `shuttingDown` keeps track of the state of the application: exceptions/error messages will not be raised if we're shutting down.
`(package private) SpecCommands` | `specCommands`
`(package private) ObjectStore` | `store` A store of all the objects jde knows about.
`(package private) ThreadCommands` | `threadCommands`
`(package private) com.sun.jdi.VirtualMachine` | `vm` The debugee VM

Fields inherited from interface jde.debugger.Protocol
`ATTACH_SHMEM, ATTACH_SOCKET, BR, BREAK, CANCEL_TRACE_CLASSES, CANCEL_TRACE_METHODS, CANCEL_TRACE_THREADS, CLEAR, COMMAND_ERROR, COMMAND_RESULT, 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, EVENTSET, EXIT, FINISH, GET_ARRAY, GET_LOADED_CLASSES, GET_LOCALS, GET_OBJECT, GET_OBJECT_MONITORS, GET_PATH_INFORMATION, GET_STRING, GET_THREAD, GET_THREADS, INTERRUPT, INVALID, JDE_BUG, JDE_INIT_DEBUG_SESSION, KILL_THREAD, LAUNCH, LISTEN_SHMEM, LISTEN_SOCKET, MESSAGE, QUIT, REPORT_IDS_IN_USE, RESUME, RUN, SPEC_RESOLVED, STEP, SUSPEND, TRACE_CLASSES, TRACE_EXCEPTIONS, TRACE_METHODS, TRACE_THREADS, WARNING, WATCH`

Constructor Summary
`Application(Jdebug jdebug, java.lang.Integer app_id)` The constructor.

Method Summary
`private void` | `attachShmem(com.sun.jdi.connect.AttachingConnector connector, java.util.List args)` attaches to a vm via shared memory
`private void` | `attachSocket(com.sun.jdi.connect.AttachingConnector connector, java.util.List args)` attaches to a vm via a socket
`private void` | `displayRemoteOutput(java.io.InputStream stream)` Create a Thread that will retrieve and display any output.
`private void` | `dumpFailedAppStreams(java.lang.Process process)` after an app fails, dump its output
`private void` | `dumpStream(java.io.InputStream stream)`
`java.util.List` | `findClassesMatchingPattern(java.lang.String pattern)` Return a list of ReferenceType objects for all currently loaded classes and interfaces whose name matches the given pattern.
`private com.sun.jdi.connect.Connector` | `getConnector(java.lang.String name)`
`com.sun.jdi.event.EventQueue` | `getEventQueue()`
`java.lang.Integer` | `getId()`
`java.lang.Long` | `getNewID()`
`ObjectStore` | `getStore()`
`com.sun.jdi.VirtualMachine` | `getVM()`
`void` | `handleCommand(java.lang.Integer cmd_id, java.lang.String command, java.util.List args)` Primary function called by `Jdebug` when a command specific to a vm/app is received from jde.
`void` | `informJDEInstallSuccessful(EventRequestSpec spec)` Inform jde on a successful spec resolution
`int` | `initialize(java.lang.String connectType, java.util.List args)` Start off
`private boolean` | `isShuttingDown()`
`private int` | `launch(com.sun.jdi.connect.LaunchingConnector connector, java.util.List args)` launches a new vm,and returns the port no.
`private void` | `listenShmem(com.sun.jdi.connect.ListeningConnector connector, java.util.List args)` listenes to a vm via shared memory
`private void` | `listenSocket(com.sun.jdi.connect.ListeningConnector connector, java.util.List args)` listenes to a vm via a socket
`private int` | `manageAppStreams(java.lang.Process process)`
`private void` | `processRemoteInput(java.io.OutputStream stream)` Create a thread that reads the input from standard input and sends it to the process
`void` | `removeSpecAndInformJDE(EventRequestSpec spec, java.lang.String problem)` Removes a Spec from the specList, and informs jde.
`void` | `resolve(com.sun.jdi.ReferenceType ref)` This method is executed whenever a new reference type is prepared.
`void` | `shutdown()`
`void` | `signal(java.lang.String type, java.lang.Object obj)`
`void` | `signalCommandError(java.lang.Integer cmd_id, JDEException ex)` if a jde exception was caused somewhere (causing an error to be sent back for the command), we can use the string in the exception to create the error string
`void` | `signalCommandError(java.lang.Integer cmd_id, java.lang.String error)`
`void` | `signalCommandResult(java.lang.Integer cmd_id)`
`void` | `signalCommandResult(java.lang.Integer cmd_id, java.lang.Object obj)`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### id

    private long id

  Some classes require a unique ID with which to refer to objects they are tracking: for instance eventRequestSpecs, which need a spec ID with which to identify the specs, and identifiableSpecRequests (in ApplicationCommands)

  This variable keeps a monotonically increasing count, and can be used to get a new id, using `getNewID()`

### my_id

    final java.lang.Integer my_id

  The ID that uniquely identifies this application in jdebug.

### jdebug

    final Jdebug jdebug

  Represents the jde. `Jdebug` manages the jdebug link to jde.

### mySocket

    java.net.Socket mySocket

  Socket connection to do i/o

### eventHandler

    EventHandler eventHandler

  The `EventHandler` manages the events received from the debugee vm

### vm

    com.sun.jdi.VirtualMachine vm

  The debugee VM

### eventRequestSpecs

    EventRequestSpecList eventRequestSpecs

  `EventRequestSpecList` is responsible for keeping track of the events that the user is interested in. To do this, it maintains a list of "eventRequestSpec"s.
  See Also:
    `EventRequestSpecList`, `EventRequestSpec`

### pendingCommands

    java.util.Collection pendingCommands

  A collection of the commands for which the reply (result/error) has not been sent.
  See Also:
    `Jdebug.pendingCommands`

### store

    ObjectStore store

  A store of all the objects jde knows about.
  See Also:
    `ObjectStore`

### generalCommands

    GeneralCommands generalCommands

### specCommands

    SpecCommands specCommands

### threadCommands

    ThreadCommands threadCommands

### shuttingDown

    private boolean shuttingDown

  keeps track of the state of the application: exceptions/error messages will not be raised if we're shutting down.

Constructor Detail

### Application

    public Application(Jdebug jdebug,
                       java.lang.Integer app_id)

  The constructor.
  Parameters:
    `jdebug` - `Jdebug` class
    `app_id` - My identifying identifier

Method Detail

### getNewID

    public java.lang.Long getNewID()

### isShuttingDown

    private boolean isShuttingDown()

### initialize

    public int initialize(java.lang.String connectType,
                          java.util.List args)
                   throws JDEException

  Start off
  Parameters:
    `connectType` - Specifies how to connect to the application. We're only supporting 'launch' right now.
    `args` - A list of arguments: i does NOT contain the app_id at index 0, that has already been stripped out.

### getVM

    public com.sun.jdi.VirtualMachine getVM()

### getId

    public java.lang.Integer getId()

### getStore

    public ObjectStore getStore()

### getEventQueue

    public com.sun.jdi.event.EventQueue getEventQueue()

### shutdown

    public void shutdown()

### getConnector

    private com.sun.jdi.connect.Connector getConnector(java.lang.String name)

### launch

    private int launch(com.sun.jdi.connect.LaunchingConnector connector,
                       java.util.List args)
                throws JDEException

  launches a new vm,and returns the port no. of the app i/o

### attachSocket

    private void attachSocket(com.sun.jdi.connect.AttachingConnector connector,
                              java.util.List args)
                       throws JDEException

  attaches to a vm via a socket

### attachShmem

    private void attachShmem(com.sun.jdi.connect.AttachingConnector connector,
                             java.util.List args)
                      throws JDEException

  attaches to a vm via shared memory

### listenSocket

    private void listenSocket(com.sun.jdi.connect.ListeningConnector connector,
                              java.util.List args)
                       throws JDEException

  listenes to a vm via a socket

### listenShmem

    private void listenShmem(com.sun.jdi.connect.ListeningConnector connector,
                             java.util.List args)
                      throws JDEException

  listenes to a vm via shared memory

### manageAppStreams

    private int manageAppStreams(java.lang.Process process)
                          throws JDEException

### dumpFailedAppStreams

    private void dumpFailedAppStreams(java.lang.Process process)

  after an app fails, dump its output

### processRemoteInput

    private void processRemoteInput(java.io.OutputStream stream)

  Create a thread that reads the input from standard input and sends it to the process

### displayRemoteOutput

    private void displayRemoteOutput(java.io.InputStream stream)

  Create a Thread that will retrieve and display any output. Needs to be high priority, else debugger may exit before it can be displayed.

### dumpStream

    private void dumpStream(java.io.InputStream stream)
                     throws java.io.IOException

### findClassesMatchingPattern

    public java.util.List findClassesMatchingPattern(java.lang.String pattern)
                                              throws JDEException

  Return a list of ReferenceType objects for all currently loaded classes and interfaces whose name matches the given pattern. The pattern syntax is open to some future revision, but currently consists of a fully-qualified class name in which the first component may optionally be a "*" character, designating an arbitrary prefix.

### handleCommand

    public void handleCommand(java.lang.Integer cmd_id,
                              java.lang.String command,
                              java.util.List args)

  Primary function called by `Jdebug` when a command specific to a vm/app is received from jde.
  Parameters:
    `cmd_id` - Identifies a command uniquely. See `Jdebug.pendingCommands`
    `command` - The command
    `args` - And its arguments

### resolve

    public void resolve(com.sun.jdi.ReferenceType ref)

  This method is executed whenever a new reference type is prepared. If any outstanding specs match, they get resolved in the process
  See Also:
    `EventRequestSpecList.resolve(ReferenceType)`

### informJDEInstallSuccessful

    public void informJDEInstallSuccessful(EventRequestSpec spec)

  Inform jde on a successful spec resolution

### removeSpecAndInformJDE

    public void removeSpecAndInformJDE(EventRequestSpec spec,
                                       java.lang.String problem)

  Removes a Spec from the specList, and informs jde. If there is an error while resolving a spec, indicating that it cannot be resolved (ie even at a later time when more classes are prepared), this function is called to remove it from the list, and inform the jde about this error

### signal

    public void signal(java.lang.String type,
                       java.lang.Object obj)

### signalCommandResult

    public void signalCommandResult(java.lang.Integer cmd_id)

### signalCommandResult

    public void signalCommandResult(java.lang.Integer cmd_id,
                                    java.lang.Object obj)

### signalCommandError

    public void signalCommandError(java.lang.Integer cmd_id,
                                   java.lang.String error)

### signalCommandError

    public void signalCommandError(java.lang.Integer cmd_id,
                                   JDEException ex)

  if a jde exception was caused somewhere (causing an error to be sent back for the command), we can use the string in the exception to create the error string

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD