| Method from org.apache.bsf.debug.meta.JsEngineStub Detail: |
public Object eval(String docname,
String fnOrScript,
int lineno) throws RemoteException {
throw new Error("NYI");
}
Allow the debugger to evaluate an expression
within the current context. |
public JsContext getContext(int depth) throws RemoteException {
ResultCell cell;
try {
cell = m_con.prepareOutgoingInvoke(this,DebugConstants.JS_ENGINE_TID,DebugConstants.JE_GET_CONTEXT_AT);
cell.writeInt(depth);
return (JsContext)cell.waitForObject();
} catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
} catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
Returns the JsContext at a certain depth.
Depth zero is the top of the stack, that is,
the inner execution context.
This is a valid call only if the engine is stopped
in a callback to the debugger (breakpoint or stepping
completed). |
public int getContextCount() throws RemoteException {
ResultCell cell;
try {
cell = m_con.prepareOutgoingInvoke(this,DebugConstants.JS_ENGINE_TID,DebugConstants.JE_GET_CONTEXT_COUNT);
return cell.waitForIntValue();
} catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
} catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
Returns the count of JsContext on the current stack.
This is a valid call only if the engine is stopped
in a callback to the debugger (breakpoint or stepping
completed). |
public JsCallbacks getDebugger() throws RemoteException {
return fCallbacks;
}
Return the current debugger. |
public JsObject getGlobalObject() throws RemoteException {
ResultCell cell;
try {
cell = m_con.prepareOutgoingInvoke(this,DebugConstants.JS_ENGINE_TID,DebugConstants.JE_GET_GLOBAL_OBJECT);
return (JsObject)cell.waitForObject();
} catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
} catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
Any execution in JavaScript happen with respect to a
global object, sort of the top-level name space for
properties. This is global object return by this call. |
public String getThread() throws RemoteException {
ResultCell cell;
try {
cell =
m_con.prepareOutgoingInvoke(this,
DebugConstants.JS_ENGINE_TID,
DebugConstants.JE_GET_THREAD);
return (String)cell.waitForObject();
}
catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
}
catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
|
public String getThreadGroup() throws RemoteException {
ResultCell cell;
try {
cell =
m_con.prepareOutgoingInvoke(this,
DebugConstants.JS_ENGINE_TID,
DebugConstants.JE_GET_THREADGROUP);
return (String)cell.waitForObject();
}
catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
}
catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
|
public JsObject getUndefinedValue() throws RemoteException {
ResultCell cell;
try {
cell = m_con.prepareOutgoingInvoke(this,DebugConstants.JS_ENGINE_TID,DebugConstants.JE_GET_UNDEFINED_VALUE);
return (JsObject)cell.waitForObject();
} catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
} catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
As per ECMA specification, each JavaScript execution
defines a unique object for the undefined value. |
public boolean isSuspended() {
return fSuspended;
}
|
public boolean poll() throws RemoteException {
ResultCell cell;
try {
cell = m_con.prepareOutgoingInvoke(this,DebugConstants.JS_ENGINE_TID,DebugConstants.CB_POLL);
return cell.waitForBooleanValue();
} catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
} catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
|
public void run() throws RemoteException {
resume(DebugConstants.JE_RUN);
}
Stepping commands:
run: resume execution until it finishes or a breakpoint is hit.
stepIn: steps to the next statement, considering callee's statement if any.
stepOut: steps until the current JsContext exits.
stepOver: steps to the next statement within the same JsContext. |
public void setDebugger(JsCallbacks debugger) throws RemoteException {
fCallbacks = debugger;
ResultCell cell;
try {
cell = m_con.prepareOutgoingInvoke(this,DebugConstants.JS_ENGINE_TID,DebugConstants.JE_SET_DEBUGGER);
cell.writeObject(debugger);
cell.waitForCompletion();
} catch (IOException ex) {
throw new RemoteException("Marshalling error", ex);
} catch (Exception ex) {
throw new RemoteException("Error at server", ex);
}
}
Set the associated debugger. |
public void stepIn() throws RemoteException {
resume(DebugConstants.JE_STEP_IN);
}
|
public void stepOut() throws RemoteException {
resume(DebugConstants.JE_STEP_OUT);
}
|
public void stepOver() throws RemoteException {
resume(DebugConstants.JE_STEP_OVER);
}
|
void suspended(boolean suspended) {
fSuspended = suspended;
}
|