|
Lines 100-105
Link Here
|
| 100 |
try { |
100 |
try { |
| 101 |
if(request != null) { |
101 |
if(request != null) { |
| 102 |
deleteRequest(this, request); |
102 |
deleteRequest(this, request); |
|
|
103 |
request = null; |
| 103 |
} |
104 |
} |
| 104 |
resumeUnderlyingThread(); |
105 |
resumeUnderlyingThread(); |
| 105 |
fireResumeEvent(DebugEvent.CLIENT_REQUEST); |
106 |
fireResumeEvent(DebugEvent.CLIENT_REQUEST); |
|
Lines 136-148
Link Here
|
| 136 |
void stepEnd(IJavaScriptEventListener listener, StepEvent event) { |
137 |
void stepEnd(IJavaScriptEventListener listener, StepEvent event) { |
| 137 |
ThreadReference threadReference = event.thread(); |
138 |
ThreadReference threadReference = event.thread(); |
| 138 |
if (threadReference == thread) { |
139 |
if (threadReference == thread) { |
|
|
140 |
synchronized(JavaScriptThread.this) { |
| 139 |
pendingstep = null; |
141 |
pendingstep = null; |
| 140 |
markSuspended(); |
142 |
markSuspended(); |
| 141 |
fireSuspendEvent(DebugEvent.STEP_END); |
143 |
fireSuspendEvent(DebugEvent.STEP_END); |
|
|
144 |
|
| 142 |
if(request == event.request()) { |
145 |
if(request == event.request()) { |
| 143 |
deleteRequest(listener, event.request()); |
146 |
deleteRequest(listener, event.request()); |
| 144 |
request = null; |
147 |
request = null; |
| 145 |
} |
148 |
} |
|
|
149 |
} |
| 146 |
} |
150 |
} |
| 147 |
} |
151 |
} |
| 148 |
|
152 |
|
|
Lines 225-231
Link Here
|
| 225 |
/** |
229 |
/** |
| 226 |
* @return the status text for the thread |
230 |
* @return the status text for the thread |
| 227 |
*/ |
231 |
*/ |
| 228 |
private String statusText() { |
232 |
private synchronized String statusText() { |
| 229 |
switch(state) { |
233 |
switch(state) { |
| 230 |
case SUSPENDED: { |
234 |
case SUSPENDED: { |
| 231 |
if(this.breakpoints.size() > 0) { |
235 |
if(this.breakpoints.size() > 0) { |
|
Lines 289-295
Link Here
|
| 289 |
* |
293 |
* |
| 290 |
* @see org.eclipse.debug.core.model.IThread#getBreakpoints() |
294 |
* @see org.eclipse.debug.core.model.IThread#getBreakpoints() |
| 291 |
*/ |
295 |
*/ |
| 292 |
public IBreakpoint[] getBreakpoints() { |
296 |
public synchronized IBreakpoint[] getBreakpoints() { |
| 293 |
if (this.breakpoints.isEmpty()) { |
297 |
if (this.breakpoints.isEmpty()) { |
| 294 |
return NO_BREAKPOINTS; |
298 |
return NO_BREAKPOINTS; |
| 295 |
} |
299 |
} |
|
Lines 319-326
Link Here
|
| 319 |
* |
323 |
* |
| 320 |
* @see org.eclipse.debug.core.model.IThread#getStackFrames() |
324 |
* @see org.eclipse.debug.core.model.IThread#getStackFrames() |
| 321 |
*/ |
325 |
*/ |
| 322 |
public IStackFrame[] getStackFrames() throws DebugException { |
326 |
public synchronized IStackFrame[] getStackFrames() throws DebugException { |
| 323 |
if (!isSuspended()) { |
327 |
if (!isSuspended() || !thread.isSuspended()) { |
| 324 |
return NO_STACK_FRAMES; |
328 |
return NO_STACK_FRAMES; |
| 325 |
} |
329 |
} |
| 326 |
if (this.frames == null) { |
330 |
if (this.frames == null) { |
|
Lines 605-614
Link Here
|
| 605 |
* @param breakpoint |
609 |
* @param breakpoint |
| 606 |
* @return if the breakpoint added removed an existing entry |
610 |
* @return if the breakpoint added removed an existing entry |
| 607 |
*/ |
611 |
*/ |
| 608 |
public boolean addBreakpoint(IJavaScriptBreakpoint breakpoint) { |
612 |
public synchronized boolean addBreakpoint(IJavaScriptBreakpoint breakpoint) { |
| 609 |
synchronized (this.breakpoints) { |
613 |
return breakpoints.add(breakpoint); |
| 610 |
return this.breakpoints.add(breakpoint); |
|
|
| 611 |
} |
| 612 |
} |
614 |
} |
| 613 |
|
615 |
|
| 614 |
/** |
616 |
/** |
|
Lines 617-632
Link Here
|
| 617 |
* @param breakpoint |
619 |
* @param breakpoint |
| 618 |
* @return if the breakpoint was removed |
620 |
* @return if the breakpoint was removed |
| 619 |
*/ |
621 |
*/ |
| 620 |
public boolean removeBreakpoint(IJavaScriptBreakpoint breakpoint) { |
622 |
public synchronized boolean removeBreakpoint(IJavaScriptBreakpoint breakpoint) { |
| 621 |
synchronized (this.breakpoints) { |
623 |
return breakpoints.remove(breakpoint); |
| 622 |
return this.breakpoints.remove(breakpoint); |
|
|
| 623 |
} |
| 624 |
} |
624 |
} |
| 625 |
|
625 |
|
| 626 |
/** |
626 |
/** |
| 627 |
* Sets the state of the thread to {@link #SUSPENDED} |
627 |
* Sets the state of the thread to {@link #SUSPENDED} |
| 628 |
*/ |
628 |
*/ |
| 629 |
synchronized void markSuspended() { |
629 |
synchronized void markSuspended() { |
|
|
630 |
if (! thread.isSuspended()) |
| 631 |
System.err.println("Warning: model thread marked suspended when underlything thread is not suspended"); //$NON-NLS-1$ |
| 630 |
this.state = SUSPENDED; |
632 |
this.state = SUSPENDED; |
| 631 |
} |
633 |
} |
| 632 |
|
634 |
|
|
Lines 651-657
Link Here
|
| 651 |
* |
653 |
* |
| 652 |
* @see org.eclipse.debug.core.model.IStep#canStepInto() |
654 |
* @see org.eclipse.debug.core.model.IStep#canStepInto() |
| 653 |
*/ |
655 |
*/ |
| 654 |
public boolean canStepInto() { |
656 |
public synchronized boolean canStepInto() { |
| 655 |
return canStep() || atScriptLoadBreakpoint(); |
657 |
return canStep() || atScriptLoadBreakpoint(); |
| 656 |
} |
658 |
} |
| 657 |
|
659 |
|
|
Lines 689-695
Link Here
|
| 689 |
/** |
691 |
/** |
| 690 |
* @return <code>true</code> if a step is allowed |
692 |
* @return <code>true</code> if a step is allowed |
| 691 |
*/ |
693 |
*/ |
| 692 |
boolean canStep() { |
694 |
synchronized boolean canStep() { |
| 693 |
try { |
695 |
try { |
| 694 |
return isSuspended() && !isStepping() && getTopStackFrame() != null; |
696 |
return isSuspended() && !isStepping() && getTopStackFrame() != null; |
| 695 |
} |
697 |
} |
|
Lines 713-719
Link Here
|
| 713 |
* |
715 |
* |
| 714 |
* @see org.eclipse.debug.core.model.IStep#stepInto() |
716 |
* @see org.eclipse.debug.core.model.IStep#stepInto() |
| 715 |
*/ |
717 |
*/ |
| 716 |
public void stepInto() throws DebugException { |
718 |
public synchronized void stepInto() throws DebugException { |
|
|
719 |
if (!canStepInto()) |
| 720 |
System.err.println("Warning: StepInto called on model thread when it canStepInto is false"); //$NON-NLS-1$ |
| 717 |
StepHandler handler = new StepHandler(); |
721 |
StepHandler handler = new StepHandler(); |
| 718 |
handler.step(StepRequest.STEP_INTO, DebugEvent.STEP_INTO); |
722 |
handler.step(StepRequest.STEP_INTO, DebugEvent.STEP_INTO); |
| 719 |
} |
723 |
} |
|
Lines 723-729
Link Here
|
| 723 |
* |
727 |
* |
| 724 |
* @see org.eclipse.debug.core.model.IStep#stepOver() |
728 |
* @see org.eclipse.debug.core.model.IStep#stepOver() |
| 725 |
*/ |
729 |
*/ |
| 726 |
public void stepOver() throws DebugException { |
730 |
public synchronized void stepOver() throws DebugException { |
|
|
731 |
if (!canStepOver()) |
| 732 |
System.err.println("Warning: stepOver called on model thread when it canStepOver is false"); //$NON-NLS-1$ |
| 727 |
StepHandler handler = new StepHandler(); |
733 |
StepHandler handler = new StepHandler(); |
| 728 |
handler.step(StepRequest.STEP_OVER, DebugEvent.STEP_OVER); |
734 |
handler.step(StepRequest.STEP_OVER, DebugEvent.STEP_OVER); |
| 729 |
} |
735 |
} |
|
Lines 733-739
Link Here
|
| 733 |
* |
739 |
* |
| 734 |
* @see org.eclipse.debug.core.model.IStep#stepReturn() |
740 |
* @see org.eclipse.debug.core.model.IStep#stepReturn() |
| 735 |
*/ |
741 |
*/ |
| 736 |
public void stepReturn() throws DebugException { |
742 |
public synchronized void stepReturn() throws DebugException { |
|
|
743 |
if (!canStepReturn()) |
| 744 |
System.err.println("Warning: stepReturn called on model thread when it canStepReturn is false"); //$NON-NLS-1$ |
| 737 |
StepHandler handler = new StepHandler(); |
745 |
StepHandler handler = new StepHandler(); |
| 738 |
handler.step(StepRequest.STEP_OUT, DebugEvent.STEP_RETURN); |
746 |
handler.step(StepRequest.STEP_OUT, DebugEvent.STEP_RETURN); |
| 739 |
} |
747 |
} |