import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
import net.sourceforge.phpdt.internal.debug.core.model.PHPThread;
import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable;
-import net.sourceforge.phpdt.internal.debug.core.SocketUtil;
-import net.sourceforge.phpdt.internal.debug.core.PHPDBGInterface;
import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
-import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin;
public class PHPDBGProxy {
private IPHPDebugTarget debugTarget= null;
private PHPLoop phpLoop;
private PHPThread PHPMainThread;
+ private PHPDBGProxy thisProxy= null;
private int port;
public PHPDBGProxy() {
+ thisProxy= this;
}
public void start() {
}
}
- protected Socket getSocket() throws IOException {
+ public Socket getSocket() throws IOException {
return socket;
}
public void run() {
try {
char[] buf= new char[16];
- int i, pos;
+ int i, pos, timeout;
long interval= 1000*20;
String line;
PHPStackFrame[] StackList;
return;
}
- PHPMainThread= new PHPThread(getDebugTarget(), 100);
+ PHPMainThread= new PHPThread(getDebugTarget(), getPort());
PHPMainThread.setName("Thread [main]");
- while(getDebugTarget() == null) {
- sleep(1000);
+ timeout= 0;
+ while((getDebugTarget() == null) && (timeout < 100)) {
+ sleep(100);
+ timeout++;
}
+ // Be sure debug target is set
+ PHPMainThread.setDebugTarget(getDebugTarget());
getDebugTarget().addThread(PHPMainThread);
- setDBGInterface(new PHPDBGInterface(getReader(), getOutputStream()));
+ setDBGInterface(new PHPDBGInterface(getReader(), getOutputStream(), thisProxy));
DBGInt.waitResponse(1000);
DBGInt.flushAllPackets();
if(StackList.length > 0) {
for(i=0; i < StackList.length; i++) {
StackList[i].setThread(PHPMainThread);
+ if(DBGInt.getModByNo(StackList[i].getModNo()).equals("")) {
+ DBGInt.getSourceTree();
+ }
StackList[i].setFile(DBGInt.getModByNo(StackList[i].getModNo()));
}
PHPMainThread.setStackFrames(StackList);
}
+ // Fire debug event
PHPMainThread.suspend();
-
+
synchronized(this) {
wait();
}