Class Dim

java.lang.Object
org.mozilla.javascript.tools.debugger.Dim

public class Dim extends Object
Dim or Debugger Implementation for Rhino.
  • Field Details

    • STEP_OVER

      public static final int STEP_OVER
      See Also:
    • STEP_INTO

      public static final int STEP_INTO
      See Also:
    • STEP_OUT

      public static final int STEP_OUT
      See Also:
    • GO

      public static final int GO
      See Also:
    • BREAK

      public static final int BREAK
      See Also:
    • EXIT

      public static final int EXIT
      See Also:
    • IPROXY_DEBUG

      private static final int IPROXY_DEBUG
      See Also:
    • IPROXY_LISTEN

      private static final int IPROXY_LISTEN
      See Also:
    • IPROXY_COMPILE_SCRIPT

      private static final int IPROXY_COMPILE_SCRIPT
      See Also:
    • IPROXY_EVAL_SCRIPT

      private static final int IPROXY_EVAL_SCRIPT
      See Also:
    • IPROXY_STRING_IS_COMPILABLE

      private static final int IPROXY_STRING_IS_COMPILABLE
      See Also:
    • IPROXY_OBJECT_TO_STRING

      private static final int IPROXY_OBJECT_TO_STRING
      See Also:
    • IPROXY_OBJECT_PROPERTY

      private static final int IPROXY_OBJECT_PROPERTY
      See Also:
    • IPROXY_OBJECT_IDS

      private static final int IPROXY_OBJECT_IDS
      See Also:
    • callback

      private GuiCallback callback
      Interface to the debugger GUI.
    • breakFlag

      private boolean breakFlag
      Whether the debugger should break.
    • scopeProvider

      private ScopeProvider scopeProvider
      The ScopeProvider object that provides the scope in which to evaluate script.
    • sourceProvider

      private SourceProvider sourceProvider
      The SourceProvider object that provides the source of evaluated scripts.
    • frameIndex

      private int frameIndex
      The index of the current stack frame.
    • interruptedContextData

      private volatile Dim.ContextData interruptedContextData
      Information about the current stack at the point of interruption.
    • contextFactory

      private ContextFactory contextFactory
      The ContextFactory to listen to for debugging information.
    • monitor

      private Object monitor
      Synchronization object used to allow script evaluations to happen when a thread is resumed.
    • eventThreadMonitor

      private Object eventThreadMonitor
      Synchronization object used to wait for valid interruptedContextData.
    • returnValue

      private volatile int returnValue
      The action to perform to end the interruption loop.
    • insideInterruptLoop

      private boolean insideInterruptLoop
      Whether the debugger is inside the interruption loop.
    • evalRequest

      private String evalRequest
      The requested script string to be evaluated when the thread has been resumed.
    • evalFrame

      private Dim.StackFrame evalFrame
      The stack frame in which to evaluate evalRequest.
    • evalResult

      private String evalResult
      The result of evaluating evalRequest.
    • breakOnExceptions

      private boolean breakOnExceptions
      Whether the debugger should break when a script exception is thrown.
    • breakOnEnter

      private boolean breakOnEnter
      Whether the debugger should break when a script function is entered.
    • breakOnReturn

      private boolean breakOnReturn
      Whether the debugger should break when a script function is returned from.
    • urlToSourceInfo

      private final Map<String, Dim.SourceInfo> urlToSourceInfo
      Table mapping URLs to information about the script source.
    • functionNames

      private final Map<String, Dim.FunctionSource> functionNames
      Table mapping function names to information about the function.
    • functionToSource

      private final Map<DebuggableScript, Dim.FunctionSource> functionToSource
      Table mapping functions to information about the function.
    • listener

      private Dim.DimIProxy listener
      ContextFactory.Listener instance attached to contextFactory.
  • Constructor Details

    • Dim

      public Dim()
  • Method Details

    • setGuiCallback

      public void setGuiCallback(GuiCallback callback)
      Sets the GuiCallback object to use.
    • setBreak

      public void setBreak()
      Tells the debugger to break at the next opportunity.
    • setScopeProvider

      public void setScopeProvider(ScopeProvider scopeProvider)
      Sets the ScopeProvider to be used.
    • setSourceProvider

      public void setSourceProvider(SourceProvider sourceProvider)
      Sets the ScopeProvider to be used.
    • contextSwitch

      public void contextSwitch(int frameIndex)
      Switches context to the stack frame with the given index.
    • setBreakOnExceptions

      public void setBreakOnExceptions(boolean breakOnExceptions)
      Sets whether the debugger should break on exceptions.
    • setBreakOnEnter

      public void setBreakOnEnter(boolean breakOnEnter)
      Sets whether the debugger should break on function entering.
    • setBreakOnReturn

      public void setBreakOnReturn(boolean breakOnReturn)
      Sets whether the debugger should break on function return.
    • attachTo

      public void attachTo(ContextFactory factory)
      Attaches the debugger to the given ContextFactory.
    • detach

      public void detach()
      Detaches the debugger from the current ContextFactory.
    • dispose

      public void dispose()
      Releases resources associated with this debugger.
    • getFunctionSource

      private Dim.FunctionSource getFunctionSource(DebuggableScript fnOrScript)
      Returns the FunctionSource object for the given script or function.
    • loadSource

      private String loadSource(String sourceUrl)
      Loads the script at the given URL.
    • registerTopScript

      private void registerTopScript(DebuggableScript topScript, String source)
      Registers the given script as a top-level script in the debugger.
    • functionSource

      private Dim.FunctionSource functionSource(DebuggableScript fnOrScript)
      Returns the FunctionSource object for the given function or script.
    • functionNames

      public String[] functionNames()
      Returns an array of all function names.
    • functionSourceByName

      public Dim.FunctionSource functionSourceByName(String functionName)
      Returns the FunctionSource object for the function with the given name.
    • sourceInfo

      public Dim.SourceInfo sourceInfo(String url)
      Returns the SourceInfo object for the given URL.
    • getNormalizedUrl

      private String getNormalizedUrl(DebuggableScript fnOrScript)
      Returns the source URL for the given script or function.
    • getAllFunctions

      private static DebuggableScript[] getAllFunctions(DebuggableScript function)
      Returns an array of all functions in the given script.
    • collectFunctions_r

      private static void collectFunctions_r(DebuggableScript function, ObjArray array)
    • clearAllBreakpoints

      public void clearAllBreakpoints()
      Clears all breakpoints.
    • handleBreakpointHit

      private void handleBreakpointHit(Dim.StackFrame frame, Context cx)
      Called when a breakpoint has been hit.
    • handleExceptionThrown

      private void handleExceptionThrown(Context cx, Throwable ex, Dim.StackFrame frame)
      Called when a script exception has been thrown.
    • currentContextData

      public Dim.ContextData currentContextData()
      Returns the current ContextData object.
    • setReturnValue

      public void setReturnValue(int returnValue)
      Sets the action to perform to end interruption.
    • go

      public void go()
      Resumes execution of script.
    • eval

      public String eval(String expr)
      Evaluates the given script.
    • compileScript

      public void compileScript(String url, String text)
      Compiles the given script.
    • evalScript

      public void evalScript(String url, String text)
      Evaluates the given script.
    • objectToString

      public String objectToString(Object object)
      Converts the given script object to a string.
    • stringIsCompilableUnit

      public boolean stringIsCompilableUnit(String str)
      Returns whether the given string is syntactically valid script.
    • getObjectProperty

      public Object getObjectProperty(Object object, Object id)
      Returns the value of a property on the given script object.
    • getObjectIds

      public Object[] getObjectIds(Object object)
      Returns an array of the property names on the given script object.
    • getObjectPropertyImpl

      private Object getObjectPropertyImpl(Context cx, Object object, Object id)
      Returns the value of a property on the given script object.
    • getObjectIdsImpl

      private Object[] getObjectIdsImpl(Context cx, Object object)
      Returns an array of the property names on the given script object.
    • interrupted

      private void interrupted(Context cx, Dim.StackFrame frame, Throwable scriptException)
      Interrupts script execution.
    • do_eval

      private static String do_eval(Context cx, Dim.StackFrame frame, String expr)
      Evaluates script in the given stack frame.