X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java index b9bf0f2..aecbdf0 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java @@ -26,10 +26,7 @@ import net.sourceforge.phpdt.internal.debug.core.model.IPHPDebugTarget; 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 { @@ -40,9 +37,11 @@ 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() { @@ -81,7 +80,7 @@ public class PHPDBGProxy { } } - protected Socket getSocket() throws IOException { + public Socket getSocket() throws IOException { return socket; } @@ -265,7 +264,7 @@ public class PHPDBGProxy { public void run() { try { char[] buf= new char[16]; - int i, pos; + int i, pos, timeout; long interval= 1000*20; String line; PHPStackFrame[] StackList; @@ -279,13 +278,17 @@ public class PHPDBGProxy { 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(); @@ -303,12 +306,16 @@ public class PHPDBGProxy { 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(); }