*** empty log message ***
authorwalsleben <walsleben>
Mon, 6 Dec 2004 18:03:46 +0000 (18:03 +0000)
committerwalsleben <walsleben>
Mon, 6 Dec 2004 18:03:46 +0000 (18:03 +0000)
13 files changed:
net.sourceforge.phpeclipse.xdebug.core/.classpath [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/.project [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/build.properties [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/plugin.xml [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/CorePlugin.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugConstants.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugElement.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugLineBreakpoint.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugStackFrame.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugTarget.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugThread.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugValue.java [new file with mode: 0644]
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugVariable.java [new file with mode: 0644]

diff --git a/net.sourceforge.phpeclipse.xdebug.core/.classpath b/net.sourceforge.phpeclipse.xdebug.core/.classpath
new file mode 100644 (file)
index 0000000..065ac06
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/net.sourceforge.phpeclipse.xdebug.core/.project b/net.sourceforge.phpeclipse.xdebug.core/.project
new file mode 100644 (file)
index 0000000..f34c1d9
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>net.sourceforge.phpeclipse.xdebug.core</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/net.sourceforge.phpeclipse.xdebug.core/build.properties b/net.sourceforge.phpeclipse.xdebug.core/build.properties
new file mode 100644 (file)
index 0000000..fa1ef1a
--- /dev/null
@@ -0,0 +1,4 @@
+source.core.jar = src/
+output.core.jar = bin/
+bin.includes = plugin.xml,\
+               core.jar
diff --git a/net.sourceforge.phpeclipse.xdebug.core/plugin.xml b/net.sourceforge.phpeclipse.xdebug.core/plugin.xml
new file mode 100644 (file)
index 0000000..7f752ef
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+   id="net.sourceforge.phpeclipse.xdebug.core"
+   name="Core Plug-in"
+   version="1.0.0"
+   provider-name=""
+   class="net.sourceforge.phpeclipse.xdebug.core.CorePlugin">
+
+   <runtime>
+      <library name="core.jar">
+         <export name="*"/>
+      </library>
+   </runtime>
+
+   <requires>
+      <import plugin="org.eclipse.ui"/>
+      <import plugin="org.eclipse.core.runtime"/>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.debug.core"/>
+      <import plugin="net.sourceforge.phpeclipse"/>
+      <import plugin="net.sourceforge.phpeclipse.debug.core"/>
+   </requires>
+
+   <extension
+         point="org.eclipse.debug.core.breakpoints">
+      <breakpoint
+            markerType="net.sourceforge.phpeclipse.xdebug.core.lineBreakpoint.marker"
+            class="net.sourceforge.phpeclipse.xdebug.core.XDebugLineBreakpoint"
+            id="net.sourceforge.phpeclipse.xdebug.core.lineBreakpoint">
+      </breakpoint>
+   </extension>
+   <extension
+         id="XDebug.lineBreakpoint.marker"
+         point="org.eclipse.core.resources.markers">
+      <super
+            type="org.eclipse.debug.core.lineBreakpointMarker">
+      </super>
+      <persistent
+            value="true">
+      </persistent>
+   </extension>
+
+</plugin>
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/CorePlugin.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/CorePlugin.java
new file mode 100644 (file)
index 0000000..7ce333d
--- /dev/null
@@ -0,0 +1,69 @@
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+import java.util.*;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class CorePlugin extends Plugin {
+       //The shared instance.
+       private static CorePlugin plugin;
+       //Resource bundle.
+       private ResourceBundle resourceBundle;
+       
+       /**
+        * The constructor.
+        */
+       public CorePlugin() {
+               super();
+               plugin = this;
+               try {
+                       resourceBundle = ResourceBundle.getBundle("net.sourceforge.phpeclipse.xdebug.core.CorePluginResources");
+               } catch (MissingResourceException x) {
+                       resourceBundle = null;
+               }
+       }
+
+       /**
+        * This method is called upon plug-in activation
+        */
+       public void start(BundleContext context) throws Exception {
+               super.start(context);
+       }
+
+       /**
+        * This method is called when the plug-in is stopped
+        */
+       public void stop(BundleContext context) throws Exception {
+               super.stop(context);
+       }
+
+       /**
+        * Returns the shared instance.
+        */
+       public static CorePlugin getDefault() {
+               return plugin;
+       }
+
+       /**
+        * Returns the string from the plugin's resource bundle,
+        * or 'key' if not found.
+        */
+       public static String getResourceString(String key) {
+               ResourceBundle bundle = CorePlugin.getDefault().getResourceBundle();
+               try {
+                       return (bundle != null) ? bundle.getString(key) : key;
+               } catch (MissingResourceException e) {
+                       return key;
+               }
+       }
+
+       /**
+        * Returns the plugin's resource bundle,
+        */
+       public ResourceBundle getResourceBundle() {
+               return resourceBundle;
+       }
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugConstants.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugConstants.java
new file mode 100644 (file)
index 0000000..fdabf98
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Created on 23.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface IXDebugConstants {
+       
+       /**
+        * Unique identifier for the PDA debug model (value 
+        * <code>org.eclipse.debug.examples.pda</code>).
+        */
+       public static final String ID_XDEBUG_DEBUG_MODEL = "net.sourceforge.phpeclipse.xdebug.core";
+       
+       /**
+        * Name of the string substitution variable that resolves to the
+        * location of a local Perl executable (value <code>perlExecutable</code>).
+        */
+       public static final String ID_PERL_EXECUTABLE = "perlExecutable";
+       /**
+        * Launch configuration key. Value is a path to a perl
+        * program. The path is a string representing a full path
+        * to a perl program in the workspace. 
+        */
+       public static final String ATTR_XDEBUG_PROGRAM = ID_XDEBUG_DEBUG_MODEL + ".ATTR_XDEBUG_PROGRAM";
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugElement.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugElement.java
new file mode 100644 (file)
index 0000000..dc1958a
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Created on 23.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public abstract class XDebugElement extends PlatformObject implements IDebugElement {
+       
+       // containing target 
+       protected XDebugTarget fTarget;
+       
+       /**
+        * Constructs a new debug element contained in the given
+        * debug target.
+        * 
+        * @param target debug target (PDA VM)
+        */
+       public XDebugElement(XDebugTarget target) {
+               fTarget = target;
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
+        */
+       public String getModelIdentifier() {
+//             return IPDAConstants.ID_PDA_DEBUG_MODEL;
+               return null;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
+        */
+       public IDebugTarget getDebugTarget() {
+               return fTarget;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
+        */
+       public ILaunch getLaunch() {
+               return getDebugTarget().getLaunch();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+        */
+       public Object getAdapter(Class adapter) {
+               if (adapter == IDebugElement.class) {
+                       return this;
+               }
+               return super.getAdapter(adapter);
+       }
+       
+       protected void abort(String message, Throwable e) throws DebugException {
+/*     Axel auskommentiert
+               throw new DebugException(new Status(IStatus.ERROR, DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 
+                               DebugPlugin.INTERNAL_ERROR, message, e));
+*/
+               }
+       
+       /**
+        * Fires a debug event
+        * 
+        * @param event the event to be fired
+        */
+       protected void fireEvent(DebugEvent event) {
+               DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
+       }
+       
+       /**
+        * Fires a <code>CREATE</code> event for this element.
+        */
+       protected void fireCreationEvent() {
+               fireEvent(new DebugEvent(this, DebugEvent.CREATE));
+       }       
+       
+       /**
+        * Fires a <code>RESUME</code> event for this element with
+        * the given detail.
+        * 
+        * @param detail event detail code
+        */
+       public void fireResumeEvent(int detail) {
+               fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
+       }
+
+       /**
+        * Fires a <code>SUSPEND</code> event for this element with
+        * the given detail.
+        * 
+        * @param detail event detail code
+        */
+       public void fireSuspendEvent(int detail) {
+               fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
+       }
+       
+       /**
+        * Fires a <code>TERMINATE</code> event for this element.
+        */
+       protected void fireTerminateEvent() {
+               fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
+       }       
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugLineBreakpoint.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugLineBreakpoint.java
new file mode 100644 (file)
index 0000000..135d4bc
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Created on 25.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.LineBreakpoint;
+import net.sourceforge.phpeclipse.xdebug.core.IXDebugConstants;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugLineBreakpoint  extends LineBreakpoint {
+       
+       /**
+        * Default constructor is required for the breakpoint manager
+        * to re-create persisted breakpoints. After instantiating a breakpoint,
+        * the <code>setMarker(...)</code> method is called to restore
+        * this breakpoint's attributes.
+        */
+       public XDebugLineBreakpoint() {
+       }
+       
+       /**
+        * Constructs a line breakpoint on the given resource at the given
+        * line number. The line number is 1-based (i.e. the first line of a
+        * file is line number 1). The PDA VM uses 0-based line numbers,
+        * so this line number translation is done at breakpoint install time.
+        * 
+        * @param resource file on which to set the breakpoint
+        * @param lineNumber 1-based line number of the breakpoint
+        * @throws CoreException if unable to create the breakpoint
+        */
+       public XDebugLineBreakpoint(IResource resource, int lineNumber) throws CoreException {
+               IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.lineBreakpoint.marker");
+               setMarker(marker);
+               setEnabled(true);
+               ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
+               ensureMarker().setAttribute(IBreakpoint.ID, IXDebugConstants.ID_XDEBUG_DEBUG_MODEL);
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
+        */
+       public String getModelIdentifier() {
+               return IXDebugConstants.ID_XDEBUG_DEBUG_MODEL;
+       }
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugStackFrame.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugStackFrame.java
new file mode 100644 (file)
index 0000000..8dfffb0
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * Created on 23.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IRegisterGroup;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.core.model.IVariable;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugStackFrame  extends XDebugElement implements IStackFrame {
+       
+       private XDebugThread fThread;
+       private String fName;
+       private int fPC;
+       private String fFileName;
+       private int fId;
+       private IVariable[] fVariables;
+       
+       /**
+        * Constructs a stack frame in the given thread with the given
+        * frame data.
+        * 
+        * @param thread
+        * @param data frame data
+        * @param id stack frame id (0 is the bottom of the stack)
+        */
+       public XDebugStackFrame(XDebugThread thread, String data, int id) {
+               super((XDebugTarget) thread.getDebugTarget());
+               fId = id;
+               fThread = thread;
+               init(data);
+       }
+       
+       /**
+        * Initializes this frame based on its data
+        * 
+        * @param data
+        */
+       private void init(String data) {
+               String[] strings = data.split("\\|");
+               String fileName = strings[0];
+               fFileName = (new Path(fileName)).lastSegment();
+               String pc = strings[1];
+               fPC = Integer.parseInt(pc) + 1;
+               fName = strings[2];
+               int numVars = strings.length - 3;
+               fVariables = new IVariable[numVars];
+               for (int i = 0; i < numVars; i++) {
+                       fVariables[i] = new XDebugVariable(this, strings[i + 3]);
+               }
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#getThread()
+        */
+       public IThread getThread() {
+               return fThread;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#getVariables()
+        */
+       public IVariable[] getVariables() throws DebugException {
+               return fVariables;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#hasVariables()
+        */
+       public boolean hasVariables() throws DebugException {
+               return fVariables.length > 0;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber()
+        */
+       public int getLineNumber() throws DebugException {
+               return fPC;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#getCharStart()
+        */
+       public int getCharStart() throws DebugException {
+               return -1;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd()
+        */
+       public int getCharEnd() throws DebugException {
+               return -1;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#getName()
+        */
+       public String getName() throws DebugException {
+               return fName;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups()
+        */
+       public IRegisterGroup[] getRegisterGroups() throws DebugException {
+               return null;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups()
+        */
+       public boolean hasRegisterGroups() throws DebugException {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#canStepInto()
+        */
+       public boolean canStepInto() {
+               return getThread().canStepInto();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#canStepOver()
+        */
+       public boolean canStepOver() {
+               return getThread().canStepOver();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#canStepReturn()
+        */
+       public boolean canStepReturn() {
+               return getThread().canStepReturn();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#isStepping()
+        */
+       public boolean isStepping() {
+               return getThread().isStepping();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#stepInto()
+        */
+       public void stepInto() throws DebugException {
+               getThread().stepInto();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#stepOver()
+        */
+       public void stepOver() throws DebugException {
+               getThread().stepOver();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#stepReturn()
+        */
+       public void stepReturn() throws DebugException {
+               getThread().stepReturn();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
+        */
+       public boolean canResume() {
+               return getThread().canResume();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
+        */
+       public boolean canSuspend() {
+               return getThread().canSuspend();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
+        */
+       public boolean isSuspended() {
+               return getThread().isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#resume()
+        */
+       public void resume() throws DebugException {
+               getThread().resume();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
+        */
+       public void suspend() throws DebugException {
+               getThread().suspend();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
+        */
+       public boolean canTerminate() {
+               return getThread().canTerminate();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
+        */
+       public boolean isTerminated() {
+               return getThread().isTerminated();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#terminate()
+        */
+       public void terminate() throws DebugException {
+               getThread().terminate();
+       }
+       
+       /**
+        * Returns the name of the source file this stack frame is associated
+        * with.
+        * 
+        * @return the name of the source file this stack frame is associated
+        * with
+        */
+       public String getSourceName() {
+               return fFileName;
+       }
+       /* (non-Javadoc)
+        * @see java.lang.Object#equals(java.lang.Object)
+        */
+       public boolean equals(Object obj) {
+               if (obj instanceof XDebugStackFrame) {
+                       XDebugStackFrame sf = (XDebugStackFrame)obj;
+                       try {
+                               return sf.getSourceName().equals(getSourceName()) &&
+                                       sf.getLineNumber() == getLineNumber() &&
+                                       sf.fId == fId;
+                       } catch (DebugException e) {
+                       }
+               }
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see java.lang.Object#hashCode()
+        */
+       public int hashCode() {
+               return getSourceName().hashCode() + fId;
+       }
+       
+       /**
+        * Returns this stack frame's unique identifier within its thread
+        * 
+        * @return this stack frame's unique identifier within its thread
+        */
+       protected int getIdentifier() {
+               return fId;
+       }
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugTarget.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugTarget.java
new file mode 100644 (file)
index 0000000..995df98
--- /dev/null
@@ -0,0 +1,597 @@
+/*
+ * Created on 23.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.Socket;
+import java.net.ServerSocket;
+import java.net.UnknownHostException;
+import java.text.MessageFormat;
+import org.w3c.dom.*;
+import javax.xml.parsers.*;
+import javax.xml.parsers.DocumentBuilder;
+import org.xml.sax.SAXException;
+import java.io.StringBufferInputStream;
+import java.io.OutputStreamWriter;
+
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.core.model.IMemoryBlock;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.core.model.IValue;
+import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugTarget  extends XDebugElement implements IDebugTarget {
+       
+       // associated system process (VM)
+       private IProcess fProcess;
+       
+       // containing launch object
+       private ILaunch fLaunch;
+       
+       // program name
+       private String fName;
+       
+       // sockets to communicate with XDebug
+       private ServerSocket fDebugServerSocket;
+       private Socket fDebugSocket;
+       private OutputStreamWriter fDebugWriter;
+       private BufferedReader fDebugReader;
+       
+       // suspend state
+       private boolean fSuspended = true;
+       
+       // terminated state
+       private boolean fTerminated = false;
+       
+       // threads
+       private XDebugThread fThread;
+       private IThread[] fThreads;
+       
+       // event dispatch job
+       private EventDispatchJob fEventDispatch;
+       
+       // Settings for Debug Process
+       private String transaction_id = "";
+       private String fileuri = "";
+       
+       /**
+        * Listens to events from the XDebug and fires corresponding 
+        * debug events.
+        */
+       class EventDispatchJob extends Job {
+               
+               public EventDispatchJob() {
+                       super("XDebug Event Dispatch");
+                       setSystem(true);
+               }
+
+               public String getAttributeValue (Node CurrentNode, String AttributeName) {
+                       String strValue = "";
+                       if (CurrentNode.hasAttributes()) {
+                               NamedNodeMap listAttribute = CurrentNode.getAttributes();
+                               Node nodeTransactionID = listAttribute.getNamedItem(AttributeName);
+                               strValue = nodeTransactionID.getNodeValue();
+                       }
+                       return strValue;
+               }
+
+               /* (non-Javadoc)
+                * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+                */
+               protected IStatus run(IProgressMonitor monitor) {
+                       String event = "";
+                       int CurrentByte;
+                       boolean ZeroByteFound;
+                       int BytesToRead = 0;
+                       String InputXML;
+                       while (!isTerminated() && event != null) {
+                               try {
+                                       ZeroByteFound = false;
+                                       event = "";
+                                       while (!ZeroByteFound){
+                                               CurrentByte = fDebugReader.read();
+                                               if (CurrentByte == 0) {
+                                                       ZeroByteFound = true;
+                                                   try {
+                                                       BytesToRead = Integer.parseInt(event);
+                                                     } catch (NumberFormatException e) {
+                                                       BytesToRead = 0;
+                                                     } 
+                                               } else {
+                                                       event = event + (char)CurrentByte;
+                                               }
+                                       }
+                                       if (BytesToRead > 0) {
+                                               InputXML = "";
+                                               for (int i = 0; i < BytesToRead; i++) {
+                                                       CurrentByte = fDebugReader.read();
+                                                       InputXML = InputXML + (char)CurrentByte;
+                                               }
+                                               CurrentByte = fDebugReader.read(); // Das Null Byte nach dem String lesen.
+                                               try {
+                                                       DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                                                       DocumentBuilder builder = factory.newDocumentBuilder();
+                                                       StringBufferInputStream InputXMLStream = new StringBufferInputStream(InputXML);
+                                                       Document doc = builder.parse(InputXMLStream);
+                                                       Node myNode = doc.getFirstChild();
+                                                       if (myNode.getNodeName() == "init") {
+                                                               transaction_id = getAttributeValue(myNode, "appid");
+                                                               fileuri = getAttributeValue(myNode, "fileuri");
+                                                               fThread.setBreakpoints(null);
+                                                               fThread.setStepping(false);
+                                                               started();      
+                                                       } else if (myNode.getNodeName() == "response") {
+                                                                
+                                                       }
+                                                       
+                                               } catch (ParserConfigurationException e) {
+
+                                               } catch (SAXException e) {
+                                                       
+                                               }
+                                       }
+/*
+                                       event = fDebugReader.readLine();
+                                       if (event != null) {
+                                               fThread.setBreakpoints(null);
+                                               fThread.setStepping(false);
+                                               if (event.equals("started")) {
+                                                       
+                                               } else if (event.equals("terminated")) {
+                                                       terminated();
+                                               } else if (event.startsWith("resumed")) {
+                                                       if (event.endsWith("step")) {
+                                                               fThread.setStepping(true);
+                                                               resumed(DebugEvent.STEP_OVER);
+                                                       } else if (event.endsWith("client")) {
+                                                               resumed(DebugEvent.CLIENT_REQUEST);
+                                                       }
+                                               } else if (event.startsWith("suspended")) {
+                                                       if (event.endsWith("client")) {
+                                                               suspended(DebugEvent.CLIENT_REQUEST);
+                                                       } else if (event.endsWith("step")) {
+                                                               suspended(DebugEvent.STEP_END);
+                                                       } else if (event.indexOf("breakpoint") >= 0) {
+                                                               breakpointHit(event);
+                                                       }
+                                               }
+                                       }
+*/                                     
+                               } catch (IOException e) {
+                                       terminated();
+                               }
+                       }
+                       return Status.OK_STATUS;
+               }
+               
+       }
+       
+       /**
+        * Constructs a new debug target in the given launch for the 
+        * associated PDA VM process.
+        * 
+        * @param launch containing launch
+        * @param debugPort port to read events from
+        * @exception CoreException if unable to connect to host
+        */
+       public XDebugTarget(ILaunch launch, int debugPort) throws CoreException {
+               super(null);
+               fLaunch = launch;
+               fTarget = this;
+               try {
+                       fDebugServerSocket = new ServerSocket(debugPort);
+                       fDebugSocket = fDebugServerSocket.accept();
+                       fDebugWriter = new OutputStreamWriter(fDebugSocket.getOutputStream(), "UTF8");
+                       fDebugReader = new BufferedReader(new InputStreamReader(fDebugSocket.getInputStream()));
+                       
+               } catch (UnknownHostException e) {
+                       abort("Unable to connect to PDA VM", e);
+               } catch (IOException e) {
+                       abort("Unable to connect to PDA VM", e);
+               }
+               fThread = new XDebugThread(this);
+               fThreads = new IThread[] {fThread};
+               fEventDispatch = new EventDispatchJob();
+               fEventDispatch.schedule();
+               DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugTarget#getProcess()
+        */
+       public IProcess getProcess() {
+               return fProcess;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
+        */
+       public IThread[] getThreads() throws DebugException {
+               return fThreads;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugTarget#hasThreads()
+        */
+       public boolean hasThreads() throws DebugException {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugTarget#getName()
+        */
+       public String getName() throws DebugException {
+               if (fName == null) {
+                       fName = "XDebug Core";
+                       try {
+                               fName = getLaunch().getLaunchConfiguration().getAttribute(IXDebugConstants.ATTR_XDEBUG_PROGRAM, "PDA VM");
+                       } catch (CoreException e) {
+                       }
+               }
+               return fName;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint)
+        */
+       public boolean supportsBreakpoint(IBreakpoint breakpoint) {
+               if (breakpoint.getModelIdentifier().equals(PHPDebugCorePlugin.PLUGIN_ID)) {
+                       /* Axel: Weiß nicht ob das wichtig ist.                         
+                       try {
+                               String program = getLaunch().getLaunchConfiguration().getAttribute(IXDebugConstants.ATTR_XDEBUG_PROGRAM, (String)null);
+                               if (program != null) {
+                                       IMarker marker = breakpoint.getMarker();
+                                       if (marker != null) {
+                                               IPath p = new Path(program);
+                                               return marker.getResource().getFullPath().equals(p);
+                                       }
+                               }
+                       } catch (CoreException e) {
+                       }                       
+*/                             
+                       return true;
+               }
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
+        */
+       public IDebugTarget getDebugTarget() {
+               return this;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
+        */
+       public ILaunch getLaunch() {
+               return fLaunch;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
+        */
+       public boolean canTerminate() {
+//             return getProcess().canTerminate();
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
+        */
+       public boolean isTerminated() {
+//             return getProcess().isTerminated();
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#terminate()
+        */
+       public void terminate() throws DebugException {
+               sendRequest ("stop -i " + transaction_id);
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
+        */
+       public boolean canResume() {
+               return !isTerminated() && isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
+        */
+       public boolean canSuspend() {
+               return !isTerminated() && !isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
+        */
+       public boolean isSuspended() {
+               return fSuspended;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#resume()
+        */
+       public void resume() throws DebugException {
+               sendRequest("run -i " + transaction_id);
+       }
+       
+       /**
+        * Notification the target has resumed for the given reason
+        * 
+        * @param detail reason for the resume
+        */
+       private void resumed(int detail) {
+               fSuspended = false;
+               fThread.fireResumeEvent(detail);
+       }
+       
+       /**
+        * Notification the target has suspended for the given reason
+        * 
+        * @param detail reason for the suspend
+        */
+       private void suspended(int detail) {
+               fSuspended = true;
+               fThread.fireSuspendEvent(detail);
+       }       
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
+        */
+       public void suspend() throws DebugException {
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint)
+        */
+       public void breakpointAdded(IBreakpoint breakpoint) {
+               if (supportsBreakpoint(breakpoint)) {
+                       try {
+                               if (breakpoint.isEnabled()) {
+                                       try {
+                                               sendRequest("breakpoint_set -i " + transaction_id +" -t line -n " + (((ILineBreakpoint)breakpoint).getLineNumber() - 1));
+                                       } catch (CoreException e) {
+                                       }
+                               }
+                       } catch (CoreException e) {
+                       }
+               }
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
+        */
+       public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
+               if (supportsBreakpoint(breakpoint)) {
+                       try {
+                               sendRequest("clear " + ((ILineBreakpoint)breakpoint).getLineNumber());
+                       } catch (CoreException e) {
+                       }
+               }
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
+        */
+       public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
+               if (supportsBreakpoint(breakpoint)) {
+                       try {
+                               if (breakpoint.isEnabled()) {
+                                       breakpointAdded(breakpoint);
+                               } else {
+                                       breakpointRemoved(breakpoint, null);
+                               }
+                       } catch (CoreException e) {
+                       }
+               }
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect()
+        */
+       public boolean canDisconnect() {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDisconnect#disconnect()
+        */
+       public void disconnect() throws DebugException {
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected()
+        */
+       public boolean isDisconnected() {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval()
+        */
+       public boolean supportsStorageRetrieval() {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
+        */
+       public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
+               return null;
+       }
+
+       /**
+        * Notification we have connected to the VM and it has started.
+        * Resume the VM.
+        */
+       private void started() {
+               fireCreationEvent();
+               installDeferredBreakpoints();
+               try {
+                       resume();
+               } catch (DebugException e) {
+               }
+       }
+       
+       /**
+        * Install breakpoints that are already registered with the breakpoint
+        * manager.
+        */
+       private void installDeferredBreakpoints() {
+               IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PHPDebugCorePlugin.PLUGIN_ID);
+               for (int i = 0; i < breakpoints.length; i++) {
+                       breakpointAdded(breakpoints[i]);
+               }
+       }
+       
+       /**
+        * Called when this debug target terminates.
+        */
+       private void terminated() {
+               fTerminated = true;
+               fSuspended = false;
+               DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
+               fireTerminateEvent();
+       }
+       
+       /**
+        * Returns the current stack frames in the target.
+        * 
+        * @return the current stack frames in the target
+        * @throws DebugException if unable to perform the request
+        */
+       protected IStackFrame[] getStackFrames() throws DebugException {
+               synchronized (fDebugSocket) {
+                       sendRequest("stack -i " + transaction_id);
+                       try {
+                               String framesData = fDebugReader.readLine();
+                               if (framesData != null) {
+                                       String[] frames = framesData.split("#");
+                                       IStackFrame[] theFrames = new IStackFrame[frames.length];
+                                       for (int i = 0; i < frames.length; i++) {
+                                               String data = frames[i];
+                                               theFrames[frames.length - i - 1] = new XDebugStackFrame(fThread, data, i);
+                                       }
+                                       return theFrames;
+                               }
+                       } catch (IOException e) {
+                               abort("Unable to retrieve stack frames", e);
+                       }
+               }
+               return new IStackFrame[0];
+       }
+       
+       /**
+        * Single step the interpreter.
+        * 
+        * @throws DebugException if the request fails
+        */
+       protected void step() throws DebugException {
+               sendRequest("step_into -i " + transaction_id);
+       }
+       
+       /**
+        * Returns the current value of the given variable.
+        * 
+        * @param variable
+        * @return variable value
+        * @throws DebugException if the request fails
+        */
+       protected IValue getVariableValue(XDebugVariable variable) throws DebugException {
+               synchronized (fDebugSocket) {
+                       sendRequest("var " + variable.getStackFrame().getIdentifier() + " " + variable.getName());
+                       try {
+                               String value = fDebugReader.readLine();
+                               return new XDebugValue(this, value);
+                       } catch (IOException e) {
+                               abort(MessageFormat.format("Unable to retrieve value for variable {0}", new String[]{variable.getName()}), e);
+                       }
+               }
+               return null;
+       }
+       
+       /**
+        * Returns the values on the data stack (top down)
+        * 
+        * @return the values on the data stack (top down)
+        */
+       public IValue[] getDataStack() throws DebugException {
+               synchronized (fDebugSocket) {
+                       sendRequest ("data");
+                       try {
+                               String valueString = fDebugReader.readLine();
+                               if (valueString != null && valueString.length() > 0) {
+                                       String[] values = valueString.split("\\|");
+                                       IValue[] theValues = new IValue[values.length];
+                                       for (int i = 0; i < values.length; i++) {
+                                               String value = values[values.length - i - 1];
+                                               theValues[i] = new XDebugValue(this, value);
+                                       }
+                                       return theValues;
+                               }
+                       } catch (IOException e) {
+                               abort("Unable to retrieve data stack", e);
+                       }
+               }
+               return new IValue[0];           
+       }
+       
+       /**
+        * Sends a request to the PDA VM and waits for an OK.
+        * 
+        * @param request debug command
+        * @throws DebugException if the request fails
+        */
+       private void sendRequest(String request) throws DebugException {
+               synchronized (fDebugSocket) {
+                       try {
+                               fDebugWriter.write(request);
+                               fDebugWriter.write(0);
+                               fDebugWriter.flush();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+               }
+               }               
+       }
+       
+       /**
+        * Notification a breakpoint was encountered. Determine
+        * which breakpoint was hit and fire a suspend event.
+        * 
+        * @param event debug event
+        */
+       private void breakpointHit(String event) {
+               // determine which breakpoint was hit, and set the thread's breakpoint
+               int lastSpace = event.lastIndexOf(' ');
+               if (lastSpace > 0) {
+                       String line = event.substring(lastSpace + 1);
+                       int lineNumber = Integer.parseInt(line);
+                       IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PHPDebugCorePlugin.PLUGIN_ID);
+                       for (int i = 0; i < breakpoints.length; i++) {
+                               IBreakpoint breakpoint = breakpoints[i];
+                               if (supportsBreakpoint(breakpoint)) {
+                                       if (breakpoint instanceof ILineBreakpoint) {
+                                               ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
+                                               try {
+                                                       if (lineBreakpoint.getLineNumber() == lineNumber) {
+                                                               fThread.setBreakpoints(new IBreakpoint[]{breakpoint});
+                                                               break;
+                                                       }
+                                               } catch (CoreException e) {
+                                               }
+                                       }
+                               }
+                       }
+               }
+               suspended(DebugEvent.BREAKPOINT);
+       }       
+}
+
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugThread.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugThread.java
new file mode 100644 (file)
index 0000000..6e5c4d9
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * Created on 23.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugThread extends XDebugElement implements IThread {
+       
+       /**
+        * Breakpoints this thread is suspended at or <code>null</code>
+        * if none.
+        */
+       private IBreakpoint[] fBreakpoints;
+       
+       /**
+        * Whether this thread is stepping
+        */
+       private boolean fStepping = false;
+       
+       /**
+        * Constructs a new thread for the given target
+        * 
+        * @param target VM
+        */
+       public XDebugThread(XDebugTarget target) {
+               super(target);
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IThread#getStackFrames()
+        */
+       public IStackFrame[] getStackFrames() throws DebugException {
+               if (isSuspended()) {
+                       return ((XDebugTarget)getDebugTarget()).getStackFrames();
+               } else {
+                       return new IStackFrame[0];
+               }
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IThread#hasStackFrames()
+        */
+       public boolean hasStackFrames() throws DebugException {
+               return isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IThread#getPriority()
+        */
+       public int getPriority() throws DebugException {
+               return 0;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
+        */
+       public IStackFrame getTopStackFrame() throws DebugException {
+               IStackFrame[] frames = getStackFrames();
+               if (frames.length > 0) {
+                       return frames[0];
+               }
+               return null;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IThread#getName()
+        */
+       public String getName() throws DebugException {
+               return "Thread[1]";
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
+        */
+       public IBreakpoint[] getBreakpoints() {
+               if (fBreakpoints == null) {
+                       return new IBreakpoint[0];
+               }
+               return fBreakpoints;
+       }
+       /**
+        * Sets the breakpoints this thread is suspended at, or <code>null</code>
+        * if none.
+        * 
+        * @param breakpoints the breakpoints this thread is suspended at, or <code>null</code>
+        * if none
+        */
+       protected void setBreakpoints(IBreakpoint[] breakpoints) {
+               fBreakpoints = breakpoints;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
+        */
+       public boolean canResume() {
+               return isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
+        */
+       public boolean canSuspend() {
+               return !isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
+        */
+       public boolean isSuspended() {
+               return getDebugTarget().isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#resume()
+        */
+       public void resume() throws DebugException {
+               getDebugTarget().resume();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
+        */
+       public void suspend() throws DebugException {
+               getDebugTarget().suspend();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#canStepInto()
+        */
+       public boolean canStepInto() {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#canStepOver()
+        */
+       public boolean canStepOver() {
+               return isSuspended();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#canStepReturn()
+        */
+       public boolean canStepReturn() {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#isStepping()
+        */
+       public boolean isStepping() {
+               return fStepping;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#stepInto()
+        */
+       public void stepInto() throws DebugException {
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#stepOver()
+        */
+       public void stepOver() throws DebugException {
+               ((XDebugTarget)getDebugTarget()).step();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IStep#stepReturn()
+        */
+       public void stepReturn() throws DebugException {
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
+        */
+       public boolean canTerminate() {
+               return !isTerminated();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
+        */
+       public boolean isTerminated() {
+               return getDebugTarget().isTerminated();
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ITerminate#terminate()
+        */
+       public void terminate() throws DebugException {
+               getDebugTarget().terminate();
+       }
+       
+       /**
+        * Sets whether this thread is stepping
+        * 
+        * @param stepping whether stepping
+        */
+       protected void setStepping(boolean stepping) {
+               fStepping = stepping;
+       }
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugValue.java
new file mode 100644 (file)
index 0000000..a7ea108
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Created on 23.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugValue  extends XDebugElement implements IValue {
+       
+       private String fValue;
+       
+       public XDebugValue(XDebugTarget target, String value) {
+               super(target);
+               fValue = value;
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
+        */
+       public String getReferenceTypeName() throws DebugException {
+               try {
+                       Integer.parseInt(fValue);
+               } catch (NumberFormatException e) {
+                       return "text";
+               }
+               return "integer";
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValue#getValueString()
+        */
+       public String getValueString() throws DebugException {
+               return fValue;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValue#isAllocated()
+        */
+       public boolean isAllocated() throws DebugException {
+               return true;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValue#getVariables()
+        */
+       public IVariable[] getVariables() throws DebugException {
+               return new IVariable[0];
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValue#hasVariables()
+        */
+       public boolean hasVariables() throws DebugException {
+               return false;
+       }
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugVariable.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugVariable.java
new file mode 100644 (file)
index 0000000..03d7dd0
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Created on 23.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugVariable  extends XDebugElement implements IVariable {
+       
+       // name & stack frmae
+       private String fName;
+       private XDebugStackFrame fFrame;
+       
+       /**
+        * Constructs a variable contained in the given stack frame
+        * with the given name.
+        * 
+        * @param frame owning stack frame
+        * @param name variable name
+        */
+       public XDebugVariable(XDebugStackFrame frame, String name) {
+               super((XDebugTarget) frame.getDebugTarget());
+               fFrame = frame;
+               fName = name;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IVariable#getValue()
+        */
+       public IValue getValue() throws DebugException {
+               return ((XDebugTarget)getDebugTarget()).getVariableValue(this);
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IVariable#getName()
+        */
+       public String getName() throws DebugException {
+               return fName;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
+        */
+       public String getReferenceTypeName() throws DebugException {
+               // TODO Auto-generated method stub
+               return "Thing";
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
+        */
+       public boolean hasValueChanged() throws DebugException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
+        */
+       public void setValue(String expression) throws DebugException {
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
+        */
+       public void setValue(IValue value) throws DebugException {
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
+        */
+       public boolean supportsValueModification() {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
+        */
+       public boolean verifyValue(String expression) throws DebugException {
+               return false;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
+        */
+       public boolean verifyValue(IValue value) throws DebugException {
+               return false;
+       }
+       
+       /**
+        * Returns the stack frame owning this variable.
+        * 
+        * @return the stack frame owning this variable
+        */
+       protected XDebugStackFrame getStackFrame() {
+               return fFrame;
+       }
+
+}