public class PHPDebugTarget extends PHPDebugElement implements IPHPDebugTarget, ILaunchListener,
IDebugEventSetListener {
- private IProcess process;
-
- private ILaunch launch;
-
- private PHPThread[] threads = new PHPThread[0];
-
- private PHPDBGProxy phpDBGProxy;
+ private IProcess process;
+ private ILaunch launch;
+ private PHPThread[] threads = new PHPThread[0];
+ private PHPDBGProxy phpDBGProxy;
private class State {
private boolean isTerminated = false;
-
- private boolean isSuspended = false;
+ private boolean isSuspended = false;
boolean isTerminated() {
return isTerminated;
fireThreadCreateEvent(phpThread);
}
+ public void updateThreads (PHPThread phpThread) {
+ fireChangeEvent ();
+ fireThreadCreateEvent (phpThread);
+ }
+
private void fireChangeEvent() {
DebugEvent ev = new DebugEvent(this, DebugEvent.CHANGE);
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev });
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev });
}
- protected PHPThread getThreadById(int id) {
- for (int i = 0; i < threads.length; i++) {
- if (threads[i].getId() == id) {
- return threads[i];
- }
- }
- return null;
- }
+// protected PHPThread getThreadById(int id) {
+// for (int i = 0; i < threads.length; i++) {
+// if (threads[i].getId() == id) {
+// return threads[i];
+// }
+// }
+// return null;
+// }
public IThread[] getThreads() {
return threads;
return state.isTerminated();
}
+ private synchronized void terminateThreads () {
+ int i;
+
+ try {
+ for (i = 0; i < threads.length; i++) {
+ threads[i].terminate ();
+ }
+ } catch (DebugException e) {
+ }
+ }
+
public synchronized void terminate() {
// This method is synchronized to control a race condition between the
// UI thread that terminates the debugging session, and the slave
return;
state.setTerminated(true);
phpDBGProxy.stop();
+ terminateThreads ();
this.threads = new PHPThread[0];
fireChangeEvent();
IBreakpointManager manager = DebugPlugin.getDefault()