Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.core / src / net / sourceforge / phpdt / internal / debug / core / PHPDBGInterface.java
index cf17c49..4da1970 100644 (file)
@@ -17,6 +17,7 @@ import java.io.OutputStream;
 import java.util.Collections;
 import java.util.Vector;
 
+//import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy.PHPLoop;
 import net.sourceforge.phpdt.internal.debug.core.model.PHPDBGEvalString;
 import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
 import net.sourceforge.phpdt.internal.debug.core.model.PHPValue;
@@ -48,7 +49,7 @@ public class PHPDBGInterface {
        private String                  evalRet = new String("");
        private int                             rawCounter = 1000;                                      // An rawData frame ID counter
        private PHPDBGProxy             proxy = null;
-       private int                             lastCmd = -1;
+       //private int                           lastCmd = -1;
        private int                             sid = 0;
        private boolean                         stopOnError = false;
        private char[]                  lastCommand = new char[4];
@@ -95,21 +96,21 @@ public class PHPDBGInterface {
         * Is this method used anywhere?
         *
         */
-       public void requestDBGVersion () throws IOException {
-               PHPDBGPacket DBGPacket;                                     // A DBG message packet
-               PHPDBGFrame  DBGFrame;                                      // A frame within a DBG packet
-
-               DBGPacket = new PHPDBGPacket (PHPDBGBase.DBGA_REQUEST);     // A request for DBG
-               DBGFrame  = new PHPDBGFrame (PHPDBGBase.FRAME_VER);         // We want the version of DBG
-
-               DBGPacket.addFrame (DBGFrame);                              // Add the 'what we want' to the DBG packet
-
-               if (proxy.getSocket ().isClosed ()) {                                           // Can we communiate with DBG?
-                       return;                                                 //  No
-               }
-
-               DBGPacket.sendPacket (os);                                                                      // Send the request to DBG
-       }
+//     public void requestDBGVersion () throws IOException {
+//             PHPDBGPacket DBGPacket;                                     // A DBG message packet
+//             PHPDBGFrame  DBGFrame;                                      // A frame within a DBG packet
+//
+//             DBGPacket = new PHPDBGPacket (PHPDBGBase.DBGA_REQUEST);     // A request for DBG
+//             DBGFrame  = new PHPDBGFrame (PHPDBGBase.FRAME_VER);         // We want the version of DBG
+//
+//             DBGPacket.addFrame (DBGFrame);                              // Add the 'what we want' to the DBG packet
+//
+//             if (proxy.getSocket ().isClosed ()) {                                           // Can we communiate with DBG?
+//                     return;                                                 //  No
+//             }
+//
+//             DBGPacket.sendPacket (os);                                                                      // Send the request to DBG
+//     }
 
        /**
         * Called by the proxy
@@ -139,27 +140,27 @@ public class PHPDBGInterface {
         *
         * @param modName The modul (filename).
         */
-       public void addDBGModName (String modName) throws IOException {
-               PHPDBGPacket DBGPacket;                                     // A DBG message packet
-               PHPDBGFrame  DBGFrame;                                      // A frame within a DBG packet
-
-               DBGPacket = new PHPDBGPacket (PHPDBGBase.DBGA_REQUEST);     // A request for DBG
-               DBGFrame  = new PHPDBGFrame (PHPDBGBase.FRAME_RAWDATA);     // We want Module name from DBG
-
-               rawCounter++;                                               // Increment the rawData ID counter
-               DBGFrame.addInt (rawCounter);                                                           // FRAME_RAWDATA ID
-               DBGFrame.addInt (modName.length () + 1);                                        // The length of rawdata string (incl. null char termination)
-               DBGFrame.addString (modName);                                                           // The file name (module name)
-               DBGFrame.addChar ('\0');                                                                        // Add the C-String null termination
-
-               DBGPacket.addFrame (DBGFrame);
-
-               if (proxy.getSocket ().isClosed ()) {                                           // Can we communiate with DBG?
-                       return;                                                                                                 //  No
-               }
-
-               DBGPacket.sendPacket (os);
-       }
+//     public void addDBGModName (String modName) throws IOException {
+//             PHPDBGPacket DBGPacket;                                     // A DBG message packet
+//             PHPDBGFrame  DBGFrame;                                      // A frame within a DBG packet
+//
+//             DBGPacket = new PHPDBGPacket (PHPDBGBase.DBGA_REQUEST);     // A request for DBG
+//             DBGFrame  = new PHPDBGFrame (PHPDBGBase.FRAME_RAWDATA);     // We want Module name from DBG
+//
+//             rawCounter++;                                               // Increment the rawData ID counter
+//             DBGFrame.addInt (rawCounter);                                                           // FRAME_RAWDATA ID
+//             DBGFrame.addInt (modName.length () + 1);                                        // The length of rawdata string (incl. null char termination)
+//             DBGFrame.addString (modName);                                                           // The file name (module name)
+//             DBGFrame.addChar ('\0');                                                                        // Add the C-String null termination
+//
+//             DBGPacket.addFrame (DBGFrame);
+//
+//             if (proxy.getSocket ().isClosed ()) {                                           // Can we communiate with DBG?
+//                     return;                                                                                                 //  No
+//             }
+//
+//             DBGPacket.sendPacket (os);
+//     }
 
        /**
         * This method is called for adding or removing breakpoints.
@@ -286,7 +287,6 @@ public class PHPDBGInterface {
                if (proxy.getSocket ().isClosed ()) {                                           // Can we communiate with DBG?
                        return;                                                 //  No
                }
-
                DBGPacket.sendPacket (os);                                  // Send the request to DBG
 
                lastCommand = PHPDBGBase.DBGA_CONTINUE;                     // Store the info about the command we sent
@@ -326,10 +326,10 @@ public class PHPDBGInterface {
                return BPUnder;
        }
 
-       public int getLastCmd()
-       {
-               return lastCmd;
-       }
+//     public int getLastCmd()
+//     {
+//             return lastCmd;
+//     }
 
        public int getSID()
        {
@@ -338,7 +338,7 @@ public class PHPDBGInterface {
 
        public void setLastCmd (int cmd)
        {
-               lastCmd = cmd;
+               //lastCmd = cmd;
        }
 
        /**
@@ -398,18 +398,18 @@ public class PHPDBGInterface {
        /**
         *
         */
-       public void stopExecution () throws IOException {
-               PHPDBGPacket DBGPacket;
-
-               BPUnderHit = 0;
-               DBGPacket  = new PHPDBGPacket (PHPDBGBase.DBGA_STOP);
-
-               if (proxy.getSocket ().isClosed ()) {                                           // Can we communiate with DBG?
-                       return;                                                 //  No
-               }
-
-               DBGPacket.sendPacket (os);                                  // Send the request to DBG
-       }
+//     public void stopExecution () throws IOException {
+//             PHPDBGPacket DBGPacket;
+//
+//             BPUnderHit = 0;
+//             DBGPacket  = new PHPDBGPacket (PHPDBGBase.DBGA_STOP);
+//
+//             if (proxy.getSocket ().isClosed ()) {                                           // Can we communiate with DBG?
+//                     return;                                                 //  No
+//             }
+//
+//             DBGPacket.sendPacket (os);                                  // Send the request to DBG
+//     }
 
        /**
         * This method is called by the proxy.
@@ -427,7 +427,12 @@ public class PHPDBGInterface {
                }
 
                // get global variables (and assign them to 'main()' stackframe)
-               Vector globalList = getVariables(DBGStackList[DBGStackList.length - 1], PHPDBGBase.GLOBAL_SCOPE_ID);
+               int global_scope_id = (DBGStackList.length > 1) ? 2 : PHPDBGBase.GLOBAL_SCOPE_ID;
+               // DBG 2.13.1 doesn't return Super Globals with GLOBAL_SCOPE_ID in nested stackframes,
+               // so using 2(most out-standing stack context) instead of GLOBAL_SCOPE_ID.
+               // Also note that 2.13.1 doesn't return $this in class context.
+               // (You can inspect $this in Expressions View. And once it is shown, 2.13.1 comes to return $this.)
+               Vector globalList = getVariables(DBGStackList[DBGStackList.length - 1], global_scope_id);
                if (!globalList.isEmpty()) {
                        // remove unresolved '$this=?' variable
                        removeUnresolvedThisVar(globalList);
@@ -1122,8 +1127,8 @@ public class PHPDBGInterface {
                                        break;
 
                                case PHPDBGBase.DBGC_END:
-                                       sessionEnded = true;
-                                       this.proxy.setTerminated();
+                                        sessionEnded = true; 
+                                        this.proxy.setTerminated(); 
                                        break;
 
                                case PHPDBGBase.DBGC_BREAKPOINT: