## jde.debugger
Class Rep

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

public class Rep
extends java.lang.Object
implements Protocol

Rep.java

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

- A useful hierarchy:
  - Value
    - ObjectReference
      - StringReference
      - ArrayReference
      - ThreadReference
      - ThreadGroupReference
      - Other...
    - PrimitiveValue
      - BooleanValue
      - etc....

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

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
`(package private) 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.
`(package private) static LispForm` `getLocalVariableRep(com.sun.jdi.LocalVariable lv)` Returns a representation of a local variable on a stack frame
`(package private) static LispForm` `getLocalVariableValueMapRep(java.util.Map map, ObjectStore s)` Returns a list of (local variable, value) pairs.
`(package private) 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.
`(package private) static LispForm` `getObjectRep(com.sun.jdi.ObjectReference o, ObjectStore store)` Returns a non-detailed representation of an object.
`(package private) 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.
`(package private) 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 non-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.
`(package private) 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
`<clinit>, 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:
  - lineNumber is -1 if that information is not available

### 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

    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

    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

    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]*)

### getValueRep

    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

    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:
  - The third argument (['t|nil]) indicates if the object has been garbage collected in the debugee vm: it's nil if it hasn't.
  - elements are only present if the index/length make sense. See param list.

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

### getStringRep

    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:
  - The third argument (['t|nil]) indicates if the object has been garbage collected in the debugee vm: it's nil if it hasn't.

### getObjectRep

    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

    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:
  - The third argument (['t|nil]) indicates if the object has been garbage collected in the debugee vm: it's nil if it hasn't.

### 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:
  - The third argument (['t|nil]) indicates if the object has been garbage collected in the debugee vm: it's nil if it hasn't.

### 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 non-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:
  - status is one of: "unknown", "waiting on monitor", "not started", "runnable", "sleeping", "waiting", and "zombie"
  - currentState is one of "normal", "suspended by debugger", and "suspended at breakpoint"
  - owned-monitors-string:

          "Error Message"
          (list [owned monitor]*)

  - current-contended-monitor-string:

          "Error Message"
          nil
          current contended monitor

  - Examples:

            (list "Thread" 53 "Thread 1, continuous"
                  "suspended by debugger" "waiting on monitor"
                  (list
                     (list 0 "test.Test" "Test.java" 45))
                  (list)
                  (list "java.lang.String" 55))

            (list "Thread" 54 "Thread 2"
                  "suspended by debugger" "waiting on monitor"
                  (list
                     (list 0 "java.lang.Thread" "Thread.java" -1)
                     (list 1 "test.Test" "Test.java" 47))
                  (list
                     (list "java.lang.String" 55)
                     (list "java.lang.Integer" 61))
                  (list))

  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)

  Comments:
  - lineNumber is -1 for native methods
  Parameters:
    `index` - Gives the index of this particular stack frame for the thread. This basically goes into the string returned as a convenience.