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 Copyright (c) 2000, 2001, 2003 Paul Kinnucan

Since:
0.1
Version:
$Revision: 1.18 $
Author:
Amit Kumar, Paul Kinnucan

Fields inherited from interface jde.debugger.Protocol
APP_IO, ATTACH_SHMEM, ATTACH_SOCKET, BR, BREAK, CANCEL_TRACE_CLASSES, CANCEL_TRACE_METHODS, CANCEL_TRACE_THREADS, CLEAR, CMD_NOK, CMD_OK, COMMAND_ERROR, COMMAND_RESULT, COMMANDS, 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, EVENTS, EVENTSET, EXCEPTION, EXIT, FINISH, FRAMEWORK, GET_ARRAY, GET_LOADED_CLASSES, GET_LOCALS, GET_OBJECT, GET_OBJECT_MONITORS, GET_PATH_INFORMATION, GET_STRING, GET_THREAD, GET_THREADS, GUI, INTERRUPT, INVALID, JDE_BUG, JDE_INIT_DEBUG_SESSION, JDE_PIPE, KILL_THREAD, LAUNCH, LISTEN_SHMEM, LISTEN_SOCKET, MESSAGE, NONE, NOQUOTE, QUIT, QUOTE, 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.
static java.lang.String getArrayRep(com.sun.jdi.ArrayReference a, java.lang.String elements)
          Returns information about an array
static java.lang.String getLocalVariableRep(com.sun.jdi.LocalVariable lv)
          Returns a representation of a local variable on a stack frame
static java.lang.String getLocalVariableValueMapRep(java.util.Map map)
          Returns a list of (local variable, value) pairs.
static java.lang.String getLocalVariableValueRep(com.sun.jdi.LocalVariable lv, com.sun.jdi.Value v)
          Returns a representation of a (local variable, value) pair.
static java.lang.String getLocationRep(com.sun.jdi.Location loc)
          Returns a representation of a Location
static java.lang.String getObjectMonitorsRep(com.sun.jdi.ObjectReference o)
          Returns information about monitors of an object.
static java.lang.String getObjectRep(com.sun.jdi.ObjectReference o)
          Returns a non-detailed representation of an object.
static java.lang.String getObjectRep(com.sun.jdi.ObjectReference o, boolean detailed)
          Returns a canonical representation of an object.
static java.lang.String getStringRep(com.sun.jdi.StringReference s)
          Returns the value of a string
static java.lang.String getThreadGroupRep(com.sun.jdi.ThreadGroupReference t)
          Returns a canonical representation of a given ThreadGroupReference.
static java.lang.String getThreadRep(com.sun.jdi.ThreadReference t)
          Returns a detailed thread representation.
static java.lang.String getThreadRep(com.sun.jdi.ThreadReference t, boolean detailed)
          Returns a canonical representation of a given ThreadReference.
static java.lang.String getValueRep(com.sun.jdi.Value value)
          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, toString, wait, wait, wait
 

Constructor Detail

Rep

public Rep()
Method Detail

getLocationRep

public static java.lang.String getLocationRep(com.sun.jdi.Location loc)
Returns a representation of a Location

Syntax:

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

getLocalVariableRep

public static java.lang.String 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 java.lang.String getLocalVariableValueRep(com.sun.jdi.LocalVariable lv,
                                                        com.sun.jdi.Value v)
Returns a representation of a (local variable, value) pair.

Syntax:

 (local-variable . value)
 

getLocalVariableValueMapRep

public static java.lang.String getLocalVariableValueMapRep(java.util.Map map)
Returns a list of (local variable, value) pairs.

Syntax:

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

getValueRep

public static java.lang.String getValueRep(com.sun.jdi.Value value)
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 java.lang.String getArrayRep(com.sun.jdi.ArrayReference a,
                                           java.lang.String elements)
Returns information about an array

Syntax:

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

Parameters:
String - a description of the array elements

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 java.lang.String getStringRep(com.sun.jdi.StringReference s)
Returns the value of a string

Syntax:

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


getObjectRep

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

getObjectRep

public static java.lang.String getObjectRep(com.sun.jdi.ObjectReference o,
                                            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

public static java.lang.String getObjectMonitorsRep(com.sun.jdi.ObjectReference o)
Returns information about monitors of an object.

Syntax:

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

getThreadGroupRep

public static java.lang.String getThreadGroupRep(com.sun.jdi.ThreadGroupReference t)
Returns a canonical representation of a given ThreadGroupReference.

Syntax:

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

getThreadRep

public static java.lang.String getThreadRep(com.sun.jdi.ThreadReference t)
Returns a detailed thread representation.
See Also:
getThreadRep(ThreadReference, boolean)

getThreadRep

public static java.lang.String getThreadRep(com.sun.jdi.ThreadReference t,
                                            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.