Commits

Anonymous committed 6b8e0ea

Added upstream versions because of fixes to the XEmacs package.

  • Participants
  • Parent commits 4106674

Comments (0)

Files changed (2)

lisp/beanshell.el.upstream

+;;; beanshell.el
+;; $Revision$ 
+
+;; Author: Paul Kinnucan <paulk@mathworks.com>
+;; Maintainer: Paul Kinnucan
+;; Keywords: java, tools
+
+;; Copyright (C) 1997, 1998 Paul Kinnucan.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+
+(defcustom bsh-startup-timeout 3
+  "*Length of time the JDE waits for the Beanshell to startup.
+Increase the value of this variable if you get Lisp errors
+on BeanShell startup on Unix."
+  :group 'bsh
+  :type 'integer)
+
+(defun bsh()
+"*Starts BeanShell, a Java interpreter developed by Pat Niemeyer."
+  (interactive)
+  (bsh-internal t))
+
+(defun bsh-internal (&optional display-buffer) 
+  (let ((bsh-buffer-name "*bsh*"))
+    (if (not (comint-check-proc bsh-buffer-name))
+	(let* ((bsh-buffer (get-buffer-create bsh-buffer-name))
+	       (jde-java-directory
+		(concat
+		 (jde-find-jde-data-directory)
+		 "java/"))
+	       (vm (if (eq system-type 'windows-nt)
+		       jde-run-java-vm-w
+		     jde-run-java-vm))
+	       (vm-args
+		(list
+		 "-classpath"
+                 (jde-convert-cygwin-path
+                  (concat
+                   jde-java-directory "lib/jde.jar" jde-classpath-separator
+                   jde-java-directory "lib/bsh.jar" jde-classpath-separator
+                   (if jde-global-classpath
+                       (jde-run-build-classpath-arg jde-global-classpath)
+                     (getenv "CLASSPATH"))) jde-classpath-separator)
+		 "bsh.Interpreter")))
+	  (save-excursion
+	    (set-buffer bsh-buffer)
+	    (erase-buffer)
+	    (comint-mode)
+	    (setq comint-prompt-regexp "bsh % "))
+	 (save-w32-show-window
+	   ;; (message "%s" (nth 1 vm-args))
+	   (message "%s" "Starting the BeanShell. Please wait...")
+	   (comint-exec bsh-buffer "bsh" vm nil vm-args))
+	 (process-kill-without-query (get-buffer-process bsh-buffer))
+	 (if display-buffer
+	      (pop-to-buffer bsh-buffer-name)))
+      (when display-buffer
+	  (message "The Java interpreter is already running.")
+	  (pop-to-buffer bsh-buffer-name)))))
+
+
+(setq bsh-tq-reply nil)
+
+(defun bsh-eval-filter (process result)
+  (let ((end-of-result (string-match ".*bsh % " result)))
+    (if end-of-result
+	(setq bsh-tq-reply (concat bsh-tq-reply (substring result 0 end-of-result)))
+      (setq bsh-tq-reply (concat bsh-tq-reply result))
+      (accept-process-output process 5 5))))
+
+(defun bsh-eval (expr &optional eval-return)
+  "Uses the BeanShell Java interpreter to evaluate a Java statement.
+If the interpreter is not already running, this function starts
+the interpreter. This function returns any text output by the
+Java interpreter's standard out or standard error pipes.
+If the optional argument eval-return is non-nil, this function
+returns the result of evaluating the Java output as a Lisp
+expression."
+  (let* ((bsh-process
+	  (if (get-process "bsh")
+	      (get-process "bsh")
+	    (let (proc)
+	      (bsh-internal)
+	      (setq proc (get-process "bsh"))
+	      (if (eq system-type 'windows-nt)
+		  (accept-process-output proc)
+		(while (accept-process-output proc bsh-startup-timeout 0)))
+	      proc)))
+	 (comint-filter (if bsh-process (process-filter bsh-process))))
+    (when bsh-process
+      (setq bsh-tq-reply nil)
+      (set-process-filter bsh-process 'bsh-eval-filter)
+      ;; (message "Evaluating: %s" expr)
+      (process-send-string bsh-process (concat expr "\n"))
+      (if (not (accept-process-output bsh-process 100 100))
+	  (message "No reply from BeanShell"))
+      (set-process-filter bsh-process comint-filter)
+      ;; (if eval-return (message "Evaluating reply: %s" bsh-tq-reply))
+      (if eval-return
+	  (eval (read bsh-tq-reply))
+	bsh-tq-reply))))
+
+(defun bsh-eval-r(java-statement) 
+  "Convenience function for evaluating Java statements
+that return Lisp expressions as output. This function 
+invokes bsh-eval with the evaluate-return option set to
+t."
+  (bsh-eval java-statement t))
+
+
+
+(provide 'beanshell);
+
+;; $Log$
+;; Revision 1.1  2000/08/13 13:43:55  michaels
+;; Initial checkin.
+;;
+;; Revision 1.13  2000/02/16 04:39:28  paulk
+;; Implemented Cygwin/XEmacs compatiblity fix provided by Fred Hart
+;; <cfhart@Z-TEL.com> in bsh-internal.
+;;
+;; Revision 1.12  2000/02/02 05:51:00  paulk
+;; Expanded doc string.
+;;
+;; Revision 1.11  2000/01/28 04:28:00  paulk
+;; Fixed startup timing bug that cause commands that use the beanshell to
+;; failt the first time on Unix systems.
+;;
+;; Revision 1.10  2000/01/15 08:00:03  paulk
+;; Corrected typo.
+;;
+;; Revision 1.9  1999/11/01 03:13:07  paulk
+;; No change.
+;;
+;; Revision 1.8  1999/09/17 06:55:26  paulk
+;; Set comint-prompt-regexp to the beanshell prompt.
+;; Fixed bug where Emacs was querying user whether to kill the beanshell
+;; buffer on exit from Emacs.
+;;
+;; Revision 1.7  1999/01/15 22:18:41  paulk
+;; Added Andy Piper's NT/XEmacs compatibility changes.
+;;
+;; Revision 1.6  1998/12/13 22:10:04  paulk
+;; Add check for chunked traffic between Emacs and the BeanShell.
+;;
+;; Revision 1.5  1998/12/09 00:59:43  paulk
+;; Added a startup message for beanshell.
+;;
+;; Revision 1.4  1998/11/27 10:07:57  paulk
+;; Use CLASSPATH environment variable if jde-global-classpath is nil.
+;;
+;; Revision 1.3  1998/11/22 23:14:28  paulk
+;; Fixed path separator bug.
+;;
+;; Revision 1.2  1998/11/22 18:11:56  paulk
+;; Changed path to use jde.jar.
+;;
+;; Revision 1.1  1998/10/22 00:07:56  paulk
+;; Initial revision
+;;
+
+
+;; End of beanshell.el

lisp/jde-dbs.el.upstream

+;;; jde-dbs.el -- JDEbug Session Interface Functions
+;; $Revision$ $Date$ 
+
+;; Author: Paul Kinnucan <paulk@mathworks.com>
+;; Maintainer: Paul Kinnucan
+;; Keywords: java, tools
+
+;; Copyright (C) 1997, 1998, 1999 Paul Kinnucan.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; This is one of a set of packages that make up the 
+;; Java Development Environment (JDE) for Emacs. See the
+;; JDE User's Guide for more information.
+
+;; The latest version of the JDE is available at
+;; <URL:http://sunsite.auc.dk/jde/>.
+
+;; Please send any comments, bugs, or upgrade requests to
+;; Paul Kinnucan at paulk@mathworks.com.
+
+;;; Code:
+
+(require 'jde-dbo) 
+(require 'eieio)
+(require 'jde-widgets)
+
+(defvar jde-dbs-comint-filter nil
+  "Standard comint filter for debugger buffer.")
+
+(defvar jde-dbs-debugger-process-name "jdebug"
+"Name of debugger process.")
+
+(defun jde-dbs-get-debugger-process ()
+  (get-process jde-dbs-debugger-process-name))
+
+
+(defvar jde-dbs-debugger-output-buffer-name "*JDEbug Messages*"
+"Name of buffer used to display messages from the debugger.")
+
+(defvar jde-dbs-debugger-socket-process-name "jdebug-socket"
+"Name of debugger socket process.")
+
+(defun jde-dbs-get-debugger-socket-process ()
+  (get-process jde-dbs-debugger-socket-process-name))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Process Set                                                                ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-proc-set ()
+  ((proc-alist     :initarg :proc-alist
+		   :type list
+		   :initform nil
+		   :documentation
+		   "List of active processes"))
+  "Class of process sets.")
+
+(defmethod jde-dbs-proc-set-add ((this jde-dbs-proc-set) process)
+  (oset this :proc-alist
+	(cons 
+	 (cons (oref process :id) process)
+	 (oref this :proc-alist))))
+
+(defmethod jde-dbs-proc-set-remove ((this jde-dbs-proc-set) process)
+  (oset this :proc-alist
+	(remove-if
+	 (lambda (assoc)
+	   (let* ((xproc (cdr assoc))
+		  (xid (oref xproc id))
+		  (id (oref process id)))
+	     (equal xid id)))
+	 (oref this proc-alist))))
+
+(defmethod jde-dbs-proc-set-get-proc ((this jde-dbs-proc-set) id)
+  (cdr (assq id (oref this :proc-alist))))
+
+(defmethod jde-dbs-proc-set-find ((this jde-dbs-proc-set) field value)
+  "Finds the process in the set whose FIELD is equal to VALUE."
+  (if (slot-boundp this :proc-alist)
+      (cdr (find-if
+	(lambda (assoc-x)
+	  (let ((process-x (cdr assoc-x)))
+	    (equal (oref-engine process-x field) value)))
+	(oref this :proc-alist)))))
+
+(defmethod jde-dbs-proc-set-contains-p ((this jde-dbs-proc-set) process)
+  (assq (oref process :id) (oref this :proc-alist)))
+
+(defmethod jde-dbs-proc-set-get-size ((this jde-dbs-proc-set))
+  "Gets the number of processes in this set."
+  (if (slot-boundp this 'proc-alist)
+      (length (oref this proc-alist))
+    0))
+	      
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Process Registry                                                           ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-proc-registry (jde-dbs-proc-set)
+  ((target-process :initarg :target-process
+		   :type jde-dbs-proc
+		   :documentation
+		   "Process that currently has the debugger command focus."))
+  "Class of process registries.")
+
+
+(defmethod jde-dbs-proc-registry-set-target-proc ((this jde-dbs-proc-registry) &optional id)
+  "Sets process specified by ID to be the target process. If ID is not specified, the first
+registered process becomes the target process"
+  (let ((target-process
+	  (if id
+	      (let ((process (jde-dbs-proc-set-get-proc this id)))
+		(if process
+		    (if (jde-dbs-proc-set-contains-p this process)
+			process
+		      (message "Error: process %s is dead." process-id)
+		      nil)
+		  (message "Error: process %s does not exist." process-id)
+		  nil))
+	    (let ((existing-processes 
+		   (oref jde-dbs-the-process-registry :proc-alist)))
+	      (if existing-processes (cdr (nth 0 existing-processes)))))))
+    (when target-process
+      (oset this target-process target-process)
+      (set-window-configuration (oref target-process win-cfg)))
+    target-process))
+  
+
+(defvar jde-dbs-the-process-registry 
+  (jde-dbs-proc-registry "Process Registry")
+  "The debuggee process registry.")
+
+(defun jde-dbs-get-target-process ()
+  (and jde-dbs-the-process-registry
+       (slot-boundp jde-dbs-the-process-registry :target-process)
+       (oref jde-dbs-the-process-registry :target-process)))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Process Morgue                                                             ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-proc-morgue (jde-dbs-proc-set) ()
+  "Class of process morgues. A process morgue contains dead or dying processes. 
+Their carcasses must be kept around until the debugger stops sending messages
+concerning them." )
+
+(defmethod jde-dbs-proc-morgue-bury-the-dead ((this jde-dbs-proc-morgue))
+  (mapc 
+   (lambda (dead-proc-assoc)
+     (let* ((dead-proc (cdr dead-proc-assoc))
+	    (cli-buffer (if (slot-boundp dead-proc 'cli-buf) (oref dead-proc cli-buf)))
+	    (msg-buffer (if (slot-boundp dead-proc 'msg-buf) (oref dead-proc msg-buf)))
+	    (locals-buffer (if (slot-boundp dead-proc 'locals-buf) (oref dead-proc locals-buf)))
+	    (threads-buffer (if (slot-boundp dead-proc 'threads-buf) (oref dead-proc threads-buf))))
+       (if cli-buffer (kill-buffer cli-buffer))
+       (if msg-buffer (kill-buffer msg-buffer))
+       (if locals-buffer (kill-buffer locals-buffer))
+       (if threads-buffer (kill-buffer threads-buffer))))
+   (oref this proc-alist))
+  (oset this proc-alist nil))
+
+
+(defvar jde-dbs-the-process-morgue (jde-dbs-proc-morgue "The JDE Process Morgue")
+  "The JDE process morgue. This morgue contains processes that are dead or
+dying, for example, because they have been terminated by the user or the
+debugger. Their corpses must be kept around until it is clear they are dead and
+the debugger ceases sending messages concerning them.")
+
+
+(defun jde-dbs-get-process (id)
+"Get the process whose id is ID. This function looks first in the process registry
+and then in the process morgue for the process."
+  (let ((process
+	 (jde-dbs-proc-set-get-proc jde-dbs-the-process-registry id)))
+    (if (not process)
+	(setq process (jde-dbs-proc-set-get-proc jde-dbs-the-process-morgue id)))
+    process))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Process State Info                                                         ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-proc-state-info ()
+  ((state       :initarg :state)
+   (reason      :initarg :reason)
+   (thread-id   :initarg :thread-id)
+   (thread-name :initarg :thread-name))
+  "Class of process state information objects.")
+
+
+(defmethod jde-dbs-proc-state-info-set ((this jde-dbs-proc-state-info)
+					state reason thread-id thread-name)
+  (oset this reason reason)
+  (oset this state state)
+  (oset this thread-id thread-id)
+  (oset this thread-name thread-name))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;; 
+;; Breakpoint Specification                                                   ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-proc-bpspec ()
+  ((id         :initarg :id
+	       :type integer
+	       :documentation 
+	       "Id assigned to this breakpoint by the debugger.")
+   (breakpoint :initarg :breakpoint
+	       :type jde-bug-breakpoint
+	       :documentation
+	       "Instance of `jde-bug-breakpoint'.")
+   (resolved   :initarg :resolved))
+  (:allow-nil-initform t)
+  "Class of breakpoint specifications. A breakpoint specification contains 
+process-specific information about a breakpoint")
+
+
+;; Defines a class of containers for breakpoint specs.
+;; Each container lists the process specs for breakpoints set in a
+;; particular process.
+
+(defun jde-dbs-proc-bpspecs-add (bpspecs bpspec)
+  "Adds BPSPEC to BPSPECS, a process's breakpoint spec list."
+  (cons 
+   (cons (oref bpspec id) bpspec)
+   bpspecs))
+
+(defun jde-dbs-proc-bpspecs-remove (bpspecs bpspec)
+  "Removes BPSPEC from BPSPECS"
+  (remove-if (lambda (x) 
+	       (equal (car x) (oref bpspec id) ))
+	     bpspecs))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Trace Request Class                                                        ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-trace-request ()
+  ((id                  :initarg :id
+	                :type integer
+		        :documentation
+		        "Trace request id")
+   (suspend-policy      :initarg :suspend-policy
+		        :type string
+		        :initform "none"
+		        :documentation
+		        "Valid values are all (all threads), thread (current thread), or none")
+   (inclusion-filters   :initarg :inclusion-filters
+			:type list
+			:documentation
+			"List of regular expressions specifying classes to include in trace.")
+   (exclusion-filters   :initarg :exclusion-filters
+			:type list
+			:documentation
+			"List of regular expressions specifying classes to exclude from trace.")
+   (cancel-command      :initarg :cancel-command
+			:type string
+			:documentation
+			"Name of command used to cancel this request.")
+   )
+"Super class of trace requests."
+)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Trace Method Request Class                                                 ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-trace-methods-request (jde-dbs-trace-request)
+   ((trace-type         :initarg :trace-type
+			:type string
+			:initform "entry"
+			:documentation 
+			"Entry or exit.")
+   (thread-restriction  :initarg :thread-restriction
+	                :type string
+			:documentation
+			"Thread to trace."))
+   "Trace methods request."
+)
+
+(defmethod initialize-instance ((this jde-dbs-trace-methods-request) &rest fields)
+  "Constructor for objects of `jde-dbs-trace-methods-request' class."
+  (call-next-method)
+  (oset this cancel-command "cancel_trace_methods"))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Trace Classes Request Class                                                ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-trace-classes-request (jde-dbs-trace-request)
+   ((trace-type         :initarg :trace-type
+			:type string
+			:initform "preparation"
+			:documentation 
+			"Valid values are preparation or unloading."))
+   "Trace classes request."
+)
+
+(defmethod initialize-instance ((this jde-dbs-trace-classes-request) &rest fields)
+  "Constructor for objects of `jde-dbs-trace-classes-request' class."
+  (call-next-method)
+  (oset this cancel-command "cancel_trace_classes"))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Trace Exceptions Request Class                                             ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-trace-exceptions-request (jde-dbs-trace-request)
+  ((exception-class    :initarg :exception-class
+		       :type string
+		       :documentation
+		       "Class of exceptions to trace. Can be a wild card pattern.")
+   (trace-type         :initarg :trace-type
+		       :type string
+		       :initform "both"
+		       :documentation 
+			"Valid values are caught, uncaught, or both."))
+   "Trace exceptions request."
+)
+
+(defmethod initialize-instance ((this jde-dbs-trace-exceptions-request) &rest fields)
+  "Constructor for objects of `jde-dbs-trace-exceptions-request' class."
+  (call-next-method)
+  (oset this cancel-command "clear"))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Watch Field Request Class                                                  ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-watch-field-request (jde-dbs-trace-request)
+  ((watch-type         :initarg :watch-type
+		       :type string
+		       :documentation
+		       "Valid values are \"access\" and \"modification\".")
+   (object-class       :initarg :object-class
+		       :type string
+		       :documentation
+		       "Class of object to watch. Can be a wild card pattern.")
+   (field-name         :initarg :field-name
+		       :type string
+		       :documentation 
+			"Name of field to watch.")
+   (expression         :initarg :expression
+		       :type string
+		       :documentation 
+		       "Boolean expression that must be satisfied to suspend execution.")
+   (object-id          :initarg :object-id
+		       :type string
+		       :documentation 
+		       "Id of object to watch."))
+   "Watch field request."
+)
+
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Application Process Class                                                  ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-proc ()
+  ((id            :initarg :id
+                  :type integer
+                  :documentation
+                  "Id assigned by the JDE.")
+   (main-class    :initarg :main-class
+                  :type string
+                  :documentation
+                  "Main class for this process.")
+   (cli-socket    :initarg :cli-socket
+                  :type integer
+	          :documentation
+                  "Number of socket used by the process's command line interface.")
+   (cli-buf       :initarg :cli-buf
+                  :type buffer
+	          :documentation
+	          "Buffer for the process's command-line interface.")
+   (msg-buf       :initarg :msf-buf
+	          :type buffer
+	          :documentation
+	          "Buffer used to display debugger output for this process")
+   (threads-buf   :initarg :threads-buf
+		  :type buffer
+		  :documentation
+		  "Buffer used to display threads.")
+   (locals-buf    :initarg :locals-buf
+		  :type buffer
+		  :documentation
+		  "Buffer used to display local variables.")
+   (startupp       :initarg :startupp
+                  :type boolean
+                  :initform nil
+                  :documentation
+		  "non-nil if this process is in the startup state.")
+   (suspendedp    :initarg :suspendedp
+                  :type boolean
+                  :initform nil
+                  :documentation
+		  "non-nil if this process has been suspended by the debugger.")
+   (steppablep    :initarg :steppablep
+                  :type boolean
+                  :initform nil
+                  :documentation
+		  "non-nil if this process can be single-stepped.")
+   (state-info    :initarg :state-info
+	          :type jde-dbs-proc-state-info
+	          :documentation
+	          "Process state information.")
+   (stack         :initarg :stack
+		  :type list
+		  :documentation
+		  "Lists stack frames for thread of current step or breakpoint.")
+   (stack-ptr     :initarg :stack-ptr
+		  :type integer
+		  :initform 0
+		  :documentation
+		  "Points to the current frame on the stack.")
+   (trace-req     :initarg :trace-req
+		  :type list
+		  :documentation
+                  "List of outstanding trace requests.")
+   (watch-req     :initarg :watch-req
+		  :type list
+		  :documentation
+                  "List of outstanding watch field requests.")
+   (object-refs   :initarg :object-refs
+		  :type list
+		  :initform nil
+		  :documentation
+		  "IDs of debuggee objects currently referenced by the debugger.")
+   (bpspecs       :initarg :bpspecs
+	          :type list
+	          :documentation
+                  "Breakpoints set in this process.")
+   (last-cmd      :initarg :last-cmd
+	          :type jde-dbs-cmd
+	          :documentation
+                  "Most recent command targeting this process.")
+   (win-cfg       :initarg :win-cfg
+	          :type window-configuration
+	          :documentation
+	          "Desired window configuration for this process.")
+   (attachedp     :initarg :attachedp
+		  :type boolean
+		  :initform nil
+		  :documentation
+		  "Non-nil if the debugger was attached to this process."))
+  (:allow-nil-initform t)
+  "Class of debuggee processes.")
+
+(defmethod initialize-instance ((this jde-dbs-proc) &rest fields)
+  "Constructor for objects of `jde-dbs-proc' class."
+  (call-next-method)
+
+  (if (not (slot-boundp this 'state-info))
+      (oset this state-info 
+	    (jde-dbs-proc-state-info 
+	     (format "State Info %d" (oref this id)))))
+
+  (assert (slot-boundp this 'main-class))
+  (assert (slot-boundp this 'id))
+  
+  (oset this msg-buf (get-buffer-create 
+		      (format "Process %s(%d)" 
+			      (oref this main-class)
+			      (oref this id))))
+  (save-excursion
+    (set-buffer (oref this msg-buf))
+    (erase-buffer)	
+    (goto-char (point-min))
+    (insert 
+       (format "*** Debugger Output for Process %s(%d) ***\n\n" 
+	       (oref this main-class)
+	       (oref this id))))
+
+  (oset this locals-buf (get-buffer-create
+			(format "%s(%d) Local Variables"
+				(oref this main-class)
+				(oref this id))))
+
+  (oset this threads-buf (get-buffer-create
+			  (format "%s(%d) Threads"
+				  (oref this main-class)
+				  (oref this id)))))
+
+
+(defmethod jde-dbs-proc-set-state ((this jde-dbs-proc) state)
+  (let ((state-info (oref this state-info)))
+    (oset state-info state state)))
+
+(defmethod jde-dbs-proc-set-state-reason ((this jde-dbs-proc) reason)
+  (let ((state-info (oref this state-info)))
+    (oset state-info reason reason)))
+
+(defmethod jde-dbs-proc-get-state ((this jde-dbs-proc))
+  (oref (oref this state-info) state))
+
+(defmethod jde-dbs-proc-get-state-reason ((this jde-dbs-proc))
+  (oref (oref this state-info) reason))
+
+; (defmethod jde-dbs-proc-display-debug-message ((this jde-dbs-proc) message)
+;   (let ((buffer
+; 	 (oref this msg-buf)))
+;     (if buffer
+; 	(save-excursion
+; 	  (set-buffer buffer)
+; 	  (goto-char (point-max))
+; 	  (insert (concat message "\n"))))))
+
+(defmethod jde-dbs-proc-display-debug-message ((this jde-dbs-proc) message)
+  (let ((buffer
+  (oref this msg-buf)))
+    (if buffer
+ (save-excursion
+   (let ((currbuffp (equal buffer (current-buffer))))
+     (if (not currbuffp) (other-window -1))
+     (set-buffer buffer)
+     (goto-char (point-max))
+     (insert (concat message "\n"))
+     (goto-char (point-max))
+     (if (not currbuffp) (other-window 1)))))))
+
+
+(defmethod jde-dbs-proc-move-to-morgue ((this jde-dbs-proc))
+  "Moves this process from the process registry to the process morgue."
+  (jde-dbs-proc-set-remove jde-dbs-the-process-registry this)
+  (jde-dbs-proc-set-add jde-dbs-the-process-morgue this))
+
+(defmethod jde-dbs-proc-move-to-registry ((this jde-dbs-proc))
+  "Moves this process from the registry to the morgue."
+  (jde-dbs-proc-set-remove jde-dbs-the-process-morgue this)
+  (jde-dbs-proc-set-add jde-dbs-the-process-registry this))
+
+
+(defmethod jde-dbs-proc-get-bpspec ((this jde-dbs-proc) bp)
+  "Gets the process specification for a breakpoint. BP may be either
+an instance of `jde-bug-breakpoint' or the debugger-assigned id
+for the breakpoint."
+  (let ((bpspecs (oref this bpspecs)))
+    (if (and (object-p bp) (jde-bug-breakpoint-p bp))
+	(let* ((jde-id (oref bp id)))
+	  (cdr
+	   (find-if
+	    (lambda (assoc)
+	      (let ((spec (cdr assoc)))
+		(equal (oref (oref spec breakpoint) id) jde-id)))
+	    bpspecs)))
+      (cdr (assoc bp bpspecs)))))
+
+(defmethod jde-dbs-proc-runnable-p ((this jde-dbs-proc))
+  (or
+   (oref this startupp)
+   (oref this suspendedp)
+   (oref this steppablep)))
+
+(defun jde-dbs-target-process-runnable-p ()
+  (interactive)
+  (let ((target (jde-dbs-get-target-process)))
+    (and target (jde-dbs-proc-runnable-p target))))
+
+(defun jde-dbs-target-process-steppable-p ()
+  (interactive)
+  (let ((target (jde-dbs-get-target-process)))
+    (and target (oref target steppablep))))
+
+(defun jde-dbs-display-debug-message (proc-id message)
+  (let ((process (jde-dbs-get-process proc-id)))
+    (if process 
+	(jde-dbs-proc-display-debug-message process message)
+      (message message))))
+
+(defvar jde-dbs-proc-counter 0
+  "Process counter. Used to generate process IDs.")
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;; 
+;; Java Object                                                                ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-java-obj ()
+  ((jtype  :initarg :jtype
+	   :type string
+	   :documentation
+	  "Type of this object."))
+  "Superclass of Java objects.")
+
+(defmethod jde-dbs-java-obj-to-string ((this jde-dbs-java-obj))
+  "")
+
+
+(defclass jde-dbs-java-primitive (jde-dbs-java-obj)
+  ((value :initarg :value
+	  :type (or string number)
+	  :documentation
+	  "Value of this primitive object."))
+  "Class of Java primitives.")
+
+(defmethod jde-dbs-java-obj-to-string ((this jde-dbs-java-primitive))
+  (format "%s" (oref this value)))
+
+(defclass jde-dbs-java-null (jde-dbs-java-obj) ()
+  "Java null object.")
+
+(defmethod initialize-instance ((this jde-dbs-java-null) &rest fields)
+  "Constructor for run process command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (oset this jtype "null"))
+
+
+(defmethod jde-dbs-java-obj-to-string ((this jde-dbs-java-null))
+  "null")
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;; 
+;; Java Variable                                                              ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-java-variable ()
+  ((name         :initarg :name
+		 :type string
+		 :documentation
+		 "Name of this variable")
+   (jtype        :initarg :jtype
+		 :type string
+		 :documentation
+		 "Type of this variable.")
+   (value        :initarg :value
+                 :type jde-dbs-java-obj
+		 :documentation
+		 "Value of this variable."))
+  "Class that defines the JDE's representation of a Java variable.")
+
+(defmethod jde-dbs-java-variable-to-string ((this jde-dbs-java-variable))
+  (format "%s %s = %s"
+	  (oref this jtype)
+	  (oref this name)
+	  (jde-dbs-java-obj-to-string (oref this value))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;; 
+;; Java Class Instance                                                        ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-java-class-instance (jde-dbs-java-obj)
+  ((id           :initarg :id
+		 :type integer
+		 :documentation
+		 "Id assigned to this object by the debugger.")
+   (gc-flag      :initarg :gc-flag
+		 :type boolean
+		 :documentation
+		 "t if this object has been garbage collected."))
+  "Instance of a Java class accessed via the debugger.")
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;; 
+;; Java Array                                                                 ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-java-array (jde-dbs-java-class-instance)
+  ((length     :initarg :length
+	       :type integer
+	       :documentation
+	       "Length of this array.")
+   (elements   :initarg :elements
+	       :type list
+	       :initform nil
+	       :documentation
+	       "Elements of this array."))
+  "Class of Lisp objects representing instances of Java arrays.")
+
+
+
+(defmethod jde-dbs-java-obj-to-string ((this jde-dbs-java-array))
+  (let ((str (format "<%s:%d%s> %d" 
+		     (oref this jtype)
+		     (oref this id)
+		     (if (oref this gc-flag) ":gc" "")
+		     (oref this length)))
+	(elements (oref this elements)))
+    (if elements
+	(let ((sep "\n |- "))
+	  (concat 
+	   str
+	   sep
+	   (mapconcat
+	    (lambda (element) 
+	      (jde-dbs-java-obj-to-string element))
+	    elements sep)))
+      str)))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;; 
+;; Java User-Defined Class Instance                                           ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-java-udci (jde-dbs-java-class-instance)
+  ((fields       :initarg :fields
+		 :type list
+		 :initform nil
+		 :documentation
+		 "Fields of this object."))
+  "Class of Lisp objects representing instances of user-defined Java classes.")
+
+
+(defmethod jde-dbs-java-udci-add-field ((this jde-dbs-java-udci) field)
+  (oset this fields
+	(nconc (oref this fields) (list (cons (oref field name) field)))))
+
+
+(defmethod jde-dbs-java-obj-to-string ((this jde-dbs-java-udci))
+  (let ((str (format "<%s:%d%s>" 
+		     (oref this jtype)
+		     (oref this id)
+		     (if (oref this gc-flag) ":gc" "")))
+	(fields (oref this fields)))
+    (if fields
+	(let ((sep "\n |- "))
+	  (concat 
+	   str
+	   sep
+	   (mapconcat
+	    (lambda (assoc) 
+	      (jde-dbs-java-variable-to-string (cdr assoc)))
+	    fields sep)))
+      str)))
+	 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;; 
+;; Debugger Class                                                             ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-debugger ()
+  ((name          :initarg :name
+	          :initform "JDEbug"
+		  :type string
+		  :documentation
+		  "Name of debugger.")
+   (buffer-name   :initarg :buffer-name
+                  :initform "*JDEbug*"
+		  :type string
+		  :documentation
+		  "Name of buffer used to interact with debugger.")
+   (buffer        :initarg :buffer
+		  :type buffer
+		  :documentation
+		  "Buffer used to interact with debugger.")
+   (process       :initarg :process)
+   (comint-filter :initarg :comint-filter)
+   (started-p     :initarg :started-p
+		  :initform nil
+		  :type boolean
+		  :documentation
+		  "True if debugger started successfully."))
+  "Class of debuggers.")
+
+(defmethod jde-dbs-debugger-register-process-filter ((debugger jde-dbs-debugger) filter)
+  "Set the process filter for the debugger to FILTER."
+  (set-process-filter  (oref debugger process) filter))
+
+
+(defmethod jde-dbs-debugger-display-message ((debugger jde-dbs-debugger) message)
+  "Displays message in the debugger process buffer."
+ (let ((buffer
+	 (oref debugger buffer)))
+    (if buffer
+	(save-excursion
+	  (set-buffer buffer)
+	  (goto-char (point))
+	  (insert-before-markers (concat message "\n"))))))
+
+
+
+(defmethod jde-dbs-debugger-start((this jde-dbs-debugger))
+  "Starts the debugger."
+  (if (not (jde-dbs-debugger-running-p))
+      (let* ((debugger-buffer-name 
+	      (oref this buffer-name))
+	     (debugger-buffer 
+	      (let ((old-buf (get-buffer debugger-buffer-name)))
+		    (if old-buf (kill-buffer old-buf))
+		    (get-buffer-create debugger-buffer-name)))
+	     (win32-p (eq system-type 'windows-nt))
+	     (source-directory default-directory)
+	     (working-directory
+	      (if (and 
+		   jde-run-working-directory
+		   (not (string= jde-run-working-directory "")))
+		  jde-run-working-directory
+		source-directory))	     
+	     (vm (jde-dbs-choose-vm))
+	     (jde-java-directory
+	      (concat
+	       (jde-find-jde-data-directory)
+	       "java/"))
+	     (vm-args 
+		(let (args)
+		  (setq args 
+			(append 
+			 args
+			 (list
+			  "-classpath"
+			  (jde-convert-cygwin-path
+                           (if jde-bug-vm-includes-jpda-p
+                               (format
+                                (if jde-bug-debug
+                                    "%sclasses%s%s"   
+                                  "%slib/jde.jar%s%s")
+                                jde-java-directory
+                                jde-classpath-separator
+                                (expand-file-name 
+                                 "lib/tools.jar" jde-bug-jdk-directory))
+                             (format 
+                              (if jde-bug-debug
+                                  "%sclasses%s%s"   
+                                "%ssrc%s%slib/jde.jar%s%s" )
+                              jde-java-directory 
+                              jde-classpath-separator
+                              jde-java-directory 
+                              jde-classpath-separator
+                              (expand-file-name 
+                               "lib/jpda.jar" jde-bug-jpda-directory)))
+                           jde-classpath-separator))))
+		  (if jde-bug-debug
+		      (setq args 
+			    (append args
+			     (list "-Xdebug"
+				   "-Xnoagent"   
+				   "-Xrunjdwp:transport=dt_socket,address=2112,server=y,suspend=n"))))
+		  (setq args (append args (list "jde.debugger.Main")))
+		  args))		  
+	     (command-string 
+	      (concat 
+	       vm " " 
+	       (jde-run-make-arg-string
+		vm-args)
+	       "\n\n"))
+	     debugger-process)
+	(oset this started-p nil)
+	(setq jde-dbs-debugger-output nil)
+
+
+	(save-excursion
+	  (set-buffer debugger-buffer)
+	  (erase-buffer)
+	  ;; Set working directory
+	  (if (and
+	       (file-exists-p working-directory)
+	       (file-directory-p working-directory))
+	      (cd working-directory)
+	    (error "Invalid working directory: %s" working-directory))
+	  (insert (concat "cd " working-directory "\n"))
+	  (insert command-string)
+	  (jde-run-mode))
+
+	(save-w32-show-window
+	 (comint-exec debugger-buffer debugger-buffer-name vm nil vm-args)
+	 (setq debugger-process (get-process debugger-buffer-name))
+	 (oset this process debugger-process)
+	 (oset this buffer debugger-buffer)
+	 (oset this comint-filter (process-filter debugger-process))
+	 (jde-dbs-debugger-register-process-filter this 'jde-dbs-asynch-output-listener)
+	 )
+
+	(cd source-directory)
+
+	(bury-buffer debugger-buffer)
+	
+	;; Wait for response from debugger
+	(if (not (accept-process-output debugger-process jde-bug-debugger-command-timeout 0))
+	    (progn
+	      (message "Error: debugger failed to start.")
+	      nil)
+	  (oref this started-p)))
+    (message "An instance of the debugger is running.")
+    (pop-to-buffer (jde-dbs-get-app-buffer-name))
+    nil))
+    
+(defmethod jde-dbs-debugger-quit ((debugger jde-dbs-debugger)) 
+  (jde-dbs-do-command -1 "quit")
+  (slot-makeunbound debugger :process)
+  (slot-makeunbound debugger :buffer)
+  (slot-makeunbound debugger :comint-filter))
+
+(defun jde-dbs-debugger-running-p ()
+  "*Returns t if the debugger is running."
+  (and (slot-boundp jde-dbs-the-debugger 'buffer)
+       (oref jde-dbs-the-debugger started-p)
+       (comint-check-proc (oref jde-dbs-the-debugger buffer))))
+
+(defvar jde-dbs-the-debugger (jde-dbs-debugger "JDEbug")
+  "The debugger.")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Debugger Command Class                                                     ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-cmd ()
+  ((process    :initarg :process
+	       :type jde-dbs-proc
+	       :documentation
+	       "Process that this command targets.")
+   (id         :initarg :id
+	       :type integer
+	       "Command id.")
+   (name       :initarg :name
+               :type string
+	       :documentation
+	       "Name of command.")
+   (result     :initarg :result
+	       "Result of executing command.")
+   (data       :initarg :data
+	       "Data returned by command.")
+   (msg        :initarg :msg
+	       :type string
+	       "Message to display to user in debug buffer.")
+   )
+  "Super class of debugger commands.")
+ 
+
+(defmethod initialize-instance ((this jde-dbs-cmd) &rest fields)
+  "Constructor for debugger commands. Generates a unique id for this command."
+  (call-next-method)
+  (setq jde-dbs-cmd-counter (+ jde-dbs-cmd-counter 1))
+  (oset this id jde-dbs-cmd-counter))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-cmd))
+  "Creates the command line for this command by concatentating
+the process id, command id, and command name. If there is no
+process, specifies the process id as -1. Derived classes can
+extend this method to specify command arguments."
+  (let* ((process (oref this process))
+	 (process-id (if process (oref process id) -1))
+	 (command-id (oref this id))
+	 (command-name (oref this name)))
+    (format "%s %s %s" process-id command-id command-name)))
+    
+(defvar jde-dbs-debugger-output nil
+  "Contains output from the debugger.")
+
+(defvar jde-dbs-command-reply nil
+  "Contains reply to a debugger command.")
+
+(defvar jde-dbs-pending-command 0
+"Number of the current command.")
+
+(defun jde-dbs-eval-debugger-output (lisp-form)
+  (condition-case error-desc
+      (eval (read lisp-form))
+    (error 
+     (let* ((process (jde-dbs-get-target-process)))
+       (if process
+	   (jde-dbs-proc-display-debug-message 
+	    process 
+	    (concat
+	     "Error: evaluating debugger output caused a Lisp error.\n"
+	     "  See *messages* buffer for details.")))
+       (message "Error: evaluating output from the debugger caused a Lisp error.")
+       (message "Debugger output: %s." lisp-form)
+       (message "Lisp error: %s" error-desc)))))
+
+(defun jde-dbs-extract-exception (debugger-output)
+  (let ((lisp-form "")
+	(remainder "")
+	(output-length (length debugger-output))
+	(re "\\(.*Exception:.*[\n]\\)+\\(.*at[^\n]*[\n]\\)+"))
+    (if (string-match re debugger-output)
+	(let ((start (match-beginning 0))
+	      (end (match-end 0)))
+	  (setq lisp-form (format "(jde-dbo-unknown-exception \"%s\")" 
+				  (substring debugger-output 0 end)))
+	  (if (< end output-length)
+	      (setq remainder (substring debugger-output end output-length))))
+      (setq remainder debugger-output))
+    (cons lisp-form remainder)))
+
+(defun jde-dbs-extract-lisp-form (debugger-output)
+"Extract first complete Lisp form from debugger output.
+Returns (FORM . REMAINDER) where FORM is the Lisp form
+or the null string and REMAINDER is the remainder of the
+debugger output following the Lisp form."
+  (let ((lisp-form "")
+	(remainder "")
+	(level 0)
+	in-string-p
+	in-escape-p
+	(curr-pos 1)
+	(output-length (length debugger-output))
+	command-end
+	lisp-form-end)
+    (setq 
+     lisp-form-end
+     (catch 'found-lisp-form
+       ;; skip over any inital white space.
+       (string-match "^[\n\t ]*(" debugger-output)
+       (setq curr-pos (match-end 0))
+
+       (while (< curr-pos output-length)
+
+	 (cond 
+
+	  ;; Current character = left slash (escape)
+	  ((equal (aref debugger-output curr-pos) ?\\)
+	   (if in-string-p
+	       (setq in-escape-p (not in-escape-p))))
+	  
+	  ;; Current character = quotation mark
+	  ((equal (aref debugger-output curr-pos) ?\")
+	   (if in-string-p
+	       (if in-escape-p
+		   (setq in-escape-p nil)
+		 (setq in-string-p nil))
+	     (setq in-string-p t)))
+
+	  ;; Current character = right paren
+	  ((and
+	    (not in-string-p)
+	    (equal (aref debugger-output curr-pos) ?\)))
+	     (if (= level 0)
+		 (throw 'found-lisp-form curr-pos)
+	       (setq level (1- level))
+	       (if (< level 0)
+		   (error "Error parsing debugger output."))))
+
+	  ;; Current character = left paren
+	  ((and
+	    (not in-string-p)
+	    (equal (aref debugger-output curr-pos) ?\()
+	       (setq level (1+ level))))
+	  (t
+	   (if in-escape-p
+	       (setq in-escape-p nil))))
+
+	 (setq curr-pos (1+ curr-pos)))
+
+       -1))
+    (if (> lisp-form-end 1)
+	(progn
+	  (setq lisp-form (substring debugger-output 0 (1+ lisp-form-end)))
+	  (when (< lisp-form-end (1- output-length))
+	    (setq remainder (substring debugger-output (1+ lisp-form-end) output-length))
+	    (if (string-match "(" remainder)
+		(setq remainder (substring remainder (string-match "(" remainder)))
+	      (setq remainder ""))))
+      (setq remainder debugger-output))
+    (cons lisp-form remainder)))
+
+(defun jde-dbs-reply-p (form)
+  "Returns t if FORM is a command response form."
+  (or
+   (string-match "jde-dbo-command-result" form)
+   (string-match "jde-dbo-command-error" form)))
+
+(defvar jde-dbs-pending-event-queue nil
+"Queue of events that occurred before receiving a reply to the last command.")
+
+(defun jde-dbs-command-reply-listener (process output)
+  "Listens at the jdebug socket for a reply to the command specified by
+`jde-dbs-pending-command'."
+  ;; (message "entering command reply listener")
+  (let* ((combined-output (concat jde-dbs-debugger-output output))
+	 (parsed-output 
+	  (if (string-match "^[\n\t ]*(" combined-output)
+	      (jde-dbs-extract-lisp-form combined-output)
+	    (jde-dbs-extract-exception combined-output)))			 
+	 (form (car parsed-output))
+	 (remainder (cdr parsed-output))
+	 reply-received)
+    ;; (message "form: %s" form)
+    ;; (message "remainder: %s" remainder)
+    (funcall (oref jde-dbs-the-debugger  comint-filter)
+	 process output)
+    (while (not (string= form ""))
+      (if (jde-dbs-reply-p form) 
+	  (progn 
+	    (setq jde-dbs-command-reply form)
+	    (setq reply-received t))
+	;; (message "   appending %s to pending event queue" form)
+	;; (jde-dbs-eval-debugger-output form)
+	(if (not reply-received)
+	    (setq jde-dbs-pending-event-queue
+		  (append jde-dbs-pending-event-queue (list form)))
+	  (jde-dbs-eval-debugger-output form)))
+      (setq parsed-output
+	    (jde-dbs-extract-lisp-form remainder))
+      (setq form (car parsed-output))
+      (setq remainder (cdr parsed-output)))
+    (setq jde-dbs-debugger-output remainder)
+    (if (not reply-received)
+	(when (not (accept-process-output process jde-bug-debugger-command-timeout 0))
+	    (message "No response to command %d. (process = %s; timeout = %s sec.)"
+		     jde-dbs-pending-command
+		     (if (jde-dbs-get-target-process)
+			 (oref (jde-dbs-get-target-process) id)
+		       "?")
+		     jde-bug-debugger-command-timeout)
+		    (setq jde-dbs-command-reply nil)))))
+	
+(defun jde-dbs-asynch-output-listener (process output)
+  "Listens at the jdebug socket for asynchronous debugger output."
+  (let* ((combined-output (concat jde-dbs-debugger-output output))
+	 (parsed-output 
+	  (if (string-match "^[\n\t ]*(" combined-output)
+	      (jde-dbs-extract-lisp-form combined-output)
+	    (jde-dbs-extract-exception combined-output)))		
+	 (lisp-form (car parsed-output))
+	 (remainder (cdr parsed-output))
+	 events)
+
+    ;; (message "asynch form: %s" lisp-form)
+    ;; (message "asynch remainder: %s" remainder)
+
+    (funcall (oref  jde-dbs-the-debugger comint-filter)
+	     process output)
+    ;; Extract events from debugger output.
+    (while (not (string= lisp-form ""))
+      ;; (message "   evaluating %s" lisp-form)
+      ;; (jde-dbs-eval-debugger-output lisp-form)
+      (setq events (append events (list lisp-form)))
+      (setq parsed-output
+	    (jde-dbs-extract-lisp-form remainder))
+      (setq lisp-form (car parsed-output))
+      (setq remainder (cdr parsed-output)))
+    (setq jde-dbs-debugger-output remainder)
+    (if events
+	(mapc (lambda (event) (jde-dbs-eval-debugger-output event))
+	      events))))
+
+(defun jde-dbs-do-command (vm command)
+  "Posts the specified command to the debugger and returns its response."
+  (let* ((debugger-process 
+	  (oref jde-dbs-the-debugger process))
+	 (previous-listener (process-filter debugger-process))
+	 cmd)	
+    (setq jde-dbs-debugger-output "")
+    (setq jde-dbs-command-reply "")
+    (setq jde-dbs-pending-events nil)
+    (setq jde-dbs-cmd-counter (+ jde-dbs-cmd-counter 1))
+    (setq jde-dbs-pending-command (number-to-string jde-dbs-cmd-counter))
+    (setq cmd (concat (number-to-string vm) " " jde-dbs-pending-command " " command "\n\n"))
+    (jde-dbs-debugger-display-message jde-dbs-the-debugger (concat "JDE> " cmd))
+    (set-process-filter debugger-process 'jde-dbs-command-reply-listener)
+    (process-send-string debugger-process cmd)
+    (when (not (accept-process-output debugger-process jde-bug-debugger-command-timeout 0))
+		(message "Error: debugger didn't respond to command:\n%s" cmd)
+		(setq jde-dbs-command-reply nil))
+    (set-process-filter debugger-process previous-listener)
+    (if jde-dbs-command-reply
+	(let ((result (jde-dbs-eval-debugger-output jde-dbs-command-reply)))
+	  ;; evaluate any events that occurred between issuance and 
+	  ;; acknowledgement of this command
+	  (mapc (lambda (event) (jde-dbs-eval-debugger-output event))
+		jde-dbs-pending-event-queue)
+	  (setq jde-dbs-pending-event-queue nil)
+	  result))))
+
+
+
+(defvar jde-dbs-debugger-socket-number nil
+"Number of socket used to communicate with debugger.")
+
+
+(defun jde-dbs-listen-for-debugger-socket (debugger-process output)
+  (set-process-filter debugger-process jde-dbs-app-buffer-filter)
+  (eval (read output)))
+
+(defmethod jde-dbs-cmd-success-action ((this jde-dbs-cmd)))
+
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-cmd)))
+
+
+(defmethod jde-dbs-cmd-display-response ((this jde-dbs-cmd))
+  (if (slot-boundp this 'msg)
+      (jde-dbs-proc-display-debug-message 
+       (oref this process)
+       (oref this msg))))
+
+(defmethod jde-dbs-cmd-execute-pending-events ((this jde-dbs-cmd))
+  "Evaluate any events that occurred between issuance and 
+   acknowledgement of this command"
+  (let ((events jde-dbs-pending-event-queue))
+    ;; Empty queue to avoid recursion if commands are executed
+    ;; as a result of processing these events.
+    (setq jde-dbs-pending-event-queue nil)
+    (mapc (lambda (event) (jde-dbs-eval-debugger-output event))
+		events)))
+
+
+(defmethod jde-dbs-cmd-exec ((this jde-dbs-cmd))
+  "Posts the specified command to the debugger and returns its response."
+  (let* ((debugger-process 
+	  (oref jde-dbs-the-debugger process))
+	 (previous-listener (process-filter debugger-process))
+	 (target-process (oref this process))
+	 (command-line (format "%s\n" (jde-dbs-cmd-make-command-line this))))	
+    (setq jde-dbs-debugger-output "")
+    (setq jde-dbs-command-reply "")
+    (setq jde-dbs-pending-events nil)
+    (setq jde-dbs-pending-command (oref this id))
+    (if target-process (oset target-process last-cmd this))
+    (jde-dbs-debugger-display-message jde-dbs-the-debugger (concat "JDE> " command-line))
+    (set-process-filter debugger-process 'jde-dbs-command-reply-listener)
+    (process-send-string debugger-process command-line)
+    (process-send-string debugger-process "\n")
+    (when (not (accept-process-output debugger-process jde-bug-debugger-command-timeout 0))
+		(message "Error: debugger didn't respond to command:\n%s" command-line)
+		(setq jde-dbs-command-reply nil))
+ 
+   (set-process-filter debugger-process previous-listener)
+
+    (if jde-dbs-command-reply
+	(let ((result (jde-dbs-eval-debugger-output jde-dbs-command-reply)))
+
+	  (oset this :result result)
+
+	  (oset this :data (car (jde-dbo-command-result-data (oref this result))))
+
+	  (if (jde-dbo-command-succeeded-p result)
+	      (jde-dbs-cmd-success-action this)
+	    (jde-dbs-cmd-failure-action this))
+
+	  (jde-dbs-cmd-display-response this)
+
+	  (jde-dbs-cmd-execute-pending-events this)
+	  (oref this :result)))))
+
+(defvar jde-dbs-cmd-counter 0
+ "Count of the number of commands issued in this session.")
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Launch Process Command                                                     ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-launch-process (jde-dbs-cmd)
+  ((main-class  :initarg :main-class
+		:type string
+		:documentation
+		"Class containing this process's main method.")
+   (jre-home    :initarg :jre-home
+		:type string
+		:documentation
+		"Home directory of JRE used to launch this process.")
+   (vmexec     :initarg :vmexec
+	        :type string
+		:initform "java"
+	        :documentation
+	        "Name of vm executable used to run process.")
+   (vm-args     :initarg :args
+	        :type string
+		:initform ""
+	        :documentation
+		"Command line arguments to be passed to vm's main method.")
+   (app-args    :initarg :app-args
+		:type string
+		:initform ""
+		:documentation
+		"Command line arguments to be passed to app's main method."))
+  "Class of launch-process commands.")
+
+(defun jde-dbs-choose-vm ()
+  (if (and
+       (eq system-type 'windows-nt)
+       (string= jde-run-java-vm "java"))
+      jde-run-java-vm-w
+    jde-run-java-vm))
+
+
+(defun jde-dbs-get-app-buffer-name ()
+  (concat "*" (jde-run-get-main-class) "*"))
+    
+(defmethod initialize-instance ((this jde-dbs-launch-process) &rest fields)
+  "Constructor for debugger commands. Generates a unique id for this command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  ;; Set command name.
+  (oset this name "launch")
+
+  ;; You must specify a process to launch when constructing a launch command."
+  (assert (slot-boundp this :process))
+
+  ;; Set main class.
+  (if (not (slot-boundp this :main-class))
+    (oset this :main-class
+	  (oref (oref this :process) :main-class)))
+
+  ;; Set vm.
+  ;; (oset this vm (jde-dbs-choose-vm))
+
+  ;; Set vm args
+  (oset this vm-args 
+ 	(concat (mapconcat (lambda (s) s) (jde-db-get-vm-args) " ")
+		" "
+ 		(mapconcat (lambda (s) s) (jde-db-get-vm-args-from-user) " ")))
+
+
+  ;; Set application arguments.
+  (oset this app-args
+ 	(concat 
+	 (if jde-db-option-application-args
+	     (mapconcat (lambda (s) s) jde-db-option-application-args " ") 
+	   "")
+	 " "
+	 (mapconcat (lambda (s) s) (jde-db-get-app-args-from-user) " "))))
+  
+
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-launch-process))
+  "Creates the command line for the launch command."
+  (let ((cmd (format "-1 %s %s %s -vmexec %s"
+		     (oref this id)                    ;; cid
+		     (oref this name)                  ;; launch
+		     (oref (oref this process) id)     ;; pid
+		     (oref this vmexec ))))  
+
+    (if (slot-boundp this 'jre-home)
+	(setq cmd (concat cmd " -home " (oref this jre-home))))
+		     
+    (setq cmd 
+	  (format "%s %s %s %s" 
+		  cmd
+		  (oref this vm-args)            ;; vm args
+		  (oref this main-class)         ;; main class
+		  (oref this app-args)))         ;; command line args
+    ))    
+
+(defmethod jde-dbs-cmd-success-action ((this jde-dbs-launch-process))
+  (call-next-method)
+  (delete-other-windows)
+  (let* ((source-buffer (current-buffer))
+	 (cli-socket
+	  (car (jde-dbo-command-result-data result)))
+	 (cli-buffer-name 
+	  (format "%s(%d) CLI" main-class (oref process id)))
+	 (cli-buffer
+	  (get-buffer-create cli-buffer-name)))
+
+    (oset (oref this process) cli-socket cli-socket)
+
+    ;; Connect to socket used by debugger to transport the
+    ;; standard I/O of the debuggee process.
+    (open-network-stream 
+     cli-buffer-name
+     cli-buffer 
+     ;; "127.0.0.1" 
+     jde-bug-debugger-host-address
+     cli-socket)
+
+    (save-excursion
+      (set-buffer cli-buffer)
+      (erase-buffer)
+      (comint-mode)
+      (oset (oref this process) cli-buf cli-buffer))
+
+    (oset this msg
+	  (format "Emacs connected to standard IO port %d for process %s." 
+		  cli-socket
+		  (oref this main-class)))
+
+    (pop-to-buffer (oref process msg-buf))
+    (pop-to-buffer source-buffer)
+    (split-window-vertically)
+    (pop-to-buffer (oref process locals-buf))
+    (pop-to-buffer source-buffer)
+    (oset process win-cfg (current-window-configuration))))
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-launch-process))
+  (delete-other-windows)
+  (let ((source-buffer (current-buffer)))
+    (oset this  msg
+	  (format "Error: debugger unable to launch %s.\n  Reason: %s" 
+		  (oref this main-class)
+		  (oref this data)))
+      (split-window-vertically)
+      (pop-to-buffer (oref process msg-buf))
+      (pop-to-buffer source-buffer)
+      (oset process win-cfg (current-window-configuration))))
+ 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Attach Shared Memory                                                       ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-attach-shmem (jde-dbs-cmd)
+  ((process-name  :initarg :process-name
+		  :type string
+		  :documentation
+		  "Name of process to attach."))
+  "Attach debugger to a running process via shared memory.")
+
+(defmethod initialize-instance ((this jde-dbs-attach-shmem) &rest fields)
+  "Constructor for attach_shmem command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+
+  (assert (slot-boundp this 'process-name))
+
+  ;; Set command name.
+  (oset this name "attach_shmem"))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-attach-shmem))
+  "Creates the command line for the attach_shmem command."
+  (format "-1 %s %s %s %s" 
+	  (oref this id)
+	  (oref this name)                 ;; command name
+	  (oref (oref this process) id)    ;; process id
+	  (oref this process-name)))       ;; process name   
+
+(defmethod jde-dbs-cmd-success-action ((this jde-dbs-attach-shmem))
+  (call-next-method)
+  (delete-other-windows)
+  (let ((source-buffer (current-buffer)))
+    (oset (oref this process) :attachedp t)
+    (oset (oref this process) :startupp t)
+    (oset this msg  (format "Attached to process %s." 
+			    (oref this process-name)))
+    (split-window-vertically)
+    (pop-to-buffer (oref process msg-buf))
+    (pop-to-buffer source-buffer)
+    (oset process win-cfg (current-window-configuration))))
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-attach-shmem))
+  (delete-other-windows)
+  (let ((source-buffer (current-buffer)))
+    (oset this  msg
+     (format "Error: cannot attach process %s.\n Reason: %s." 
+		    (oref this process-name)
+		    (oref this data)))
+      (split-window-vertically)
+      (pop-to-buffer (oref process msg-buf))
+      (pop-to-buffer source-buffer)
+      (oset process win-cfg (current-window-configuration))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Attach Process via Socket                                                  ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-attach-socket (jde-dbs-cmd)
+  ((port  :initarg :port
+	  :type string
+	  :documentation
+	  "Name of port on which existing process is listening.")
+   (host  :initarg :host
+	  :type string
+	  :documentation
+	  "Name of host on which existing process is listening."))
+  "Attach debugger to a running process via a socket connection.")
+
+(defmethod initialize-instance ((this jde-dbs-attach-socket) &rest fields)
+  "Constructor for attach_socket command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+
+  (assert (slot-boundp this 'port))
+
+  ;; Set command name.
+  (oset this name "attach_socket"))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-attach-socket))
+  "Creates the command line for the attach_socket command."
+  (let ((cmd
+	 (format "-1 %s %s %s -port %s" 
+	  (oref this id)
+	  (oref this name)                 ;; command name
+	  (oref (oref this process) id)    ;; process id
+	  (oref this port))))              ;; process name
+    (if (slot-boundp this 'host)
+	(setq cmd (format "%s -host %s" cmd (oref this host))))
+    cmd))
+
+(defmethod jde-dbs-cmd-success-action ((this jde-dbs-attach-socket))
+  (call-next-method)
+  (delete-other-windows)
+  (let ((source-buffer (current-buffer)))
+    (oset (oref this process) attachedp t)
+    (oset (oref this process) startupp t)
+    (oset this msg  (format "Attached to process on port %s of %s." 
+			    (oref this port)
+			    (if (slot-boundp this 'host)
+				(oref this host)
+			      "local host")))
+    (split-window-vertically)
+    (pop-to-buffer (oref process msg-buf))
+    (pop-to-buffer source-buffer)
+    (oset process win-cfg (current-window-configuration))))
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-attach-socket))
+  (delete-other-windows)
+  (let ((source-buffer (current-buffer)))
+    (oset this  msg
+     (format "Error: cannot attach to process on port %s of %s.\n Reason: %s." 
+	     (oref this port)
+	     (if (slot-boundp this 'host)
+		 (oref this host)
+	       "local host")
+	     (oref this data)))
+      (split-window-vertically)
+      (pop-to-buffer (oref process msg-buf))
+      (pop-to-buffer source-buffer)
+      (oset process win-cfg (current-window-configuration))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Listen for Process                                                         ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-listen-for-process (jde-dbs-cmd)
+  ((address   :initarg :address
+	      :type string
+	      :documentation
+	      "Address at which to listen for a debuggee process.")
+   (transport :initarg :transport
+	      :type string
+	      :initform "shmem"
+	      :documentation
+	      "Transport mechanism used to interact with debuggee process."))
+  "Listen for a process requesting debugger services.")
+
+(defmethod initialize-instance ((this jde-dbs-listen-for-process) &rest fields)
+  "Constructor for listen command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+
+  (assert (slot-boundp this 'address))
+
+  (assert (not 
+	   (and
+	    (not (eq system-type 'windows-nt))
+	    (string= (oref this transport) "shmem"))))
+
+  ;; Set command name.
+  (oset this name 
+	(concat "listen_"
+		(oref this transport))))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-listen-for-process))
+  "Creates the command line for the listen command."
+  (format "-1 %s %s %s %s" 
+	  (oref this id)
+	  (oref this name)                 ;; command name
+	  (oref (oref this process) id)    ;; process id
+	  (oref this address)))            ;; process address
+
+(defmethod jde-dbs-cmd-success-action ((this jde-dbs-listen-for-process))
+  (call-next-method)
+  (delete-other-windows)
+  (let ((source-buffer (current-buffer)))
+    (oset this msg  (format "Listening for process at %s address: %s." 
+			    (if (string= (oref this transport) "shmem")
+				"shared memory" "socket")
+			    (oref this address)))
+    (oset process startupp t)
+    (split-window-vertically)
+    (pop-to-buffer (oref process locals-buf))
+    (split-window-vertically)
+    (pop-to-buffer (oref process msg-buf))
+    (pop-to-buffer source-buffer)
+    (oset process win-cfg (current-window-configuration))))
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-listen-for-process))
+  (delete-other-windows)
+  (let ((source-buffer (current-buffer)))
+    (oset this  msg
+     (format "Error: cannot listen for process at %s address: %s.\n Reason: %s." 
+	     (if (string= (oref this transport) "shmem")
+		 "shared memory" "socket")
+	     (oref this address)
+	     (oref this data)))
+      (split-window-vertically)
+      (pop-to-buffer (oref process msg-buf))
+      (pop-to-buffer source-buffer)
+      (oset process win-cfg (current-window-configuration))))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Run Process Command Class                                                  ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-run-process (jde-dbs-cmd) ()
+  "Run process command.")
+
+(defmethod initialize-instance ((this jde-dbs-run-process) &rest fields)
+  "Constructor for run process command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+
+  ;; Set command name.
+  (oset this name "run"))
+
+
+(defmethod jde-dbs-cmd-success-action ((this jde-dbs-run-process))
+  (call-next-method)
+  (oset this msg (format "Running %s." 
+			 (oref (oref this process)  main-class))))
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-run-process))
+  (oset this msg 
+	(format "Error: unable to run %s..\n  Reason: %s."
+		(oref (oref this process) main-class)
+		(oref this result))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Finish Process Command Class                                               ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-finish-process (jde-dbs-cmd) ()
+  "Finish process command.")
+
+(defmethod initialize-instance ((this jde-dbs-finish-process) &rest fields)
+  "Constructor for finish process command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (slot-boundp this :process))
+
+  ;; Set command name.
+  (oset this name "finish"))
+
+(defmethod jde-dbs-cmd-exec ((this jde-dbs-finish-process))
+  "Executes the finish process command."
+  (let* ((process (oref this :process))
+	 (main-class (oref process :main-class))
+	 (result (call-next-method)))
+    (if (jde-dbo-command-succeeded-p result)
+	(progn
+	  (jde-dbs-proc-display-debug-message process
+	   (concat "Terminating " main-class)))
+      (jde-dbs-proc-display-debug-message process
+       (concat "Error: debugger unable to terminate: "
+	       main-class
+	       ".\n  Reason: " 
+	       (car (jde-dbo-command-result-data result))))
+      nil)))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Set Breakpoint Command Class                                               ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-set-breakpoint (jde-dbs-cmd) 
+  ((breakpoint    :initarg :breakpoint
+	          ;; :type jde-bug-breakpoint
+	          :documentation
+	          "Breakpoint specification."))
+  "Set breakpoint command.")
+
+(defmethod initialize-instance ((this jde-dbs-set-breakpoint) &rest fields)
+  "Constructor for set breakpoint command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+  (assert (oref this breakpoint))
+
+  ;; Set command name.
+  (oset this name "break absolute"))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-set-breakpoint))
+  "Creates the command line for the set breakpoint command."
+  (let* (
+	 (bp-spec (oref this breakpoint))
+	 (file (oref bp-spec file))
+	 (line (oref bp-spec line)))
+    (format "%s %s %s" 
+	    (call-next-method)
+	    file     ;; File
+	    line)))  ;; Line number    
+
+(defmethod jde-dbs-cmd-success-action ((this jde-dbs-set-breakpoint))
+  (call-next-method)
+  (let*  ((process (oref this process))
+	  (bp-procid (oref this data))
+	  (bp-spec (oref this breakpoint))
+	  (file (oref bp-spec file))
+	  (line (oref bp-spec line))
+	  (bpspec (jde-dbs-proc-bpspec "spec" :id bp-procid :breakpoint bp-spec))
+	  (bpspecs (if (slot-boundp process :bpspecs) (oref process :bpspecs))))
+    (if bpspecs
+	(oset process bpspecs (jde-dbs-proc-bpspecs-add bpspecs bpspec))
+      (oset process bpspecs (jde-dbs-proc-bpspecs-add nil bpspec)))
+    (oset this msg (format "Setting breakpoint at line %s in %s." line file))))
+
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-set-breakpoint))
+  (let* ((bp-spec (oref this breakpoint))
+	 (file (oref bp-spec file))
+	 (line (oref bp-spec line)))
+    (oset this msg  (format "Error: cannot set breakpoint at line %s in file %s.\n  Reason:" 
+			    file line (oref this data)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Clear Breakpoint Command Class                                             ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-clear-breakpoint (jde-dbs-cmd) 
+  ((breakpoint    :initarg :breakpoint
+	          ;; :type jde-bug-breakpoint
+	          :documentation
+	          "Breakpoint specification."))
+  "Set breakpoint command.")
+
+(defmethod initialize-instance ((this jde-dbs-clear-breakpoint) &rest fields)
+  "Constructor for clear breakpoint command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+  (assert (oref this breakpoint))
+
+  ;; Set command name.
+  (oset this name "clear"))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-clear-breakpoint))
+  "Creates the command line for the clear breakpoint command."
+  (let* ((process (oref this process))
+	 (breakpoint (oref this breakpoint))
+	 (bpspec (jde-dbs-proc-get-bpspec process breakpoint))
+	 (bp-procid (oref bpspec id)))
+    (format "%s %s"              ;; PID CID clear BPID
+	    (call-next-method)
+	    bp-procid)))         ;; Id assigned by debugger to this breakpoint
+ 
+
+(defmethod jde-dbs-cmd-exec ((this jde-dbs-clear-breakpoint))
+  "Execute clear breakpoint command."
+  (let* ((process (oref this process))
+	 (breakpoint (oref this breakpoint))	
+	 (file (oref breakpoint file))
+	 (line (oref breakpoint line))
+	 (proc-id (oref process id))
+	 (bpspec (jde-dbs-proc-get-bpspec process breakpoint))
+	 (bp-procid (oref bpspec id))
+	 (result (call-next-method)))
+    (if (jde-dbo-command-succeeded-p result)
+	(let ((bpspecs (oref process bpspecs)))
+	  (oset process bpspecs 
+		(jde-dbs-proc-bpspecs-remove bpspecs bpspec))
+	  (jde-dbs-proc-display-debug-message  
+	   process
+	   (format "Cleared breakpoint at line %s in file %s" line file)))
+      (jde-dbs-proc-display-debug-message 
+       process
+       (format "Error: cannot clear breakpoint at line %s in file %s.\n Reason: %s." 
+	       line file (car (jde-dbo-command-result-data result))))
+      nil)))
+
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Step Over/Into/Out Command Class                                           ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defclass jde-dbs-step (jde-dbs-cmd)
+  ((step-type :initarg :step-type
+	      :type string
+	      :initform "over"
+	      :documentation
+	      "Type of step operation: over, into, out"))
+  "Step command.")
+
+(defmethod initialize-instance ((this jde-dbs-step) &rest fields)
+  "Constructor for step command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+
+
+  ;; Set command name.
+  (oset this name (concat "step " (oref this step-type))))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-step))
+  "Creates the command line for the step command."
+  (format "%s %d" (call-next-method) 
+	  (oref (oref (oref this process) state-info) thread-id)))  
+
+
+(defmethod jde-dbs-cmd-failure-action ((this jde-dbs-step))
+  (oset this msg
+	(format "Error: unable to step %s.\n Reason: %s"
+		(oref this step-type) (oref this data))))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Step Into Command Class                                                    ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defmethod jde-dbs-proc-step-into ((this jde-dbs-proc))
+  (let* ((proc-id (oref this id))
+	 (thread-id 
+	  (oref (oref this state-info) thread-id))	
+	 (result (jde-dbs-do-command proc-id  (format "step into %s" thread-id))))
+    (when (not (jde-dbo-command-succeeded-p result))
+      (jde-dbs-proc-display-debug-message this
+       (format "Error: unable to step into... .\n  Reason: %s"
+	       (car (jde-dbo-command-result-data result))))
+      nil)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Step Out Command Class                                                     ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defmethod jde-dbs-proc-step-out ((this jde-dbs-proc))
+  (let* ((proc-id (oref this id))
+	 (thread-id 
+	  (oref (oref this state-info) thread-id))	
+	 (result (jde-dbs-do-command proc-id  (format "step out %s" thread-id))))
+    (when (not (jde-dbo-command-succeeded-p result))
+      (jde-dbs-proc-display-debug-message this
+       (format "Error: unable to step into... .\n  Reason: %s"
+	       (car (jde-dbo-command-result-data result))))
+      nil)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;; Evaluate Command Class                                                     ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defclass jde-dbs-evaluate (jde-dbs-cmd) 
+  ((expression    :initarg :expression
+	          ;; :type string
+	          :documentation
+	          "Expression to be evaluate. Required.")
+   (thread-id     :initarg :thread-id
+		  ;; :type integer
+		  :documentation
+		  "Id of thread that scopes this expression. Required."))
+  "Evaluate expression command.")
+
+(defmethod initialize-instance ((this jde-dbs-evaluate) &rest fields)
+  "Constructor for evaluate command."
+
+  ;; Call parent initializer.
+  (call-next-method)
+
+  (assert (oref this process))
+  (assert (oref this expression))
+  (assert (oref this thread-id))
+ 
+  ;; Set command name.
+  (oset this name "evaluate"))
+
+(defmethod jde-dbs-cmd-make-command-line ((this jde-dbs-evaluate))
+  "Creates the command line for the clear breakpoint command."
+    (format "%s %s 0 \"%s\""         ;; PID CID evaluate THREAD-ID 0 "EXPRESSION"
+	    (call-next-method)       ;; PID CID evaluate
+	    (oref this thread-id)    ;; thread id
+	    (oref this expression))) ;; expression to be evaluated.
+ 
+
+(defmethod jde-dbs-cmd-exec ((this jde-dbs-evaluate))
+  "Execute evaluate expression command. Returns