| Method from org.apache.bsf.engines.javascript.RhinoContextProxy Detail: |
public void cancelStepping() {
m_stepCmd = NO_STEP;
m_stepDepth = -1;
m_engine.setBreakNextLine(false);
}
|
public JsContextStub entry_exit_mode() throws RemoteException {
cancelStepping();
updateStack();
return m_frames[0];
}
|
public JsContextStub exceptionThrown() throws RemoteException {
cancelStepping();
updateStack();
return m_frames[0];
}
|
public JsContextStub getContext(int depth) {
return m_frames[depth];
}
|
public int getContextCount() {
return m_frameCount;
}
|
public JsContextStub getFrame(int no) {
if (no < 0 || no > m_frameCount)
return null;
if (no == m_frameCount)
return m_contextStub;
else
return m_frames[no];
}
|
public int getLineNumber() {
DebugFrame frame = m_engine.getFrame(0);
return frame.getLineNumber();
}
|
public RhinoEngineDebugger getRhinoEngineDebugger() {
return m_reDbg;
}
|
String getSourceName() {
DebugFrame frame = m_engine.getFrame(0);
return frame.getSourceName();
}
|
public JsContextStub hitBreakpoint() throws RemoteException {
cancelStepping();
updateStack();
return m_frames[0];
}
|
public void resumed() {
JsContextStub stub;
DebugFrame frame;
m_atBreakpoint = false;
for (int f = 0; f < m_frameCount; f++) {
stub = m_frames[f];
stub.atBreakpoint(false);
}
}
|
public void run() {
m_engine.setBreakNextLine(false);
m_stepCmd = RUNNING;
m_stepDepth = -1;
}
|
public void stepIn() {
m_engine.setBreakNextLine(true);
m_stepCmd = STEP_IN;
m_stepDepth = m_frameCount;
}
|
public void stepOut() {
m_engine.setBreakNextLine(true);
m_stepCmd = STEP_OUT;
m_stepDepth = m_frameCount;
}
|
public void stepOver() {
m_engine.setBreakNextLine(true);
m_stepCmd = STEP_OVER;
m_stepDepth = m_frameCount;
}
|
public JsContextStub stepping() {
// Did we hit a known breakpoint?
int frameCount = m_engine.getFrameCount();
try {
switch (m_stepCmd) {
case NO_STEP :
cancelStepping();
break;
case STOP_ENGINE :
updateStack();
cancelStepping();
return m_frames[0];
case STEP_IN :
// OG if ((frameCount == m_stepDepth + 1) ||
// (frameCount == m_stepDepth)) {
// step if we are in the same frame (nothing to step in... :-)
// if we are in a called frame...
// but also if we stepped out of the current frame...
if ((frameCount >= m_stepDepth)
|| (frameCount < m_stepDepth)) {
updateStack();
cancelStepping();
return m_frames[0];
}
break;
case STEP_OVER :
// OG if (frameCount == m_stepDepth) {
// step if we are in the same frame or above...
// this basically avoids any children frame but
// covers the return of the current frame.
if (frameCount < = m_stepDepth) {
updateStack();
cancelStepping();
return m_frames[0];
}
break;
case STEP_OUT :
// OG if (frameCount == m_stepDepth - 1) {
if (frameCount < m_stepDepth) {
updateStack();
cancelStepping();
return m_frames[0];
}
break;
default :
throw new Error("Unknown command.");
}
} catch (Throwable t) {
t.printStackTrace();
cancelStepping();
}
return null;
}
|
public void stopEngine() {
m_engine.setBreakNextLine(true);
m_stepCmd = STOP_ENGINE;
m_stepDepth = -1;
}
|
public void updateStack() throws RemoteException {
JsContextStub frames[];
JsContextStub stub;
DebugFrame frame;
int nf, of, frameCount;
m_atBreakpoint = true;
frameCount = m_engine.getFrameCount();
frames = new JsContextStub[frameCount];
// scan the stacks from the outer frame down
// to the inner one of the shortest of the old
// and the new known stack.
// The goal is to recognize the DebugFrame objects
// that are the sames so that we can reuse the
// stubs for those.
// As soon as a DebugFrame object is found different,
// the rest of the stack is different, all the old
// stubs can be dropped and invalidated, new ones
// must be created.
for (nf = frameCount - 1, of = m_frameCount - 1;
nf >= 0 && of >= 0;
nf--, of--) {
frame = m_engine.getFrame(nf);
if (frame == m_frames[of].m_frame) {
frames[nf] = m_frames[of];
} else
break;
}
// now drop all old frames that diverged.
// Also invalidate the frame stubs so to
// tracked that they are no longer valid.
for (; of >= 0; of--) {
m_reDbg.dropStub(m_frames[of].m_frame);
m_frames[of].invalidate();
}
for (; nf >= 0; nf--) {
frame = m_engine.getFrame(nf);
frames[nf] = new JsContextStub(this, frame, nf);
}
m_frames = frames;
m_frameCount = frameCount;
}
|