1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 Vicente Fernando - www.alfersoft.com.ar - Initial implementation
10 Christian Perkonig - remote debug
11 **********************************************************************/
12 package net.sourceforge.phpdt.internal.debug.core;
14 import java.io.IOException;
15 import java.io.BufferedReader;
16 import java.io.OutputStream;
17 import java.util.Vector;
18 import java.lang.System;
19 import org.eclipse.debug.core.DebugException;
20 import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
21 import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable;
22 import net.sourceforge.phpdt.internal.debug.core.model.PHPValue;
23 import net.sourceforge.phpdt.internal.debug.core.PHPDBGMod;
25 public class PHPDBGInterface {
28 public boolean sessionEnded= false;
29 public int sessType= -1;
30 public int BPUnderHit= 0;
31 public String sessID= new String();
34 private int[] LastBPRead= new int[10];
35 private Vector DBGBPList= new Vector();
36 private PHPStackFrame[] DBGStackList;
37 private PHPVariable[] DBGVariableList;
38 private Vector DBGMods= new Vector();
39 private Vector DBGVars= new Vector();
40 private BufferedReader in;
41 private OutputStream os;
42 private boolean shouldStop= false, isRef= false, hasChildren= false, isObject= false;
43 private String evalRet= new String("");
44 private String serGlobals= new String("");
45 private String typeRead= new String("");
46 private String className= new String("");
47 private int finalPos=0, refCounter=0, rawCounter=1000;
48 private PHPDBGProxy proxy= null;
49 private int lastCmd=-1;
52 public PHPDBGInterface(BufferedReader in, OutputStream os, PHPDBGProxy proxy) {
59 public int addBreakpoint(String mod_name, int line) throws IOException {
60 return setBreakpoint(mod_name, "", line, PHPDBGBase.BPS_ENABLED + PHPDBGBase.BPS_UNRESOLVED, 0, 0, 0, 0, 0);
63 public void removeBreakpoint(String mod_name, int line, int bpNo) throws IOException {
64 setBreakpoint(mod_name, "", line, PHPDBGBase.BPS_DISABLED, 0, 0, 0, bpNo, 0);
67 public void requestDBGVersion() throws IOException {
68 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_REQUEST);
69 PHPDBGFrame DBGFrame= new PHPDBGFrame(PHPDBGBase.FRAME_VER);
71 DBGPacket.addFrame(DBGFrame);
73 if(proxy.getSocket().isClosed()) return;
74 DBGPacket.sendPacket(os);
77 public void getSourceTree() throws IOException {
78 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_REQUEST);
79 PHPDBGFrame DBGFrame= new PHPDBGFrame(PHPDBGBase.FRAME_SRC_TREE);
81 DBGPacket.addFrame(DBGFrame);
83 if(proxy.getSocket().isClosed()) return;
84 DBGPacket.sendPacket(os);
86 // Wait response (1 second) and read response
91 public void addDBGModName(String modName) throws IOException {
92 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_REQUEST);
93 PHPDBGFrame DBGFrame= new PHPDBGFrame(PHPDBGBase.FRAME_RAWDATA);
96 DBGFrame.addInt(rawCounter); // FRAME_RAWDATA ID
97 DBGFrame.addInt(modName.length() + 1); // length of rawdata (+ null char)
98 DBGFrame.addString(modName); // file name
99 DBGFrame.addChar('\0'); // null char
101 DBGPacket.addFrame(DBGFrame);
103 if(proxy.getSocket().isClosed()) return;
104 DBGPacket.sendPacket(os);
107 // Returns DBG Breakpoint ID
108 private int setBreakpoint(String mod_name, String condition, int line, int state, int istemp, int hitcount, int skiphits, int bpno, int isunderhit) throws IOException {
111 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_REQUEST);
112 PHPDBGFrame DBGFrame1= new PHPDBGFrame(PHPDBGBase.FRAME_BPS);
113 PHPDBGFrame DBGFrame2= new PHPDBGFrame(PHPDBGBase.FRAME_RAWDATA);
115 modNo= getModByName(mod_name);
118 DBGFrame1.addInt(modNo); // mod number
120 DBGFrame1.addInt(0); // mod number (0 use file name)
123 DBGFrame1.addInt(line); // line number
126 DBGFrame1.addInt(0); // use mod number
129 DBGFrame1.addInt(rawCounter); // ID of FRAME_RAWDATA to send file name
132 DBGFrame1.addInt(state); // state BPS_*
133 DBGFrame1.addInt(istemp); // istemp
134 DBGFrame1.addInt(hitcount); // hit count
135 DBGFrame1.addInt(skiphits); // skip hits
136 DBGFrame1.addInt(0); // ID of condition
137 DBGFrame1.addInt(bpno); // breakpoint number
138 DBGFrame1.addInt(isunderhit); // is under hit
141 DBGFrame2.addInt(rawCounter); // FRAME_RAWDATA ID
142 DBGFrame2.addInt(mod_name.length() + 1); // length of rawdata (+ null char)
143 DBGFrame2.addString(mod_name); // file name
144 DBGFrame2.addChar('\0'); // null char
145 // First add file name data
146 DBGPacket.addFrame(DBGFrame2);
149 // Second add command data
150 DBGPacket.addFrame(DBGFrame1);
152 if(proxy.getSocket().isClosed()) return 0;
153 DBGPacket.sendPacket(os);
157 // Wait response (1 second) and read response
161 return LastBPRead[8];
164 private void clearLastBP() {
167 for(i=0; i < LastBPRead.length; i++)
171 private void copyToLastBP(int[] BPBody) {
174 for(i=0; i < LastBPRead.length; i++)
175 LastBPRead[i]= BPBody[i];
178 public void continueExecution() throws IOException {
180 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_CONTINUE);
181 if(proxy.getSocket().isClosed()) return;
182 DBGPacket.sendPacket(os);
185 private int getBPUnderHit() {
187 int[] dbg_bpl_body= new int[10];
189 // look for bp under hit
190 for(i=0; i < DBGBPList.size(); i++) {
191 dbg_bpl_body= (int[]) DBGBPList.get(i);
192 if(dbg_bpl_body[9] == 1) {
193 BPUnder= dbg_bpl_body[8];
199 public int getLastCmd()
209 public void setLastCmd(int cmd)
214 public void stepInto() throws IOException {
216 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STEPINTO);
217 if(proxy.getSocket().isClosed()) return;
218 DBGPacket.sendPacket(os);
221 public void stepOver() throws IOException {
223 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STEPOVER);
224 if(proxy.getSocket().isClosed()) return;
225 DBGPacket.sendPacket(os);
228 public void stepOut() throws IOException {
230 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STEPOUT);
231 if(proxy.getSocket().isClosed()) return;
232 DBGPacket.sendPacket(os);
235 public void stopExecution() throws IOException {
237 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_STOP);
238 if(proxy.getSocket().isClosed()) return;
239 DBGPacket.sendPacket(os);
242 public PHPVariable[] getVariables(PHPStackFrame stack) throws IOException, DebugException {
243 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_REQUEST);
244 PHPDBGFrame DBGFrame1= new PHPDBGFrame(PHPDBGBase.FRAME_EVAL);
245 //PHPDBGFrame DBGFrame2= new PHPDBGFrame(PHPDBGBase.FRAME_RAWDATA);
247 DBGFrame1.addInt(0); // istr = raw data ID
248 DBGFrame1.addInt(1); // scope_id = -1 means current location, 0 never used, +1 first depth
251 String evalBlock= new String("$GLOBALS");
252 DBGFrame2.addInt(1); // FRAME_RAWDATA ID
253 DBGFrame2.addInt(evalBlock.length() + 1); // length of rawdata (+ null char)
254 DBGFrame2.addString(evalBlock); // eval block
255 DBGFrame2.addChar('\0'); // null char
259 DBGPacket.addFrame(DBGFrame1);
261 if(proxy.getSocket().isClosed()) return null;
262 DBGPacket.sendPacket(os);
267 // Process serialized variables
268 DBGVariableList= procVars(stack);
270 return DBGVariableList;
273 public void evalBlock(String evalString) throws IOException, DebugException {
274 PHPDBGPacket DBGPacket= new PHPDBGPacket(PHPDBGBase.DBGA_REQUEST);
275 PHPDBGFrame DBGFrame1= new PHPDBGFrame(PHPDBGBase.FRAME_EVAL);
276 PHPDBGFrame DBGFrame2= new PHPDBGFrame(PHPDBGBase.FRAME_RAWDATA);
279 DBGFrame1.addInt(rawCounter); // istr = raw data ID
280 DBGFrame1.addInt(1); // scope_id = -1 means current location, 0 never used, +1 first depth
282 DBGFrame2.addInt(rawCounter); // FRAME_RAWDATA ID
283 DBGFrame2.addInt(evalString.length() + 1); // length of rawdata (+ null char)
284 DBGFrame2.addString(evalString); // eval block
285 DBGFrame2.addChar('\0'); // null char
287 // Add raw data first
288 DBGPacket.addFrame(DBGFrame2);
290 DBGPacket.addFrame(DBGFrame1);
292 if(proxy.getSocket().isClosed()) return;
293 DBGPacket.sendPacket(os);
299 public void flushAllPackets() throws IOException {
300 while(readResponse() != 0);
303 public String getModByNo(int modNo) {
308 for(i=0; i < DBGMods.size(); i++) {
309 dbg_mod= (PHPDBGMod) DBGMods.get(i);
310 if(dbg_mod.getNo() == modNo) {
311 return dbg_mod.getName();
317 private int getModByName(String modName) {
322 for(i=0; i < DBGMods.size(); i++) {
323 dbg_mod= (PHPDBGMod) DBGMods.get(i);
324 if(dbg_mod.getName().equalsIgnoreCase(modName)) {
325 return dbg_mod.getNo();
331 private String getRawFrameData(char[] framesInfo, int frameNo) {
333 int[] dbg_frame= new int[2];
335 while(nextFrame < framesInfo.length) {
336 dbg_frame[0] = PHPDBGBase.Char4ToInt(framesInfo, nextFrame); // frame name
337 dbg_frame[1] = PHPDBGBase.Char4ToInt(framesInfo, nextFrame + 4); // frame size
340 if(dbg_frame[1] == 0) return "";
342 switch(dbg_frame[0]) {
343 case PHPDBGBase.FRAME_RAWDATA:
344 if(frameNo == PHPDBGBase.Char4ToInt(framesInfo, nextFrame)) {
345 int toRead= PHPDBGBase.Char4ToInt(framesInfo, nextFrame + 4);
346 return String.copyValueOf(framesInfo, nextFrame + 8, toRead);
351 nextFrame += dbg_frame[1];
356 public PHPVariable[] getInstVars(PHPVariable phpVar) throws DebugException {
357 Vector vecVars= new Vector();
358 PHPVariable localPHPVar;
361 // already unserialized
362 for(i=0; i < DBGVars.size(); i++) {
363 localPHPVar= (PHPVariable)DBGVars.get(i);
364 if(localPHPVar.getParent() == phpVar) {
365 vecVars.add(localPHPVar);
368 PHPVariable[] arrVars= new PHPVariable[vecVars.size()];
369 arrVars= (PHPVariable[]) vecVars.toArray(arrVars);
374 private PHPVariable[] procVars(PHPStackFrame stack) throws DebugException {
375 Vector vecVars= new Vector();
380 doUnserialize(stack, vecVars, null);
384 return(getInstVars(null));
387 private String readValue(String serialVars) throws DebugException {
388 int startPos=0, endPos=0, lenStr=0, i=0, elements=0;
389 String ret= new String("");
391 switch(serialVars.charAt(0)) {
392 case 'a': // associative array, a:elements:{[index][value]...}
395 endPos= serialVars.indexOf(':', startPos + 1);
396 if(endPos == -1) return "";
397 finalPos += endPos + 2;
398 ret= new String(serialVars.substring(startPos + 1, endPos));
402 case 'O': // object, O:name_len:"name":elements:{[attribute][value]...}
406 endPos= serialVars.indexOf(':', startPos + 1);
407 if(endPos == -1) return "";
410 lenStr= Integer.parseInt(serialVars.substring(startPos + 1, endPos));
411 startPos= endPos + 2;
412 endPos= lenStr + startPos;
413 className= new String(serialVars.substring(startPos, endPos).toString());
415 // get num of elements
416 startPos= endPos + 1;
417 endPos= serialVars.indexOf(':', startPos + 1);
418 if(endPos == -1) return "";
419 finalPos += endPos + 2;
420 ret= new String(serialVars.substring(startPos + 1, endPos));
425 case 's': // string, s:length:"data";
428 endPos= serialVars.indexOf(':', startPos + 1);
429 if(endPos == -1) return "";
431 lenStr= Integer.parseInt(serialVars.substring(startPos + 1, endPos));
432 startPos= endPos + 2;
433 endPos= lenStr + startPos;
434 ret= new String(serialVars.substring(startPos, endPos).toString());
435 finalPos += endPos + 2;
437 case 'i': // integer, i:123;
440 endPos= serialVars.indexOf(';', startPos + 1);
441 if(endPos == -1) return "";
443 ret= new String(serialVars.substring(startPos + 1, endPos).toString());
444 finalPos += endPos + 1;
446 case 'd': // double (float), d:1.23;
449 endPos= serialVars.indexOf(';', startPos + 1);
450 if(endPos == -1) return "";
452 ret= new String(serialVars.substring(startPos + 1, endPos).toString());
453 finalPos += endPos + 1;
455 case 'N': // NULL, N;
460 case 'b': // bool, b:0 or 1
462 ret= (serialVars.charAt(2) == '1')?"true":"false";
463 finalPos += endPos + 4;
465 case 'z': // resource, z:typename_len:"typename":valres;
466 typeRead= "resource";
469 endPos= serialVars.indexOf(':', startPos + 1);
470 if(endPos == -1) return "";
472 // get resource type name
473 lenStr= Integer.parseInt(serialVars.substring(startPos + 1, endPos));
474 startPos= endPos + 2;
475 endPos= lenStr + startPos;
476 className= new String(serialVars.substring(startPos, endPos).toString());
478 // get resource value
479 startPos= endPos + 1;
480 endPos= serialVars.indexOf(';', startPos + 1);
481 if(endPos == -1) return "";
482 ret= new String(serialVars.substring(startPos + 1, endPos));
483 finalPos += endPos + 1;
487 typeRead= "reference";
489 endPos= serialVars.indexOf(';', startPos + 1);
490 if(endPos == -1) return "0";
492 ret= new String(serialVars.substring(startPos + 1, endPos));
493 finalPos += endPos + 1;
510 private void doUnserialize(PHPStackFrame stack, Vector vecVars, PHPVariable parent) throws DebugException {
512 PHPVariable newVar= null;
513 String value= new String("");
514 String name= new String("");
515 String tmp= new String("");
518 if(finalPos > serGlobals.length() || serGlobals.equals("") || serGlobals.substring(finalPos).equals("")) return;
523 name= readValue(serGlobals.substring(finalPos));
527 if(refCounter == 0) {
534 value= readValue(serGlobals.substring(finalPos));
535 // replaceAll doesn't work, why???
536 tmpSplit= value.split("\\\\");
538 for(i= 0; i < tmpSplit.length; i++) {
539 value= value + tmpSplit[i];
540 if(!tmpSplit[i].equals("")) {
541 if(i < (tmpSplit.length - 1)) {
548 if(!name.equals("")) {
551 for(i=0; i < vecVars.size(); i++) {
552 varPHP= (PHPVariable) vecVars.get(i);
553 if(varPHP.getObjectId().equals(value)) {
554 newVar= new PHPVariable(stack, name, "local", true, (PHPValue)varPHP.getValue());
559 newVar= new PHPVariable(stack, name, "local", false, null);
563 newVar= new PHPVariable(stack, name, "local", value, typeRead, hasChildren, Integer.toString(refCounter), className);
565 newVar.setParent(parent);
569 elements= Integer.parseInt(value);
570 for(i=0; i < elements; i++)
571 doUnserialize(stack, vecVars, newVar);
578 public int readResponse() throws IOException {
579 int bytesToRead=0, nextFrame=0, i=0, cmdReceived=0, stackIndex=0;
580 char[] dbg_header_struct_read= new char[16];
581 int[] dbg_header_struct= new int[4];
582 int[] dbg_bpl_tmp= new int[10];
583 int[] dbg_frame= new int[2];
584 int[] dbg_eval_tmp= new int[3];
585 int[] dbg_src_tree_tmp= new int[4];
586 Vector rawList= new Vector();
587 Vector stackList= new Vector();
588 PHPStackFrame[] newStackList;
593 while(readInput(dbg_header_struct_read, 16) != 0) {
594 dbg_header_struct[0] = PHPDBGBase.Char4ToInt(dbg_header_struct_read, 0);
595 dbg_header_struct[1] = PHPDBGBase.Char4ToInt(dbg_header_struct_read, 4);
596 dbg_header_struct[2] = PHPDBGBase.Char4ToInt(dbg_header_struct_read, 8);
597 dbg_header_struct[3] = PHPDBGBase.Char4ToInt(dbg_header_struct_read, 12);
599 // Check DBG sync bytes
600 if(dbg_header_struct[0] != 0x5953) return 0;
602 cmdReceived= dbg_header_struct[1];
603 setLastCmd(cmdReceived);
604 bytesToRead= dbg_header_struct[3];
606 //System.out.println("Response Received: " + cmdReceived);
607 char[] entirePack= new char[bytesToRead];
609 if(bytesToRead > 0) {
610 if(readInput(entirePack, bytesToRead) < bytesToRead) return 0;
613 // First process frames
615 while(nextFrame < bytesToRead) {
616 dbg_frame[0] = PHPDBGBase.Char4ToInt(entirePack, nextFrame); // frame name
617 dbg_frame[1] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 4); // frame size
619 if(dbg_frame[1] == 0) return 0;
620 switch(dbg_frame[0]) {
621 case PHPDBGBase.FRAME_STACK:
622 int[] dbg_stack_new= new int[4];
623 dbg_stack_new[0] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 0); // line no
624 dbg_stack_new[1] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 4); // mod no
625 dbg_stack_new[2] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 8); // scope id
626 dbg_stack_new[3] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 12); // id of description string
629 if(dbg_stack_new[1] != 0) {
630 PHPStackFrame newStack= new PHPStackFrame(null, getModByNo(dbg_stack_new[1]), dbg_stack_new[0], stackIndex, getRawFrameData(entirePack, dbg_stack_new[3]), dbg_stack_new[1]);
631 stackList.add(newStack);
634 case PHPDBGBase.FRAME_SOURCE:
636 case PHPDBGBase.FRAME_SRC_TREE:
637 dbg_src_tree_tmp[0] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 0); // parent_mod_no
638 dbg_src_tree_tmp[1] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 4); // parent_line_no /* NOT USED */
639 dbg_src_tree_tmp[2] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 8); // mod_no
640 dbg_src_tree_tmp[3] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 12); // imod_name
642 if(getModByNo(dbg_src_tree_tmp[2]).equals("")) {
643 String fileName= new String(getRawFrameData(entirePack, dbg_src_tree_tmp[3]));
645 if(fileName.length() > 0) fileName= fileName.substring(0, fileName.length() - 1);
647 if(dbg_src_tree_tmp[2] != 0) {
648 PHPDBGMod modNew= new PHPDBGMod(dbg_src_tree_tmp[2], fileName);
653 case PHPDBGBase.FRAME_RAWDATA:
655 case PHPDBGBase.FRAME_ERROR:
657 case PHPDBGBase.FRAME_EVAL:
658 String evalString= new String("");
659 dbg_eval_tmp[0] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 0); // istr
660 dbg_eval_tmp[1] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 4); // iresult
661 dbg_eval_tmp[2] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 8); // ierror
663 evalRet= getRawFrameData(entirePack, dbg_eval_tmp[1]);
664 evalString= getRawFrameData(entirePack, dbg_eval_tmp[0]);
667 case PHPDBGBase.FRAME_BPS:
669 case PHPDBGBase.FRAME_BPL:
670 int[] dbg_bpl_new= new int[10];
671 dbg_bpl_new[0] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 0);
672 dbg_bpl_new[1] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 4);
673 dbg_bpl_new[2] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 8);
674 dbg_bpl_new[3] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 12);
675 dbg_bpl_new[4] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 16);
676 dbg_bpl_new[5] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 20);
677 dbg_bpl_new[6] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 24);
678 dbg_bpl_new[7] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 28);
679 dbg_bpl_new[8] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 32);
680 dbg_bpl_new[9] = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 36);
682 // look if breakpoint already exists in vector
683 for(i=0; i < DBGBPList.size(); i++) {
684 dbg_bpl_tmp= (int[]) DBGBPList.get(i);
685 if(dbg_bpl_tmp[8] == dbg_bpl_new[8]) {
691 // add breakpoint to vector
692 DBGBPList.add(dbg_bpl_new);
693 copyToLastBP(dbg_bpl_new);
696 if(getModByNo(dbg_bpl_new[0]).equals("")) {
697 String fileName= new String(getRawFrameData(entirePack, dbg_bpl_new[2]));
699 if(fileName.length() > 0) fileName= fileName.substring(0, fileName.length() - 1);
700 if(dbg_bpl_new[0] != 0) {
701 PHPDBGMod modNew= new PHPDBGMod(dbg_bpl_new[0], fileName);
706 case PHPDBGBase.FRAME_VER:
708 case PHPDBGBase.FRAME_SID:
709 sid = PHPDBGBase.Char4ToInt(entirePack, nextFrame + 0);
711 case PHPDBGBase.FRAME_SRCLINESINFO:
713 case PHPDBGBase.FRAME_SRCCTXINFO:
715 case PHPDBGBase.FRAME_LOG:
717 case PHPDBGBase.FRAME_PROF:
719 case PHPDBGBase.FRAME_PROF_C:
721 case PHPDBGBase.FRAME_SET_OPT:
725 nextFrame += dbg_frame[1];
728 // Now process command
729 switch(cmdReceived) {
730 case PHPDBGBase.DBGC_REPLY:
732 case PHPDBGBase.DBGC_STARTUP:
734 case PHPDBGBase.DBGC_END:
737 case PHPDBGBase.DBGC_BREAKPOINT:
738 newStackList= new PHPStackFrame[stackList.size()];
739 newStackList= (PHPStackFrame[]) stackList.toArray(newStackList);
740 DBGStackList= newStackList;
741 BPUnderHit= getBPUnderHit();
743 case PHPDBGBase.DBGC_STEPINTO_DONE:
744 case PHPDBGBase.DBGC_STEPOVER_DONE:
745 case PHPDBGBase.DBGC_STEPOUT_DONE:
746 case PHPDBGBase.DBGC_EMBEDDED_BREAK:
748 newStackList= new PHPStackFrame[stackList.size()];
749 newStackList= (PHPStackFrame[]) stackList.toArray(newStackList);
750 DBGStackList= newStackList;
752 case PHPDBGBase.DBGC_ERROR:
753 newStackList= new PHPStackFrame[stackList.size()];
754 newStackList= (PHPStackFrame[]) stackList.toArray(newStackList);
755 DBGStackList= newStackList;
757 case PHPDBGBase.DBGC_LOG:
759 case PHPDBGBase.DBGC_SID:
761 case PHPDBGBase.DBGC_PAUSE:
769 public PHPStackFrame[] getStackList() {
773 private int readInput(char[] buffer, int bytes) throws IOException {
776 for(int i=0; i < bytes; i++) {
778 buffer[i]= (char) (in.read() & 0x00FF);
787 public void setShouldStop() {
788 this.shouldStop= true;
791 public boolean waitResponse(long milliseconds) throws IOException {
792 long timeout= System.currentTimeMillis() + milliseconds;
793 while(System.currentTimeMillis() < timeout) {
794 if(in.ready() || shouldStop) {