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 Jdebug

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--jde.debugger.Jdebug

All Implemented Interfaces:
  Protocol, java.lang.Runnable

public class Jdebug
extends java.lang.Thread
implements Protocol

Class of JDEbug debuggers.

This class defines methods for communicating with the JDE. It maintains a list of active applications. It passes application commands to the apps specified by the commands.

See `Protocol class` for command/response formats and `EventHandler` for event set formats.

JDEbug responds to every command with either a result or error message.

Since:
  0.1
Author:
  Amit Kumar, Paul Kinnucan

Field Summary
`(package private) java.util.Map` | `applications` Registry of active applications.
`static java.lang.Integer` | `debuggerID` The ID of jdebug.
`(package private) java.io.BufferedReader` | `in` FIELDS *
`(package private) java.io.PrintWriter` | `out`
`private java.util.Collection` | `pendingCommands` Each command has a command id associated with it, that is used by jde, to match with the corresponding result/error.
`static Jdebug` | `theDebugger`

Fields inherited from class java.lang.Thread
`contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ`

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
`protected` | `Jdebug()` CONSTRUCTORS *

Method Summary
`void` | `addApplication(java.lang.Integer appID, Application app)`
`void` | `addPendingCommand(java.lang.Integer cmdID)`
`boolean` | `appExists(java.lang.Integer appID)`
`Application` | `getApplication(java.lang.Integer appID)`
`private void` | `handleAppCommand(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.String command, java.util.List arguments)` Commands received from Jdebug that don't have app_id == -1 get funneled to handleAppCommand.
`void` | `init()`
`boolean` | `pendingCmdExists(java.lang.Integer cmdID)`
`void` | `removeApplication(java.lang.Integer app_id)` called by `Application.shutdown()` to remove it's own entry from the applications collection here
`void` | `removePendingCommand(java.lang.Integer cmdID)`
`void` | `run()` Runs the debugger thread.
`private void` | `setSyntax(java.io.StreamTokenizer st)` Sets the syntax of the input stream.
`void` | `shutdown()` Shuts down all the applications prior to exiting
`void` | `signal(java.lang.Integer app_id, java.lang.String type, java.lang.Object obj)` Send an arbitrary lisp function across.
`void` | `signalCommandError(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.Object obj)` reply to a command with an error.
`void` | `signalCommandResult(java.lang.Integer app_id, java.lang.Integer cmd_id)` send the result of a command.
`void` | `signalCommandResult(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.Object obj)` the result of a command.
`void` | `signalDebug(java.lang.String msg)`
`private void` | `signalReply(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.Object obj, java.lang.String type)` Signal a reply: a result or an error
`java.lang.String` | `stringRep(java.lang.Object obj)` Returns a string representation of the object.

Methods inherited from class java.lang.Thread
`, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield`

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

Field Detail

### in

    java.io.BufferedReader in

  FIELDS *

### out

    java.io.PrintWriter out

### applications

    java.util.Map applications

  Registry of active applications. The registry maps each application to its ID. The app removes itself from the registry once it's finished.

### pendingCommands

    private java.util.Collection pendingCommands

  Each command has a command id associated with it, that is used by jde, to match with the corresponding result/error. jdebug maintains the pending command ids in this collection (as does `Application`, see `Application.pendingCommands`), and removes them once the command processing is over.
  Hence, the command id can actually be reused.

  Note that in case the command is actually meant for one of the apps (ie as ascertained by matching the app_id), the id isn't stored in our Collection, but the applications. This means that, in fact, it is the tuple (app_id, cmd_id) that need be unique (assuming that a "general" command has a app_id of -1

### debuggerID

    public static final java.lang.Integer debuggerID

  The ID of jdebug. This is used by jde when issuing commands that are not specific to any particular vm, for instance, 'quit', or the command used to launch new application/vms.
  It is the Integer -1.

### theDebugger

    public static Jdebug theDebugger

Constructor Detail

### Jdebug

    protected Jdebug()

  CONSTRUCTORS *

Method Detail

### init

    public void init()
              throws java.io.IOException

### setSyntax

    private void setSyntax(java.io.StreamTokenizer st)

  Sets the syntax of the input stream. We want the input to be broken into lines, with whitespaces separating tokens

### run

    public void run()

  Runs the debugger thread. This method reads and executes commands from the JDE.
  Overrides:
    `run` in class `java.lang.Thread`
  Following copied from class: `java.lang.Thread`
  See Also:
    `Thread.start()`, `Thread.stop()`, `Thread.Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)`, `Runnable.run()`

### handleAppCommand

    private void handleAppCommand(java.lang.Integer app_id,
                                  java.lang.Integer cmd_id,
                                  java.lang.String command,
                                  java.util.List arguments)

  Commands received from Jdebug that don't have app_id == -1 get funneled to handleAppCommand. We have to check if the app_id is valid and if it corresponds to a valid app. If not, we send a general error message back to jde, with debuggerID=1 and cmd_id=-1 since app_id is not valid anyway
  Parameters:
    `app_id` - The ID of the app this command targets
    `cmd_id` - ID of the command
    `command` - the command
    `arguments` - command arguments

### addApplication

    public void addApplication(java.lang.Integer appID,
                               Application app)

### removeApplication

    public void removeApplication(java.lang.Integer app_id)

  called by `Application.shutdown()` to remove it's own entry from the applications collection here

### appExists

    public boolean appExists(java.lang.Integer appID)

### getApplication

    public Application getApplication(java.lang.Integer appID)

### addPendingCommand

    public void addPendingCommand(java.lang.Integer cmdID)

### removePendingCommand

    public void removePendingCommand(java.lang.Integer cmdID)

### pendingCmdExists

    public boolean pendingCmdExists(java.lang.Integer cmdID)

### shutdown

    public void shutdown()
                  throws JDEException

  Shuts down all the applications prior to exiting

### stringRep

    public java.lang.String stringRep(java.lang.Object obj)

  Returns a string representation of the object. Here is the logic:
  - If the object is null, return an empty string
  - If the object is string, quote it within quotation marks.
  - If the object is a list, recursively call stringRep, appending a space.
  - If it's any other kind of object, return the .toString()

### signal

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

  Send an arbitrary lisp function across.
  Parameters:
    `app_id` - The application ID
    `type` - The function name. JDE_BUG gets added to its beginning
    `obj` - An arbitrary object. If a string, it's just printed out, if a list, each of its elements is printed out, with a space after each.

### signalReply

    private void signalReply(java.lang.Integer app_id,
                             java.lang.Integer cmd_id,
                             java.lang.Object obj,
                             java.lang.String type)

  Signal a reply: a result or an error

### signalCommandResult

    public void signalCommandResult(java.lang.Integer app_id,
                                    java.lang.Integer cmd_id)

  send the result of a command. indicates a positive completion of the command. this could of course be provisional: eg. in case of provisional breakpoints

### signalDebug

    public void signalDebug(java.lang.String msg)

### signalCommandResult

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

  the result of a command. if it's a string, just send it across, else it should be a list. each element is sent across, just doing a toString() -> ie, if you want to send (... 23 "some string" 45), you need to put in the quotes (ie "") yourself: else what will be sent will be (... 23 some string 45), obviously wrong.

### signalCommandError

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

  reply to a command with an error.
  Parameters:
    `obj` - Is usually a string explaining what went wrong.

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