jde.debugger
Class Rep

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

public class Rep
extends java.lang.Object
implements Protocol

Rep.java

Responsible for providing static methods used in spewing out string representations.

In our design, whenever we encounter an objectReference, we pass a sort of summary to jde, as well as an 'id' to identify it with. Whenever jde needs info about the objectReference, it uses the id to uniquely identify the object.

Now, the representation that is sent across for the threads (ie to the jde) depends on the context. When it is sent with reference to thread commands, eg. get_threads, get_thread, get_object_monitors; it has a lot of thread specific information, eg. its state and all.

When it's sent treating the thread as an object, eg. get_object, it's represented differently, and a different set of information is sent.

Similary, when an array command is used, a different set of information is sent across, as against when it's treated as an object.

Created: Tue Aug 3 16:36:54 1999

Since:
0.1
Author:
Amit Kumar

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
Rep()
           
 
Method Summary
static java.lang.String escapeString(java.lang.String str)
          Prefix \ escapes to all \ and " characters in a string so that the string can be read byte the Lisp interpreter.
private static java.lang.String filterFPValue(java.lang.String fpValue)
           
static LispForm getArrayRep(com.sun.jdi.ArrayReference a, ObjectStore store, int index, int length)
          Returns information about an array
(package private) static LispForm getFieldRep(com.sun.jdi.Field f)
          Returns a representation of a field.
(package private) static LispForm getFieldValueMapRep(java.util.Map map, ObjectStore s)
          Returns a list of (field, value) pairs.
(package private) static LispForm getFieldValueRep(com.sun.jdi.Field f, com.sun.jdi.Value v, ObjectStore s)
          Returns a representation of a (field, value) pair.
static LispForm getLocalVariableRep(com.sun.jdi.LocalVariable lv)
          Returns a representation of a local variable on a stack frame
static LispForm getLocalVariableValueMapRep(java.util.Map map, ObjectStore s)
          Returns a list of (local variable, value) pairs.
static LispForm getLocalVariableValueRep(com.sun.jdi.LocalVariable lv, com.sun.jdi.Value v, ObjectStore s)
          Returns a representation of a (local variable, value) pair.
(package private) static LispForm getLocationRep(com.sun.jdi.Location loc)
          Returns a representation of a Location
(package private) static LispForm getMethodRep(com.sun.jdi.Method m)
          Returns a representation of a method
(package private) static LispForm getObjectMonitorsRep(com.sun.jdi.ObjectReference o, ObjectStore store)
          Returns information about monitors of an object.
static LispForm getObjectRep(com.sun.jdi.ObjectReference o, ObjectStore store)
          Returns a non-detailed representation of an object.
static LispForm getObjectRep(com.sun.jdi.ObjectReference o, ObjectStore store, boolean detailed)
          Returns a canonical representation of an object.
(package private) static LispForm getStackFrameRep(com.sun.jdi.StackFrame s, int index)
          Returns a canonical representation of a given StackFrame.
static LispForm getStringRep(com.sun.jdi.StringReference s, ObjectStore store)
          Returns the value of a string
(package private) static LispForm getThreadGroupRep(com.sun.jdi.ThreadGroupReference t, ObjectStore store)
          Returns a canonical representation of a given ThreadGroupReference.
(package private) static LispForm getThreadRep(com.sun.jdi.ThreadReference t, ObjectStore store)
          Returns a detailed thread representation.
(package private) static LispForm getThreadRep(com.sun.jdi.ThreadReference t, ObjectStore store, boolean detailed)
          Returns a canonical representation of a given ThreadReference.
static LispForm getValueRep(com.sun.jdi.Value value, ObjectStore store)
          Returns a representation of a 'value', that can be primitive or an object reference, or void.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Rep

public Rep()
Method Detail

getLocationRep

static LispForm getLocationRep(com.sun.jdi.Location loc)
Returns a representation of a Location

Syntax:

 (list "type-name" "sourcefile" lineNumber)
 (list "type-name" nil lineNumber)
 
Comments:

getMethodRep

static LispForm getMethodRep(com.sun.jdi.Method m)
Returns a representation of a method

Syntax:

 (list "name of method" return-type-name
    (list [argument-type-name]*)
    ["final"] ["static"] ["native"] ["constructor"] ["abstract"]
    ["synchronized"] ["static_initializer"])
 

getLocalVariableRep

public static LispForm getLocalVariableRep(com.sun.jdi.LocalVariable lv)
Returns a representation of a local variable on a stack frame

Syntax:

 (list "name of variable" "type of variable")
 

getLocalVariableValueRep

public static LispForm getLocalVariableValueRep(com.sun.jdi.LocalVariable lv,
                                                com.sun.jdi.Value v,
                                                ObjectStore s)
Returns a representation of a (local variable, value) pair.

Syntax:

 (local-variable . value)
 

getLocalVariableValueMapRep

public static LispForm getLocalVariableValueMapRep(java.util.Map map,
                                                   ObjectStore s)
Returns a list of (local variable, value) pairs.

Syntax:

 (list [(local variable, value) pair]*)
 

getFieldRep

static LispForm getFieldRep(com.sun.jdi.Field f)
Returns a representation of a field.

Syntax:

 (list "name of field" "type of field" ["transient"] ["volatile"]
                                       ["final"] ["static"])
 

getFieldValueRep

static LispForm getFieldValueRep(com.sun.jdi.Field f,
                                 com.sun.jdi.Value v,
                                 ObjectStore s)
Returns a representation of a (field, value) pair.

Syntax:

 (field . value)
 

getFieldValueMapRep

static LispForm getFieldValueMapRep(java.util.Map map,
                                    ObjectStore s)
Returns a list of (field, value) pairs.

Syntax:

 (list [(field, value) pair]*)
 

filterFPValue

private static java.lang.String filterFPValue(java.lang.String fpValue)

getValueRep

public static LispForm getValueRep(com.sun.jdi.Value value,
                                   ObjectStore store)
Returns a representation of a 'value', that can be primitive or an object reference, or void.

Syntax:

 (list "null")
 (list "void")

 object-rep
 
 (list "boolean" "true")      (list "boolean" "false")
 (list "byte"    'byte-value')
 (list "char"    'char-value')
 (list "double"  double-value)
 (list "float"   float-value)
 (list "int"     int-value)
 (list "long"    long-value)
 (list "short"   short-value)
 

getArrayRep

public static LispForm getArrayRep(com.sun.jdi.ArrayReference a,
                                   ObjectStore store,
                                   int index,
                                   int length)
Returns information about an array

Syntax:

 "Error message"
 (list "type name" uniqueID ['t|nil] length [element]*)
 
Comments:

Parameters:
index - if -1, represents the begin of index from where elements are to be sent
length - Number of elements to be sent

escapeString

public static java.lang.String escapeString(java.lang.String str)
Prefix \ escapes to all \ and " characters in a string so that the string can be read byte the Lisp interpreter. For efficiency, if no such characters are found, the argument String itself is returned.
Parameters:
str - String to be prefixed.
Returns:
A String.

getStringRep

public static LispForm getStringRep(com.sun.jdi.StringReference s,
                                    ObjectStore store)
Returns the value of a string

Syntax:

 "Error message"
 (list "java.lang.String" uniqueID ['t|nil] "string-value")
 
Comments:


getObjectRep

public static LispForm getObjectRep(com.sun.jdi.ObjectReference o,
                                    ObjectStore store)
Returns a non-detailed representation of an object.
See Also:
getObjectRep(ObjectReference,ObjectStore,boolean)

getObjectRep

public static LispForm getObjectRep(com.sun.jdi.ObjectReference o,
                                    ObjectStore store,
                                    boolean detailed)
Returns a canonical representation of an object.

Syntax:

 "Error Message"
 (list "null")
 Non-detailed
 (list "type of object" uniqueID ['t|nil])
 Detailed
 (list "type of object" uniqueID ['t|nil] fields-values)
 
Comments:

getObjectMonitorsRep

static LispForm getObjectMonitorsRep(com.sun.jdi.ObjectReference o,
                                     ObjectStore store)
Returns information about monitors of an object.

Syntax:

 (list uniqueID "type of object" ['t|nil] owning-thread (list [waiting-thread]*))
 
Comments:

getThreadGroupRep

static LispForm getThreadGroupRep(com.sun.jdi.ThreadGroupReference t,
                                  ObjectStore store)
Returns a canonical representation of a given ThreadGroupReference.

Syntax:

 (list "ThreadGroup" uniqueID "name of threadgroup"
                     (list [child thread]*)
                     (list [child threadgroup]*))
 

getThreadRep

static LispForm getThreadRep(com.sun.jdi.ThreadReference t,
                             ObjectStore store)
Returns a detailed thread representation.
See Also:
getThreadRep(ThreadReference, ObjectStore, boolean)

getThreadRep

static LispForm getThreadRep(com.sun.jdi.ThreadReference t,
                             ObjectStore store,
                             boolean detailed)
Returns a canonical representation of a given ThreadReference.

Syntax:

 Non-detailed
 (list "Thread" uniqueID "name of thread" status currentState)
 Detailed
 (list "Thread" uniqueID "name of thread" status currentState
                (list [stack-frame]*)
                owned-monitors-string
                current-contended-monitor-string)
 
Comments:

Parameters:
detailed - True if a more detailed representation is desired: includes the stackframe as well as information about the monitors.

getStackFrameRep

static LispForm getStackFrameRep(com.sun.jdi.StackFrame s,
                                 int index)
Returns a canonical representation of a given StackFrame.

Syntax:

 (list "StackFrame" index "Information not available")
 (list "StackFrame" index "type name" "source name" lineNumber "method name")
 
Comments:
Parameters:
index - Gives the index of this particular stack frame for the thread. This basically goes into the string returned as a convenience.