mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 03:05:34 +00:00
Clean up debug APIs
This commit is contained in:
parent
e875395364
commit
629043f2b8
@ -40,8 +40,7 @@ import org.mozilla.javascript.debug.DebuggableScript;
|
||||
|
||||
class InterpretedFunction extends NativeFunction implements DebuggableScript {
|
||||
|
||||
InterpretedFunction(InterpreterData theData, Context cx)
|
||||
{
|
||||
InterpretedFunction(InterpreterData theData, Context cx) {
|
||||
itsData = theData;
|
||||
init(cx);
|
||||
}
|
||||
@ -83,6 +82,10 @@ class InterpretedFunction extends NativeFunction implements DebuggableScript {
|
||||
return Interpreter.interpret(cx, scope, thisObj, args, this, itsData);
|
||||
}
|
||||
|
||||
public boolean isFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Scriptable getScriptable() {
|
||||
return this;
|
||||
}
|
||||
|
@ -67,6 +67,10 @@ public class InterpretedScript extends NativeScript implements DebuggableScript
|
||||
return Interpreter.interpret(cx, scope, thisObj, args, this, itsData);
|
||||
}
|
||||
|
||||
public boolean isFunction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Scriptable getScriptable() {
|
||||
return this;
|
||||
}
|
||||
|
@ -40,15 +40,53 @@ package org.mozilla.javascript.debug;
|
||||
|
||||
public interface DebuggableEngine {
|
||||
|
||||
public void setLineStep(boolean isLineStep);
|
||||
/**
|
||||
* Set whether the engine should break when it encounters
|
||||
* the next line.
|
||||
* <p>
|
||||
* The engine will call the attached debugger's handleBreakpointHit
|
||||
* method on the next line it executes if isLineStep is true.
|
||||
* May be used from another thread to interrupt execution.
|
||||
*
|
||||
* @param isLineStep if true, break next line
|
||||
*/
|
||||
public void setBreakNextLine(boolean isLineStep);
|
||||
|
||||
public boolean getLineStep();
|
||||
/**
|
||||
* Return the value of the breakNextLine flag.
|
||||
* @return true if the engine will break on execution of the
|
||||
* next line.
|
||||
*/
|
||||
public boolean getBreakNextLine();
|
||||
|
||||
/**
|
||||
* Set the associated debugger.
|
||||
* @param debugger the debugger to be used on callbacks from
|
||||
* the engine.
|
||||
*/
|
||||
public void setDebugger(Debugger debugger);
|
||||
|
||||
/**
|
||||
* Return the current debugger.
|
||||
* @return the debugger, or null if none is attached.
|
||||
*/
|
||||
public Debugger getDebugger();
|
||||
|
||||
public Frame getFrame(int frameNumber);
|
||||
/**
|
||||
* Return the number of frames in current execution.
|
||||
* @return the count of current frames
|
||||
*/
|
||||
public int getFrameCount();
|
||||
|
||||
//public void haltExecution();
|
||||
/**
|
||||
* Return a frame from the current execution.
|
||||
* Frames are numbered starting from 0 for the innermost
|
||||
* frame.
|
||||
* @param frameNumber the number of the frame in the range
|
||||
* [0,frameCount-1]
|
||||
* @return the relevant Frame, or null if frameNumber is out
|
||||
* of range or the engine isn't currently saving
|
||||
* frames
|
||||
*/
|
||||
public Frame getFrame(int frameNumber);
|
||||
}
|
||||
|
@ -47,7 +47,10 @@ import java.util.Enumeration;
|
||||
*/
|
||||
public interface DebuggableScript {
|
||||
|
||||
//public boolean isFunction(); // XXX
|
||||
/**
|
||||
* Returns true if this is a function, false if it is a script.
|
||||
*/
|
||||
public boolean isFunction();
|
||||
|
||||
/**
|
||||
* Get the Scriptable object (Function or Script) that is
|
||||
|
@ -40,8 +40,7 @@ import org.mozilla.javascript.debug.DebuggableScript;
|
||||
|
||||
class InterpretedFunction extends NativeFunction implements DebuggableScript {
|
||||
|
||||
InterpretedFunction(InterpreterData theData, Context cx)
|
||||
{
|
||||
InterpretedFunction(InterpreterData theData, Context cx) {
|
||||
itsData = theData;
|
||||
init(cx);
|
||||
}
|
||||
@ -83,6 +82,10 @@ class InterpretedFunction extends NativeFunction implements DebuggableScript {
|
||||
return Interpreter.interpret(cx, scope, thisObj, args, this, itsData);
|
||||
}
|
||||
|
||||
public boolean isFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Scriptable getScriptable() {
|
||||
return this;
|
||||
}
|
||||
|
@ -67,6 +67,10 @@ public class InterpretedScript extends NativeScript implements DebuggableScript
|
||||
return Interpreter.interpret(cx, scope, thisObj, args, this, itsData);
|
||||
}
|
||||
|
||||
public boolean isFunction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Scriptable getScriptable() {
|
||||
return this;
|
||||
}
|
||||
|
@ -40,15 +40,53 @@ package org.mozilla.javascript.debug;
|
||||
|
||||
public interface DebuggableEngine {
|
||||
|
||||
public void setLineStep(boolean isLineStep);
|
||||
/**
|
||||
* Set whether the engine should break when it encounters
|
||||
* the next line.
|
||||
* <p>
|
||||
* The engine will call the attached debugger's handleBreakpointHit
|
||||
* method on the next line it executes if isLineStep is true.
|
||||
* May be used from another thread to interrupt execution.
|
||||
*
|
||||
* @param isLineStep if true, break next line
|
||||
*/
|
||||
public void setBreakNextLine(boolean isLineStep);
|
||||
|
||||
public boolean getLineStep();
|
||||
/**
|
||||
* Return the value of the breakNextLine flag.
|
||||
* @return true if the engine will break on execution of the
|
||||
* next line.
|
||||
*/
|
||||
public boolean getBreakNextLine();
|
||||
|
||||
/**
|
||||
* Set the associated debugger.
|
||||
* @param debugger the debugger to be used on callbacks from
|
||||
* the engine.
|
||||
*/
|
||||
public void setDebugger(Debugger debugger);
|
||||
|
||||
/**
|
||||
* Return the current debugger.
|
||||
* @return the debugger, or null if none is attached.
|
||||
*/
|
||||
public Debugger getDebugger();
|
||||
|
||||
public Frame getFrame(int frameNumber);
|
||||
/**
|
||||
* Return the number of frames in current execution.
|
||||
* @return the count of current frames
|
||||
*/
|
||||
public int getFrameCount();
|
||||
|
||||
//public void haltExecution();
|
||||
/**
|
||||
* Return a frame from the current execution.
|
||||
* Frames are numbered starting from 0 for the innermost
|
||||
* frame.
|
||||
* @param frameNumber the number of the frame in the range
|
||||
* [0,frameCount-1]
|
||||
* @return the relevant Frame, or null if frameNumber is out
|
||||
* of range or the engine isn't currently saving
|
||||
* frames
|
||||
*/
|
||||
public Frame getFrame(int frameNumber);
|
||||
}
|
||||
|
@ -47,7 +47,10 @@ import java.util.Enumeration;
|
||||
*/
|
||||
public interface DebuggableScript {
|
||||
|
||||
//public boolean isFunction(); // XXX
|
||||
/**
|
||||
* Returns true if this is a function, false if it is a script.
|
||||
*/
|
||||
public boolean isFunction();
|
||||
|
||||
/**
|
||||
* Get the Scriptable object (Function or Script) that is
|
||||
|
Loading…
Reference in New Issue
Block a user