jde.debugger
Class Application

java.lang.Object
  |
  +--jde.debugger.Application
All Implemented Interfaces:
Protocol

public class Application
extends java.lang.Object
implements Protocol

Class of debuggee applications.

Since:
0.1
Author:
Amit Kumar, Paul Kinnucan

Inner Class Summary
private  class Application.StandardErrorProcessor
          Forwards the application's error output to Emacs.
private  class Application.StandardInputProcessor
          Reads standard input from Emacs and forwards it to the application.
private  class Application.StandardOutputProcessor
          Forwards the application's standard output to Emacs.
private  class Application.StandardOutputWriter
          Writes a line to the socket connected to the standard I/O buffer maintained by Emacs for this application.
 
Field Summary
(package private)  java.lang.Integer appID
          The ID that uniquely identifies this application in jdebug.
(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
           
(package private)  Jdebug jdebug
          Represents the jde.
private  long objIdCounter
          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)  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)  java.net.Socket sioSocket
          Socket connection to do i/o
(package private)  SpecCommands specCommands
           
(package private)  Application.StandardErrorProcessor standardErrorProcessor
           
(package private)  Application.StandardInputProcessor standardInputProcessor
           
(package private)  java.lang.Thread standardIOConnectThread
           
(package private)  Application.StandardOutputProcessor standardOutputProcessor
           
(package private)  Application.StandardOutputWriter standardOutputWriter
           
(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 virtual machine that is running this application.
 
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 appID, com.sun.jdi.VirtualMachine vm)
          Creates an instance of an application object.
 
Method Summary
 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.
 java.lang.Long generateObjectID()
           
 com.sun.jdi.event.EventQueue getEventQueue()
           
 java.lang.Integer getId()
           
 ObjectStore getStore()
           
 com.sun.jdi.VirtualMachine getVM()
          METHODS *
 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 initSIOConnect()
          Launches a thread to connect the Emacs standard I/O buffer for the current process to the standard I/O of the process.
 void initSIOTransport()
          Describe initSIOTransport method here.
private  boolean isShuttingDown()
           
 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 cmdID, 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 cmdID, java.lang.String error)
           
 void signalCommandResult(java.lang.Integer cmd_id)
           
 void signalCommandResult(java.lang.Integer cmdID, 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

appID

final java.lang.Integer appID
The ID that uniquely identifies this application in jdebug.

jdebug

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

sioSocket

java.net.Socket sioSocket
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 virtual machine that is running this application.

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

objIdCounter

private long objIdCounter
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 generate a new id, using generateObjectID()


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.

standardIOConnectThread

java.lang.Thread standardIOConnectThread

standardInputProcessor

Application.StandardInputProcessor standardInputProcessor

standardOutputProcessor

Application.StandardOutputProcessor standardOutputProcessor

standardErrorProcessor

Application.StandardErrorProcessor standardErrorProcessor

standardOutputWriter

Application.StandardOutputWriter standardOutputWriter
Constructor Detail

Application

public Application(Jdebug jdebug,
                   java.lang.Integer appID,
                   com.sun.jdi.VirtualMachine vm)
Creates an instance of an application object.
Parameters:
jdebug - Jdebug class
appID - Identifier used to specify this app int commands.
vm - Virtual machine in which this application is running.
Method Detail

getVM

public final com.sun.jdi.VirtualMachine getVM()
METHODS *

getId

public final java.lang.Integer getId()

generateObjectID

public final java.lang.Long generateObjectID()

getStore

public final ObjectStore getStore()

getEventQueue

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

shutdown

public final void shutdown()

initSIOConnect

public int initSIOConnect()
                   throws JDEException
Launches a thread to connect the Emacs standard I/O buffer for the current process to the standard I/O of the process.

This method creates a socket for the standard I/O connection. The thread waits for Emacs to connect to the standard I/O socket.

Returns:
Address of standard I/O socket.
Throws:
JDEException - if an error occurs

initSIOTransport

public void initSIOTransport()
Describe initSIOTransport method here.

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 cmdID,
                                java.lang.Object obj)

signalCommandError

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

signalCommandError

public void signalCommandError(java.lang.Integer cmdID,
                               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

isShuttingDown

private boolean isShuttingDown()