X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java index e7bf98e..72edfed 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java @@ -44,11 +44,13 @@ public class PHPDBGInterface { private String typeRead= new String(""); private String className= new String(""); private int finalPos=0, refCounter=0, rawCounter=1000; + private PHPDBGProxy proxy= null; - public PHPDBGInterface(BufferedReader in, OutputStream os) { + public PHPDBGInterface(BufferedReader in, OutputStream os, PHPDBGProxy proxy) { DBGBPList.clear(); this.in= in; this.os= os; + this.proxy= proxy; } public int addBreakpoint(String mod_name, int line) throws IOException { @@ -64,8 +66,23 @@ public class PHPDBGInterface { PHPDBGFrame DBGFrame= new PHPDBGFrame(PHPDBGBase.FRAME_VER); DBGPacket.addFrame(DBGFrame); + + if(proxy.getSocket().isClosed()) return; + DBGPacket.sendPacket(os); + } + + public void getSourceTree() throws IOException { + PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_REQUEST); + PHPDBGFrame DBGFrame= new PHPDBGFrame(PHPDBGBase.FRAME_SRC_TREE); + DBGPacket.addFrame(DBGFrame); + + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); + + // Wait response (1 second) and read response + waitResponse(1000); + flushAllPackets(); } public void addDBGModName(String modName) throws IOException { @@ -80,6 +97,7 @@ public class PHPDBGInterface { DBGPacket.addFrame(DBGFrame); + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); } @@ -128,6 +146,7 @@ public class PHPDBGInterface { // Second add command data DBGPacket.addFrame(DBGFrame1); + if(proxy.getSocket().isClosed()) return 0; DBGPacket.sendPacket(os); clearLastBP(); @@ -156,6 +175,7 @@ public class PHPDBGInterface { public void continueExecution() throws IOException { BPUnderHit= 0; PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_CONTINUE); + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); } @@ -176,24 +196,28 @@ public class PHPDBGInterface { public void stepInto() throws IOException { BPUnderHit= 0; PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STEPINTO); + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); } public void stepOver() throws IOException { BPUnderHit= 0; PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STEPOVER); + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); } public void stepOut() throws IOException { BPUnderHit= 0; PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STEPOUT); + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); } public void stopExecution() throws IOException { BPUnderHit= 0; PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STOP); + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); } @@ -216,6 +240,7 @@ public class PHPDBGInterface { // Add command data DBGPacket.addFrame(DBGFrame1); + if(proxy.getSocket().isClosed()) return null; DBGPacket.sendPacket(os); waitResponse(1000); @@ -246,6 +271,7 @@ public class PHPDBGInterface { // Add command data DBGPacket.addFrame(DBGFrame1); + if(proxy.getSocket().isClosed()) return; DBGPacket.sendPacket(os); waitResponse(1000); @@ -538,6 +564,7 @@ public class PHPDBGInterface { int[] dbg_bpl_tmp= new int[10]; int[] dbg_frame= new int[2]; int[] dbg_eval_tmp= new int[3]; + int[] dbg_src_tree_tmp= new int[4]; Vector rawList= new Vector(); Vector stackList= new Vector(); PHPStackFrame[] newStackList; @@ -588,6 +615,21 @@ public class PHPDBGInterface { case PHPDBGBase.FRAME_SOURCE: break; case PHPDBGBase.FRAME_SRC_TREE: + dbg_src_tree_tmp[0] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 0); // parent_mod_no + dbg_src_tree_tmp[1] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 4); // parent_line_no /* NOT USED */ + dbg_src_tree_tmp[2] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 8); // mod_no + dbg_src_tree_tmp[3] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 12); // imod_name + + if(getModByNo(dbg_src_tree_tmp[2]).equals("")) { + String fileName= new String(getRawFrameData(entirePack, dbg_src_tree_tmp[3])); + // Remove '\0' char + if(fileName.length() > 0) fileName= fileName.substring(0, fileName.length() - 1); + + if(dbg_src_tree_tmp[2] != 0) { + PHPDBGMod modNew= new PHPDBGMod(dbg_src_tree_tmp[2], fileName); + DBGMods.add(modNew); + } + } break; case PHPDBGBase.FRAME_RAWDATA: break;