oscript.data
Class Debugger

java.lang.Object
  extended byoscript.data.Value
      extended byoscript.data.Debugger
All Implemented Interfaces:
java.io.Serializable

public class Debugger
extends Value

The Debugger object provides access to objects, including (not for java objects) access to the object's private members. Also, some sort of security model should be provided.

Author:
Rob Clark (rob@ti.com)
See Also:
Serialized Form

Nested Class Summary
static interface Debugger.Breakpoint
          An interface to be implemented by a breakpoint handler.
static interface Debugger.MemberAccessor
          An object implementing this interface is implemented to provide access to members of some object.
 
Field Summary
static java.lang.String[] MEMBER_NAMES
           
static java.lang.String PARENT_TYPE_NAME
           
static Value TYPE
          The type object for an instance of Object.
static java.lang.String TYPE_NAME
           
 
Fields inherited from class oscript.data.Value
DEBUG, NULL, UNDEFINED
 
Constructor Summary
Debugger()
          Class Constructor.
Debugger(MemberTable args)
          Class Constructor.
 
Method Summary
static Value _getCallee(FunctionScope scope)
           
static java.lang.Class _getClass(Value val)
           
static AbstractFile _getFile(oscript.data.FileScope scope)
           
static Value _getMember(Value val, Value name)
           
static Scope _getPreviousScope(Scope scope)
           
static Value _getType(Value val)
           
static java.util.Set _memberSet(Value val)
           
 java.lang.String castToString()
          Convert this object to a native java String value.
static java.util.Enumeration enumerateMembers(Value obj)
          Deprecated. use Value.memberSet()
static java.util.Collection getBreakpointFiles()
          Return a collection view of the files with breakpoints set in them.
static java.util.Collection getBreakpointLines(AbstractFile file)
          Return a collection of line numbers of lines with breakpoints set in the specified file.
static Debugger.MemberAccessor getMemberAccessor(Value obj, Value name)
          Access a member of an object.
protected  Value getTypeImpl()
          Get the type of this object.
static boolean mayHaveBreakpoints(NodeEvaluator ne)
          Determine if this node evaluator might have one or more breakpoints within it's body.
static void runBreakpoints(Scope scope, AbstractFile file, int line)
          Called by the stack-frame as the program is evaluated.
static Debugger.Breakpoint setBreakpoint(AbstractFile file, int linei, Debugger.Breakpoint bp)
          Set the breakpoint for the specified file:lineno.
 
Methods inherited from class oscript.data.Value
_getTypeMember, _populateTypeMemberSet, bopBitwiseAnd, bopBitwiseAndR, bopBitwiseOr, bopBitwiseOrR, bopBitwiseXor, bopBitwiseXorR, bopCast, bopCastR, bopDivide, bopDivideR, bopEquals, bopEqualsR, bopGreaterThan, bopGreaterThanOrEquals, bopGreaterThanOrEqualsR, bopGreaterThanR, bopInstanceOf, bopInstanceOfR, bopLeftShift, bopLeftShiftR, bopLessThan, bopLessThanOrEquals, bopLessThanOrEqualsR, bopLessThanR, bopLogicalAnd, bopLogicalAndR, bopLogicalOr, bopLogicalOrR, bopMinus, bopMinusR, bopMultiply, bopMultiplyR, bopNotEquals, bopNotEqualsR, bopPlus, bopPlusR, bopRemainder, bopRemainderR, bopSignedRightShift, bopSignedRightShiftR, bopUnsignedRightShift, bopUnsignedRightShiftR, callAsConstructor, callAsConstructor, callAsConstructor, callAsExtends, callAsExtends, callAsExtends, callAsFunction, callAsFunction, callAsFunction, castToBoolean, castToExactNumber, castToInexactNumber, castToJavaObject, elementAt, elementsAt, getMember, getMember, getMember, getMember, getMember, getMember, getMonitor, getType, getTypeMember, getTypeMember, isA, length, memberSet, noSuchMember, opAssign, populateMemberSet, populateTypeMemberSet, readExternal, toString, unhand, uopBitwiseNot, uopDecrement, uopIncrement, uopLogicalNot, uopMinus, uopPlus, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final Value TYPE
The type object for an instance of Object.


PARENT_TYPE_NAME

public static final java.lang.String PARENT_TYPE_NAME
See Also:
Constant Field Values

TYPE_NAME

public static final java.lang.String TYPE_NAME
See Also:
Constant Field Values

MEMBER_NAMES

public static final java.lang.String[] MEMBER_NAMES
Constructor Detail

Debugger

public Debugger()
Class Constructor.


Debugger

public Debugger(MemberTable args)
Class Constructor. This is the constructor that gets called via an BuiltinType instance.

Parameters:
args - arguments to this constructor
Throws:
PackagedScriptObjectException(Exception) - if wrong number of args
Method Detail

getTypeImpl

protected Value getTypeImpl()
Get the type of this object. The returned type doesn't have to take into account the possibility of a script type extending a built-in type, since that is handled by Value.getType().

Specified by:
getTypeImpl in class Value
Returns:
the object's type

castToString

public java.lang.String castToString()
                              throws PackagedScriptObjectException
Convert this object to a native java String value.

Overrides:
castToString in class Value
Returns:
a String value
Throws:
PackagedObjectException(NoSuchMethodException)
PackagedScriptObjectException

mayHaveBreakpoints

public static final boolean mayHaveBreakpoints(NodeEvaluator ne)
Determine if this node evaluator might have one or more breakpoints within it's body. This may return true when there are no break points, but should never return false if there are.


runBreakpoints

public static final void runBreakpoints(Scope scope,
                                        AbstractFile file,
                                        int line)
Called by the stack-frame as the program is evaluated. Runs any breakpoints set for the specified file:lineno


getBreakpointFiles

public static java.util.Collection getBreakpointFiles()
Return a collection view of the files with breakpoints set in them.

Returns:
a collection of AbstractFile

getBreakpointLines

public static java.util.Collection getBreakpointLines(AbstractFile file)
Return a collection of line numbers of lines with breakpoints set in the specified file.

Returns:
a collection of Integer

setBreakpoint

public static Debugger.Breakpoint setBreakpoint(AbstractFile file,
                                                int linei,
                                                Debugger.Breakpoint bp)
Set the breakpoint for the specified file:lineno. If bp is null then this clears the breakpoint. Returns the previous breakpoint on this file:lineno or null if none.

Parameters:
file - the file
bp - the breakpoint handler or null

enumerateMembers

public static java.util.Enumeration enumerateMembers(Value obj)
Deprecated. use Value.memberSet()


_memberSet

public static java.util.Set _memberSet(Value val)

_getMember

public static Value _getMember(Value val,
                               Value name)

_getClass

public static java.lang.Class _getClass(Value val)

_getType

public static Value _getType(Value val)

_getPreviousScope

public static Scope _getPreviousScope(Scope scope)

_getCallee

public static Value _getCallee(FunctionScope scope)

_getFile

public static AbstractFile _getFile(oscript.data.FileScope scope)

getMemberAccessor

public static Debugger.MemberAccessor getMemberAccessor(Value obj,
                                                        Value name)
Access a member of an object. By accessing a member this way, rather than directly, access can be had to non-public members. Also, it is possible to determine the attributes of that object.

Parameters:
obj - the object to access a member of
name - the name of the member to access
Returns:
an object wrapping the member
See Also:
enumerateMembers(oscript.data.Value), #MemberAccessor