X-Git-Url: http://git.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 192cff0..1001de9 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 @@ -48,6 +48,7 @@ public class PHPDBGProxy { private int port; private boolean remote; private boolean pathtranslation; + private boolean bRelaunch; // Relaunch the debugger after script termination private Map pathmap; private IPath remoteSourcePath; @@ -56,28 +57,39 @@ public class PHPDBGProxy { public PHPDBGProxy () { thisProxy = this; } - + /** * updateView * Clean up the view, but leave the Debug session running. * added by ed_mann */ -// public void updateView(){ -// getDebugTarget().updateThreads(PHPMainThread); -// } - + public void updateView () { +/* + try { + server.close (); + server = null; + start (); + } + catch (IOException e) { + } +*/ + getDebugTarget ().updateThreads (PHPMainThread); + } + /** * @param remote * @param remoteSourcePath * @param pathTranslate * @param paths + * @param */ - public PHPDBGProxy (boolean remote, String remoteSourcePath, boolean pathTranslate, Map paths) { + public PHPDBGProxy (boolean remote, String remoteSourcePath, boolean pathTranslate, Map paths, boolean bRelaunchOnScriptTermination) { thisProxy = this; this.remote = remote; this.remoteSourcePath = new Path (remoteSourcePath); this.pathmap = paths; this.pathtranslation = pathTranslate; + this.bRelaunch = bRelaunchOnScriptTermination; } /** @@ -108,7 +120,7 @@ public class PHPDBGProxy { phpLoop.notifyWait (); } - + public void setTerminated () { try { PHPMainThread.terminate (); @@ -137,15 +149,15 @@ public class PHPDBGProxy { /** * Find a free unused port between 10001 and 10101 if the current debug session * is for remote debugging, and a unused port 7869 if it is used as non remote debugging. - * + * * For remote debugging the used port is submitted with the URL. * E.g. http://localhost/index.php?DBGSESSID=1@localhost:10001 * For non remote debugging (if PHPeclipse used e.g. php cli directly) no port * can be submitted by parameter, and only the default port (7869) can be used. - * - * @note: The free dbg version doesn't allow to set the appropriate port within php.ini! - * - * + * + * @note: The free dbg version doesn't allow to set the appropriate port within php.ini! + * + * */ protected void createServerSocket () { if (this.remote) { @@ -154,7 +166,7 @@ public class PHPDBGProxy { else { port = SocketUtil.findUnusedLocalPort ("localhost", 7869, 7869); // Get the first free port in the range from 7869 to 7869 } - + if (port == -1) { // Did we get a free port? PHPDebugCorePlugin.log (5, "Cannot find free port!!!!"); // No, output a error message @@ -195,7 +207,7 @@ public class PHPDBGProxy { public PHPDBGInterface getDBGInterface () { return DBGInt; } - + /** * Give back a buffered input stream for the socket which is * linked with this proxy @@ -284,7 +296,7 @@ public class PHPDBGProxy { localPath = new Path (local); // Get the remote/server side path of the mapping if (localPath.isPrefixOf (filename)) { // Starts the remote/server side file path with the remote/server side mapping path - // dann prefix abh�ngen und den remote path davorh�gen + // dann prefix abhängen und den remote path davorhägen newpath = filename.removeFirstSegments (localPath.matchingFirstSegments (filename)); newpath = remotePath.append (newpath); path = newpath.toString (); @@ -334,17 +346,17 @@ public class PHPDBGProxy { // bpNo= DBGInt.addBreakpoint(phpLBP.getMarker().getResource().getLocation().toOSString(), phpLBP.getLineNumber()); if (phpLBP.isConditionEnabled ()) { bpNo = DBGInt.addBreakpoint (MapPath(phpLBP), - phpLBP.getLineNumber(), + phpLBP.getLineNumber(), phpLBP.getHitCount(), phpLBP.getCondition ()); } else { bpNo = DBGInt.addBreakpoint (MapPath(phpLBP), - phpLBP.getLineNumber(), + phpLBP.getLineNumber(), phpLBP.getHitCount(), ""); } - + phpLBP.setDBGBpNo(bpNo); } } catch (IOException e) { @@ -439,14 +451,14 @@ public class PHPDBGProxy { /** * Is called by the DebuggerRunner - * + * * @param debugTarget */ public void setDebugTarget (PHPDebugTarget debugTarget) { this.debugTarget = debugTarget; debugTarget.setPHPDBGProxy(this); } - + /** * This method is called by a stackframe. * It reads the variables from PHP via DBG @@ -487,8 +499,9 @@ public class PHPDBGProxy { public void readStepOverEnd (PHPStackFrame stackFrame) { try { - DBGInt.stepOver(); - phpLoop.notifyWait(); + if (DBGInt.stepOver ()) { + phpLoop.notifyWait(); + } } catch (Exception e) { PHPDebugCorePlugin.log(e); } @@ -496,8 +509,9 @@ public class PHPDBGProxy { public void readStepReturnEnd (PHPStackFrame stackFrame) { try { - DBGInt.stepOut(); - phpLoop.notifyWait(); + if (DBGInt.stepOut ()) { + phpLoop.notifyWait(); + } } catch (Exception e) { PHPDebugCorePlugin.log(e); } @@ -505,14 +519,15 @@ public class PHPDBGProxy { public void readStepIntoEnd (PHPStackFrame stackFrame) { try { - DBGInt.stepInto(); - phpLoop.notifyWait(); + if (DBGInt.stepInto ()) { + phpLoop.notifyWait(); + } } catch (Exception e) { PHPDebugCorePlugin.log(e); } } - /* + /** * public PHPStackFrame[] readFrames(PHPThread thread) { //try { //this.println("th " + thread.getId() + " ; f "); //return new * FramesReader(getMultiReaderStrategy()).readFrames(thread); return null; //} catch (IOException e) { // * PHPDebugCorePlugin.log(e); // return null; //} @@ -546,7 +561,7 @@ public class PHPDBGProxy { shouldStop = false; this.setName ("PHPDebuggerLoop"); } - + /** * */ @@ -620,9 +635,10 @@ public class PHPDBGProxy { server.setSoTimeout(1); // ??? } - newDBGInt = new PHPDBGInterface (getReader (newSocket), // Create a new interface - newSocket.getOutputStream (), - thisProxy); + newDBGInt = new PHPDBGInterface (getReader (newSocket), // The input buffer (frames from dbg) + newSocket.getOutputStream (), // The output buffer (frames to dbg) + thisProxy, + bRelaunch); // Whether the debugger should be relaunched after script termination newDBGInt.waitResponse (1000); // Wait for the initial DBG response newDBGInt.flushAllPackets (); // Read and process the DBG response