emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/realgud-jdb 8b0f1e0 1/3: First cut at separate/external


From: Rocky Bernstein
Subject: [elpa] externals/realgud-jdb 8b0f1e0 1/3: First cut at separate/external realgud package
Date: Thu, 23 May 2019 02:56:20 -0400 (EDT)

branch: externals/realgud-jdb
commit 8b0f1e01b8744b8a461fd12b0a228c382265b506
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    First cut at separate/external realgud package
---
 Makefile.am                                   |   2 +-
 common.mk                                     |   2 +-
 compute-lispdir.sh                            |   4 +-
 configure.ac                                  |   4 +-
 realgud-node-debug.el => realgud-jdb.el       |  25 ++-
 {realgud-node-debug => realgud-jdb}/.nosearch |   0
 realgud-jdb/Makefile.am                       |   8 +
 realgud-jdb/backtrack-mode.el                 |  71 ++++++++
 realgud-jdb/core.el                           | 187 ++++++++++++++++++++
 realgud-jdb/file.el                           | 246 ++++++++++++++++++++++++++
 realgud-jdb/init.el                           | 231 ++++++++++++++++++++++++
 realgud-jdb/jdb.el                            | 113 ++++++++++++
 realgud-jdb/track-mode.el                     |  87 +++++++++
 realgud-node-debug/Makefile.am                |   5 -
 realgud-node-debug/core.el                    | 170 ------------------
 realgud-node-debug/init.el                    | 188 --------------------
 realgud-node-debug/main.el                    |  85 ---------
 realgud-node-debug/track-mode.el              |  84 ---------
 test/gcd.js                                   |  45 -----
 test/test-jdb.el                              |  18 ++
 test/test-loc-regexp-node-debug.el            | 118 ------------
 test/test-node-debug.el                       |  37 ----
 test/test-regexp-jdb.el                       |  78 ++++++++
 23 files changed, 1057 insertions(+), 751 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c1e36b4..9bc79d5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@
 # These comments before the targets start with #:
 # remake --tasks to shows the targets and the comments
 
-SUBDIRS = realgud-node-debug test
+SUBDIRS = realgud-jdb test
 
 GIT2CL ?= git2cl
 RUBY   ?= ruby
diff --git a/common.mk b/common.mk
index fc865e4..36fbedc 100644
--- a/common.mk
+++ b/common.mk
@@ -1,5 +1,5 @@
 MOSTLYCLEANFILES = *.elc
-EMACSLOADPATH=
+EMACSLOADPATH=:/home/rocky/.emacs.d/elpa/test-simple-20170527.1532/:/home/rocky/.emacs.d/elpa/realgud-20190504.1238/:/home/rocky/.emacs.d/elpa/load-relative-20170526.1010/:/home/rocky/.emacs.d/elpa/loc-changes-20160801.1708/
 
 short:
        $(MAKE) 2>&1 >/dev/null | ruby $(top_srcdir)/make-check-filter.rb
diff --git a/compute-lispdir.sh b/compute-lispdir.sh
index c46a66a..72e8c13 100755
--- a/compute-lispdir.sh
+++ b/compute-lispdir.sh
@@ -24,7 +24,7 @@ done
 for dir in $list ; do
     if [[ -d $dir ]] ; then
        case $dir in
-           */emacs/2[3-6]\.[0-9]/site-lisp)
+           */emacs/2[4-7]\.[0-9]/site-lisp)
                ((DEBUG)) && echo "versioned site lisp: $dir"
                echo "$dir"
                exit 0
@@ -35,7 +35,7 @@ done
 for dir in $list ; do
     if [[ -d $dir ]] ; then
        case $dir in
-           */emacs/2[3-6]\.[0-9]/site-lisp)
+           */emacs/2[4-7]\.[0-9]/site-lisp)
                ((DEBUG)) && echo "versioned site lisp: $dir"
                echo "$dir"
                exit 0
diff --git a/configure.ac b/configure.ac
index 457fce0..b107d1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 dnl FIXME: pick up from realgud.el
 AC_INIT(realgud-node-debug, 1.0.0,)
-AC_CONFIG_SRCDIR(realgud-node-debug/main.el)
+AC_CONFIG_SRCDIR(realgud-jdb/jdb.el)
 AM_INIT_AUTOMAKE([foreign])
 AM_MAINTAINER_MODE
 
@@ -49,7 +49,7 @@ AM_CONDITIONAL(INSTALL_EMACS_LISP, test "x$lispdir_realgud" 
!= "x")
 
 AC_CONFIG_FILES([Makefile \
                 common.mk \
-                realgud-node-debug/Makefile \
+                realgud-jdb/Makefile \
                 test/Makefile \
                 ])
 AC_OUTPUT
diff --git a/realgud-node-debug.el b/realgud-jdb.el
similarity index 67%
rename from realgud-node-debug.el
rename to realgud-jdb.el
index 748c35b..331f478 100644
--- a/realgud-node-debug.el
+++ b/realgud-jdb.el
@@ -1,11 +1,11 @@
-;;; realgud-node-debug.el --- Realgud front-end to older nodejs "node debug" 
-*- lexical-binding: t -*-
+;;; realgud-jdb.el --- Realgud front-end to older nodejs "node debug" -*- 
lexical-binding: t -*-
 
 ;; Author: Rocky Bernstein <address@hidden>
 ;; Version: 1.0.0
 ;; Package-Type: multi
-;; Package-Requires: ((realgud "1.4.5") (load-relative "1.2") (cl-lib "0.5") 
(emacs "24"))
-;; URL: http://github.com/realgud/realgud-node-debug
-;; Compatibility: GNU Emacs 24.x
+;; Package-Requires: ((realgud "1.4.5") (load-relative "1.2") (cl-lib "0.5") 
(emacs "25"))
+;; URL: http://github.com/realgud/realgud-jdb
+;; Compatibility: GNU Emacs 25.x
 
 ;; Copyright (C) 2019 Free Software Foundation, Inc
 
@@ -24,9 +24,8 @@
 
 ;;; Commentary:
 
-;; Provides realgud support for the older "node debug" used up into node
-;; version 6 and deprecated starting with node version 8.
-;; https://nodejs.org/dist/latest-v6.x/docs/api/
+;; Provides realgud support for the Java's jdb debugger.
+;; See https://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html
 ;;
 
 ;;; Code:
@@ -37,14 +36,14 @@
 
 (require 'load-relative)
 
-(defgroup realgud-node-debug  nil
-  "Realgud interface to the older 'node debug' debugger"
+(defgroup realgud-jdb  nil
+  "Realgud interface the Java JDB debugger"
   :group 'realgud
-  :version "24.3")
+  :version "25.1")
 
-(require-relative-list '( "./realgud-node-debug/main" ) "realgud-")
-(load-relative "./realgud-node-debug/main.el")
+(require-relative-list '( "./realgud-jdb/jdb" ) "realgud-")
+(load-relative "./realgud-jdb/jdb.el")
 
 (provide-me)
 
-;;; realgud-node-debug.el ends here
+;;; realgud-jdb.el ends here
diff --git a/realgud-node-debug/.nosearch b/realgud-jdb/.nosearch
similarity index 100%
rename from realgud-node-debug/.nosearch
rename to realgud-jdb/.nosearch
diff --git a/realgud-jdb/Makefile.am b/realgud-jdb/Makefile.am
new file mode 100644
index 0000000..9f0b69e
--- /dev/null
+++ b/realgud-jdb/Makefile.am
@@ -0,0 +1,8 @@
+include $(srcdir)/../common.mk
+
+lisp_files = $(wildcard *.el)
+lisp_LISP = $(lisp_files)
+EXTRA_DIST = $(lisp_files)
+
+jdb.elc: core.elc track-mode.elc
+track-mode.elc: core.elc init.elc
diff --git a/realgud-jdb/backtrack-mode.el b/realgud-jdb/backtrack-mode.el
new file mode 100644
index 0000000..5879070
--- /dev/null
+++ b/realgud-jdb/backtrack-mode.el
@@ -0,0 +1,71 @@
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program 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 3 of the License, or
+;; (at your option) any later version.
+
+;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+;; Mode for parsing various kinds of backtraces found in Java
+
+(require 'load-relative)
+(require 'realgud)
+(require-relative-list '("core" "init") "realgud-jdb-")
+
+(realgud-backtrack-mode-vars "jdb")
+(set-keymap-parent jdb-backtrack-mode-map realgud-backtrack-mode-map)
+
+(declare-function realgud-backtrack-mode         
'realgud-common-backtrack-mode)
+(declare-function realgud-backtrack-set-debugger 
'realgud-common-backtrack-mode)
+(declare-function realgud-goto-line-for-pt       
'realgud-common-backtrack-mode)
+(declare-function realgud--ruby-populate-command-keys 'realgud-lang-ruby)
+
+(defun realgud--jdb-goto-control-frame-line (pt)
+  "Display the location mentioned by a control-frame line
+described by PT."
+  (interactive "d")
+  (realgud-goto-line-for-pt pt "control-frame"))
+
+(realgud--ruby-populate-command-keys jdb-backtrack-mode-map)
+(define-key jdb-backtrack-mode-map
+  (kbd "C-c !c") 'realgud--jdb-goto-control-frame-line)
+
+(define-minor-mode realgud--jdb-backtrack-mode
+  "Minor mode for tracking ruby debugging inside a file which may not have 
process shell.
+
+\\{jdb-backtrack-mode-map}"
+  :init-value nil
+  ;; :lighter " jdb"   ;; mode-line indicator from realgud-track is sufficient.
+  ;; The minor mode bindings.
+  :global nil
+  :group 'realgud--jdb
+  :keymap jdb-backtrack-mode-map
+
+  (realgud-backtrack-set-debugger "jdb")
+  (if jdb-backtrack-mode
+      (progn
+       (realgud-backtrack-mode 't)
+       (run-mode-hooks (intern (jdb-backtrack-mode-hook))))
+    (progn
+      (realgud-backtrack-mode nil)
+      ))
+)
+
+(defun realgud--jdb-backtrack-mode-hook()
+  (if jdb-backtrack-mode
+      (progn
+       (use-local-map jdb-backtrack-mode-map)
+       (message "using jdb mode map")
+       )
+    (message "jdb backtrack-mode-hook disable called"))
+)
+
+(provide-me "realgud-jdb-")
diff --git a/realgud-jdb/core.el b/realgud-jdb/core.el
new file mode 100644
index 0000000..9433d42
--- /dev/null
+++ b/realgud-jdb/core.el
@@ -0,0 +1,187 @@
+;; Copyright (C) 2014, 2016, 2018-2019 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program 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 3 of the License, or
+;; (at your option) any later version.
+
+;; We use gud to handle the classpath-to-filename mapping
+(require 'gud)
+
+(require 'load-relative)
+(require 'realgud)
+(require-relative-list '("init") "realgud-jdb-")
+
+(declare-function realgud--strip              'realgud-utils)
+(declare-function realgud--expand-file-name-if-exists 'realgud-core)
+(declare-function realgud-parse-command-arg  'realgud-core)
+(declare-function realgud-query-cmdline      'realgud-core)
+(declare-function realgud-suggest-invocation 'realgud-core)
+(declare-function realgud--file-loc-from-line 'realgud-file)
+(declare-function realgud--find-file          'realgud-file)
+
+;; FIXME: I think the following could be generalized and moved to
+;; realgud-... probably via a macro.
+(defvar realgud--jdb-minibuffer-history nil
+  "minibuffer history list for the command `realgud--jdb'.")
+
+(easy-mmode-defmap jdb-minibuffer-local-map
+  '(("\C-i" . comint-dynamic-complete-filename))
+  "Keymap for minibuffer prompting of gud startup command."
+  :inherit minibuffer-local-map)
+
+;; FIXME: I think this code and the keymaps and history
+;; variable chould be generalized, perhaps via a macro.
+(defun realgud--jdb-query-cmdline (&optional opt-debugger)
+  (realgud-query-cmdline
+   'jdb-suggest-invocation
+   jdb-minibuffer-local-map
+   'realgud--jdb-minibuffer-history
+   opt-debugger))
+
+(defun realgud--jdb-dot-to-slash (str)
+  "Change '.' to '/' in STR but chop off from the last . to the end. For 
example
+ca.mgcill.rocky.snpEff.main => ca/mcgill/rocky/snpEff"
+      ;;(setq str (replace-regexp-in-string "\\([^\\.]+\\.\\)[^\\.]+$" "\\1" 
str))
+      ;;(setq str (replace-regexp-in-string "\\.$" "" str))
+      (setq str (replace-regexp-in-string "\\." "/" str))
+      str)
+
+(defun realgud--jdb-find-file(marker filename directory)
+  "A find-file specific for java/jdb. We use `gdb-jdb-find-source' to map a
+name to a filename. Failing that we can add on .java to the name. Failing that
+we will prompt for a mapping and save that the remap."
+  (let* ((transformed-file)
+        (cmdbuf (realgud-get-cmdbuf))
+        (ignore-re-file-list (realgud-cmdbuf-ignore-re-file-list cmdbuf))
+        (filename-remap-alist (realgud-cmdbuf-filename-remap-alist))
+        (stripped-filename (realgud--strip filename))
+        (gud-jdb-filename (gud-jdb-find-source stripped-filename))
+        (remapped-filename
+         (assoc filename filename-remap-alist))
+       )
+    (cond
+     ((and gud-jdb-filename (file-exists-p gud-jdb-filename))
+      gud-jdb-filename)
+     ((file-exists-p (setq transformed-file (concat stripped-filename 
".java")))
+      transformed-file)
+     ((realgud--file-ignore filename ignore-re-file-list)
+      (message "tracking ignored for %s" filename) nil)
+     (t
+      (if remapped-filename
+         (if (file-exists-p (cdr remapped-filename))
+             (cdr remapped-filename)
+           ;; else remove from map since no find
+           (and (realgud-cmdbuf-filename-remap-alist=
+                 (delq (assoc remapped-filename filename-remap-alist)
+                       filename-remap-alist))
+                 nil))
+       ;; else
+       (let ((remapped-filename)
+             (guess-filename (realgud--jdb-dot-to-slash filename)))
+         (setq remapped-filename
+               (buffer-file-name
+                (realgud--find-file marker guess-filename
+                                   directory "%s.java")))
+         (when (and remapped-filename (file-exists-p remapped-filename))
+           (realgud-cmdbuf-filename-remap-alist=
+            (cons
+             (cons filename remapped-filename)
+             filename-remap-alist))
+           ))
+       ))
+     )))
+
+(defun realgud--jdb-loc-fn-callback(text filename lineno source-str
+                                       cmd-mark directory)
+  (realgud--file-loc-from-line filename lineno
+                             cmd-mark source-str nil
+                             'realgud--jdb-find-file directory))
+
+(defun realgud--jdb-parse-cmd-args (orig-args)
+  "Parse command line ARGS for the annotate level and name of script to debug.
+
+ORIG-ARGS should contain a tokenized list of the command line to run.
+
+We return the a list containing
+
+* the command debugger (e.g. jdb)
+
+* debugger command arguments if any - a list of strings
+
+* the script name and its arguments - list of strings
+
+For example for the following input
+   '(\"jdb\" \"-classpath . ./TestMe.java a b\"))
+
+we might return:
+   (\"jdb\" nil \"TestMe\"))
+
+Note that the script name path has been expanded via `expand-file-name'.
+"
+
+  ;; Parse the following kind of pattern:
+  ;;  [ruby ruby-options] jdb jdb-options script-name script-options
+  (let (
+        (args orig-args)
+       (interp-regexp
+        (if (member system-type (list 'windows-nt 'cygwin 'msdos))
+            "^jdb*\\(.exe\\)?$"
+          "^jdb*$"))
+       (jdb-name)
+        ;;
+        ;; One dash is added automatically to the below, so
+        ;; attach is really -attach
+       (jdb-two-args '("attach" "sourcepath" "classpath" "dbgtrace"))
+
+        ;; Things returned
+        (debugger-args '())
+        (program-args '()))
+
+    (if (not (and args))
+        ;; Got nothing: return '(nil nil nil)
+        (list jdb-name nil debugger-args program-args)
+      ;; else
+      ;; Strip off optional "jdb" or "jdb.exe" etc.
+      (when (string-match interp-regexp (car args))
+       (setq jdb-name (car args))
+        (setq program-args (nconc program-args (cdr args))))
+
+      (list jdb-name debugger-args program-args))))
+
+;; To silence Warning: reference to free variable
+(defvar realgud--jdb-command-name)
+
+(defun jdb-suggest-invocation (debugger-name)
+  "Suggest a jdb command invocation via `realgud-suggest-invocaton'"
+  (realgud-suggest-invocation (or debugger-name realgud--jdb-command-name)
+                             realgud--jdb-minibuffer-history
+                             "java" "\\.java$" "jdb"))
+
+(defun jdb-reset ()
+  "Jdb cleanup - remove debugger's internal buffers (frame,
+breakpoints, etc.)."
+  (interactive)
+  ;; (jdb-breakpoint-remove-all-icons)
+  (dolist (buffer (buffer-list))
+    (when (string-match "\\*jdb-[a-z]+\\*" (buffer-name buffer))
+      (let ((w (get-buffer-window buffer)))
+        (when w
+          (delete-window w)))
+      (kill-buffer buffer))))
+
+;; (defun jdb-reset-keymaps()
+;;   "This unbinds the special debugger keys of the source buffers."
+;;   (interactive)
+;;   (setcdr (assq 'jdb-debugger-support-minor-mode minor-mode-map-alist)
+;;        jdb-debugger-support-minor-mode-map-when-deactive))
+
+
+(defun realgud--jdb-customize ()
+  "Use `customize' to edit the settings of the `jdb' debugger."
+  (interactive)
+  (customize-group 'realgud--jdb))
+
+(provide-me "realgud-jdb-")
diff --git a/realgud-jdb/file.el b/realgud-jdb/file.el
new file mode 100644
index 0000000..c4d49d1
--- /dev/null
+++ b/realgud-jdb/file.el
@@ -0,0 +1,246 @@
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program 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 3 of the License, or
+;; (at your option) any later version.
+
+;; This program 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.
+;; Association list of fully qualified class names (package + class name)
+;; and their source files.
+
+(require 'load-relative)
+
+(defvar realgud-jdb-class-source-alist nil
+  "Association list of fully qualified class names and source files.")
+
+;; This is used to hold a source file during analysis.
+(defvar realgud-jdb-analysis-buffer nil)
+
+(defvar realgud-jdb-classpath-string nil
+  "Holds temporary classpath values.")
+
+(defun realgud-jdb-build-source-files-list (path extn)
+  "Return a list of java source files (absolute paths).
+PATH gives the directories in which to search for files with
+extension EXTN.  Normally EXTN is given as the regular expression
+ \"\\.java$\" ."
+  (apply 'nconc (mapcar (lambda (d)
+                         (when (file-directory-p d)
+                           (directory-files d t extn nil)))
+                       path)))
+
+;; Move point past whitespace.
+(defun realgud-jdb-skip-whitespace ()
+  (skip-chars-forward " \n\r\t\014"))
+
+;; Move point past a "// <eol>" type of comment.
+(defun realgud-jdb-skip-single-line-comment ()
+  (end-of-line))
+
+;; Move point past a "/* */" or "/** */" type of comment.
+(defun realgud-jdb-skip-traditional-or-documentation-comment ()
+  (forward-char 2)
+  (catch 'break
+    (while (not (eobp))
+      (if (eq (following-char) ?*)
+         (progn
+           (forward-char)
+           (if (not (eobp))
+               (if (eq (following-char) ?/)
+                   (progn
+                     (forward-char)
+                     (throw 'break nil)))))
+       (forward-char)))))
+
+;; Move point past any number of consecutive whitespace chars and/or comments.
+(defun realgud-jdb-skip-whitespace-and-comments ()
+  (realgud-jdb-skip-whitespace)
+  (catch 'done
+    (while t
+      (cond
+       ((looking-at "//")
+       (realgud-jdb-skip-single-line-comment)
+       (realgud-jdb-skip-whitespace))
+       ((looking-at "/\\*")
+       (realgud-jdb-skip-traditional-or-documentation-comment)
+       (realgud-jdb-skip-whitespace))
+       (t (throw 'done nil))))))
+
+;; Move point past things that are id-like.  The intent is to skip regular
+;; id's, such as class or interface names as well as package and interface
+;; names.
+(defun realgud-jdb-skip-id-ish-thing ()
+  (skip-chars-forward "^ /\n\r\t\014,;{"))
+
+;; Move point past a string literal.
+(defun realgud-jdb-skip-string-literal ()
+  (forward-char)
+  (while (not (cond
+              ((eq (following-char) ?\\)
+               (forward-char))
+              ((eq (following-char) ?\042))))
+    (forward-char))
+  (forward-char))
+
+;; Move point past a character literal.
+(defun realgud-jdb-skip-character-literal ()
+  (forward-char)
+  (while
+      (progn
+       (if (eq (following-char) ?\\)
+           (forward-char 2))
+       (not (eq (following-char) ?\')))
+    (forward-char))
+  (forward-char))
+
+;; Move point past the following block.  There may be (legal) cruft before
+;; the block's opening brace.  There must be a block or it's the end of life
+;; in petticoat junction.
+(defun realgud-jdb-skip-block ()
+
+  ;; Find the beginning of the block.
+  (while
+      (not (eq (following-char) ?{))
+
+    ;; Skip any constructs that can harbor literal block delimiter
+    ;; characters and/or the delimiters for the constructs themselves.
+    (cond
+     ((looking-at "//")
+      (realgud-jdb-skip-single-line-comment))
+     ((looking-at "/\\*")
+      (realgud-jdb-skip-traditional-or-documentation-comment))
+     ((eq (following-char) ?\042)
+      (realgud-jdb-skip-string-literal))
+     ((eq (following-char) ?\')
+      (realgud-jdb-skip-character-literal))
+     (t (forward-char))))
+
+  ;; Now at the beginning of the block.
+  (forward-char)
+
+  ;; Skip over the body of the block as well as the final brace.
+  (let ((open-level 1))
+    (while (not (eq open-level 0))
+      (cond
+       ((looking-at "//")
+       (realgud-jdb-skip-single-line-comment))
+       ((looking-at "/\\*")
+       (realgud-jdb-skip-traditional-or-documentation-comment))
+       ((eq (following-char) ?\042)
+       (realgud-jdb-skip-string-literal))
+       ((eq (following-char) ?\')
+       (realgud-jdb-skip-character-literal))
+       ((eq (following-char) ?{)
+       (setq open-level (+ open-level 1))
+       (forward-char))
+       ((eq (following-char) ?})
+       (setq open-level (- open-level 1))
+       (forward-char))
+       (t (forward-char))))))
+
+;; Find the package and class definitions in Java source file FILE.  Assumes
+;; that FILE contains a legal Java program.  BUF is a scratch buffer used
+;; to hold the source during analysis.
+(defun realgud-jdb-analyze-source (buf file)
+  (let ((l nil))
+    (set-buffer buf)
+    (insert-file-contents file nil nil nil t)
+    (goto-char 0)
+    (catch 'abort
+      (let ((p ""))
+       (while (progn
+                (realgud-jdb-skip-whitespace)
+                (not (eobp)))
+         (cond
+
+          ;; Any number of semi's following a block is legal.  Move point
+          ;; past them.  Note that comments and whitespace may be
+          ;; interspersed as well.
+          ((eq (following-char) ?\073)
+           (forward-char))
+
+          ;; Move point past a single line comment.
+          ((looking-at "//")
+           (realgud-jdb-skip-single-line-comment))
+
+          ;; Move point past a traditional or documentation comment.
+          ((looking-at "/\\*")
+           (realgud-jdb-skip-traditional-or-documentation-comment))
+
+          ;; Move point past a package statement, but save the PackageName.
+          ((looking-at "package")
+           (forward-char 7)
+           (realgud-jdb-skip-whitespace-and-comments)
+           (let ((s (point)))
+             (realgud-jdb-skip-id-ish-thing)
+             (setq p (concat (buffer-substring s (point)) "."))
+             (realgud-jdb-skip-whitespace-and-comments)
+             (if (eq (following-char) ?\073)
+                 (forward-char))))
+
+          ;; Move point past an import statement.
+          ((looking-at "import")
+           (forward-char 6)
+           (realgud-jdb-skip-whitespace-and-comments)
+           (realgud-jdb-skip-id-ish-thing)
+           (realgud-jdb-skip-whitespace-and-comments)
+           (if (eq (following-char) ?\073)
+               (forward-char)))
+
+          ;; Move point past the various kinds of ClassModifiers.
+          ((looking-at "public")
+           (forward-char 6))
+          ((looking-at "abstract")
+           (forward-char 8))
+          ((looking-at "final")
+           (forward-char 5))
+
+          ;; Move point past a ClassDeclaration, but save the class
+          ;; Identifier.
+          ((looking-at "class")
+           (forward-char 5)
+           (realgud-jdb-skip-whitespace-and-comments)
+           (let ((s (point)))
+             (realgud-jdb-skip-id-ish-thing)
+             (setq
+              l (nconc l (list (concat p (buffer-substring s (point)))))))
+           (realgud-jdb-skip-block))
+
+          ;; Move point past an interface statement.
+          ((looking-at "interface")
+           (forward-char 9)
+           (realgud-jdb-skip-block))
+
+          ;; Anything else means the input is invalid.
+          (t
+           (message "Error parsing file %s." file)
+           (throw 'abort nil))))))
+    l))
+
+(defun realgud-jdb-build-class-source-alist-for-file (file)
+  (mapcar
+   (lambda (c)
+     (cons c file))
+   (realgud-jdb-analyze-source realgud-jdb-analysis-buffer file)))
+
+;; Return an alist of fully qualified classes and the source files
+;; holding their definitions.  SOURCES holds a list of all the source
+;; files to examine.
+(defun realgud-jdb-build-class-source-alist (sources)
+  (setq realgud-jdb-analysis-buffer (get-buffer-create " 
*realgud-jdb-scratch*"))
+  (prog1
+      (apply
+       'nconc
+       (mapcar
+       'realgud-jdb-build-class-source-alist-for-file
+       sources))
+    (kill-buffer realgud-jdb-analysis-buffer)
+    (setq realgud-jdb-analysis-buffer nil)))
+
+(provide-me "realgud-jdb-")
diff --git a/realgud-jdb/init.el b/realgud-jdb/init.el
new file mode 100644
index 0000000..a7343b5
--- /dev/null
+++ b/realgud-jdb/init.el
@@ -0,0 +1,231 @@
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program 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 3 of the License, or
+;; (at your option) any later version.
+
+(eval-when-compile (require 'cl-lib))   ;For setf.
+(require 'load-relative)
+(require 'realgud)
+(require 'realgud-lang-java)
+
+(defvar realgud-pat-hash)
+(declare-function make-realgud-loc-pat (realgud-loc))
+
+(defconst realgud--jdb-identifier "[A-Za-z_][A-Za-z0-9_.]+"
+"Regexp string that matches a Java identifier possily with class
+name. For example java.lang.Class.getDeclaredMethods")
+
+(defvar realgud--jdb-pat-hash (make-hash-table :test 'equal)
+  "Hash key is the what kind of pattern we want to match:
+backtrace, prompt, etc.  The values of a hash entry is a
+realgud-loc-pat struct")
+
+(setf (gethash "loc-callback-fn" realgud--jdb-pat-hash)
+      'realgud--jdb-loc-fn-callback)
+
+;; realgud-loc-pat that describes a jdb location generally shown
+;; before a command prompt. For example:
+;;   Breakpoint hit: "thread=main", TestMe.main(), line=7 bci=0
+;;   Step completed: "thread=main", TestMe.<init>(), line=15 bci=0
+
+(setf (gethash "loc" realgud--jdb-pat-hash)
+      (make-realgud-loc-pat
+       :regexp "\\(?:Breakpoint hit\\|Step completed\\): \"thread=.+\", 
\\(.+\\)?[.]\\(.+\\)(), line=\\([0-9]+\\) 
bci=\\([0-9]+\\)\\(?:\n\\([0-9]+\\)\\(.*\\)\\)?"
+       :file-group 1
+       :line-group 3
+       :text-group 6))
+
+;; realgud-loc-pat that describes a jdb command prompt
+;; For example:
+;;   main[1]
+;;   main[2]
+;;   >
+;; FIXME: I think the pattern is thread-name[stack-level]
+;; Here, we only deal with main.
+(setf (gethash "prompt" realgud--jdb-pat-hash)
+      (make-realgud-loc-pat
+       :regexp "^\\(?:main\\[\\([0-9]+\\)\\]\\|>\\) "
+       :num 1
+       ))
+
+;; realgud-loc-pat that describes a Java syntax error line.
+;; (setf (gethash "syntax-error" realgud--jdb-pat-hash)
+;;       realgud-java-syntax-error-pat)
+
+;; realgud-loc-pat that describes a Java backtrace line.
+;; For example:
+;;  [1] ca.snpEffect.commandLine.SnpEff.run (SnpEff.java:7)
+(setf (gethash "lang-backtrace" realgud--jdb-pat-hash)
+  (make-realgud-loc-pat
+   ;; FIXME: use realgud--jdb-identifier
+   :regexp "^\\(?:[     ]*[\\[0-9\\]+]\\) \\([A-Za-z_.][A-Za-z0-9.]+\\) 
(\\([A-Za-z_.][A-Za-z0-9.]+\\):\\([0-9]+\\))"
+   :file-group 1
+   :line-group 2))
+
+;; realgud-loc-pat that describes a "breakpoint set" line.
+;; For example:
+;;   Set breakpoint TestMe:7
+(setf (gethash "brkpt-set" realgud--jdb-pat-hash)
+      (make-realgud-loc-pat
+       :regexp "^Set breakpoint \\(.+\\):\\([0-9]+\\)"
+       :num 1
+       :line-group 2))
+
+;; realgud-loc-pat that describes a debugger "delete" (breakpoint) response.
+;; For example:
+;;   Removed: breakpoint TestMe:7
+(setf (gethash "brkpt-del" realgud--jdb-pat-hash)
+      (make-realgud-loc-pat
+       :regexp "^Removed breakpoint \\(.+\\):\\([0-9]+\\)\n"
+       :line-group 1))
+
+(defconst realgud--jdb-selected-frame-indicator "-->"
+"String that describes which frame is selected in a debugger
+backtrace listing.")
+
+(defconst realgud--jdb-frame-file-regexp
+  "[ \t\n]+in file \\([^ \n]+\\)")
+
+(defconst realgud--jdb-debugger-name "jdb" "Name of debugger")
+
+;; Top frame number
+(setf (gethash "top-frame-num" realgud--jdb-pat-hash) 0)
+
+;; realgud-loc-pat that describes a debugger "selected" frame in
+;; a frame-motion command.
+;; For example:
+;; --> #1 [1] TestMe.main (TestMe.java:7)
+;; Rocky: sometimes I am not getting the frame indicator.
+(setf (gethash "selected-frame" realgud--jdb-pat-hash)
+      (make-realgud-loc-pat
+       :regexp
+       (format "^%s #\\([0-9]+\\) .*%s"
+              realgud--jdb-selected-frame-indicator
+              realgud--jdb-frame-file-regexp)
+       :num 1))
+
+;; realgud-loc-pat that describes a jdb backtrace line.
+;; For example:
+;;  [1] TestMe.main (TestMe.java:7)
+;;  [2] java.lang.Class.privateGetDeclaredMethods (Class.java:2,570)
+;;  [3] java.lang.Class.getMethod0 (Class.java:2,813)
+;;  [4] java.lang.Class.getMethod (Class.java:1,663)
+;;  [5] sun.launcher.LauncherHelper.getMainMethod (LauncherHelper.java:494)
+;;  [6] sun.launcher.LauncherHelper.checkAndLoadMain (LauncherHelper.java:486)
+(setf (gethash "debugger-backtrace" realgud--jdb-pat-hash)
+  (make-realgud-loc-pat
+   :regexp "^\\(?:[\t ]*[\\[[0-9]+\\] 
\\)\\([A-Za-z_.][A-Za-z0-9.]+\\):\\([0-9]+\\)"
+   :file-group 1
+   :line-group 2))
+
+;;  Regular expression that describes location in a maven error
+(setf (gethash "maven-error" realgud--jdb-pat-hash)
+      realgud-maven-error-loc-pat)
+
+(setf (gethash "font-lock-keywords" realgud--jdb-pat-hash)
+      '(
+       ;; The frame number and first type name, if present.
+       ;; FIXME: use realgud--jdb-identifier
+       ("^\\(-->\\|   \\)? #\\([0-9]+\\) \\([A-Z]+\\) 
*\\([A-Z_][a-zA-Z0-9_]*\\)[#]\\([a-zA-Z_][a-zA-Z_[0-9]]*\\)?"
+        (2 realgud-backtrace-number-face)
+        (3 font-lock-keyword-face)         ; e.g. METHOD, TOP
+        (4 font-lock-constant-face)        ; e.g. Object
+        (5 font-lock-function-name-face nil t))   ; t means optional
+       ;; Instruction sequence
+       ("<\\(.+\\)>"
+        (1 font-lock-variable-name-face))
+       ;; "::Type", which occurs in class name of function and in parameter 
list.
+       ;; Parameter sequence
+       ("(\\(.+\\))"
+        (1 font-lock-variable-name-face))
+       ;; "::Type", which occurs in class name of function and in parameter 
list.
+       ("::\\([a-zA-Z_][a-zA-Z0-9_]*\\)"
+        (1 font-lock-type-face))
+       ;; File name.
+       ("[ \t]+in file \\([^ ]+*\\)"
+        (1 realgud-file-name-face))
+       ;; Line number.
+       ("[ \t]+at line \\([0-9]+\\)$"
+        (1 realgud-line-number-face))
+       ;; Function name.
+       ("\\<\\([a-zA-Z_][a-zA-Z0-9_]*\\)\\.\\([a-zA-Z_][a-zA-Z0-9_]*\\)"
+        (1 font-lock-type-face)
+        (2 font-lock-function-name-face))
+       ;; (jdb-frames-match-current-line
+       ;;  (0 jdb-frames-current-frame-face append))
+       ))
+
+;; (setf (gethash "font-lock-keywords" realgud--jdb-pat-hash)
+;;       '(
+;;     ;; The frame number and first type name, if present.
+;;     ((concat realgud--jdb-frame-start-regexp " "
+;;                     realgud--jdb-frame-num-regexp " "
+;;                     "\\([A-Z]+\\) 
*\\([A-Z_][a-zA-Z0-9_]*\\)[#]\\([a-zA-Z_][a-zA-Z_[0-9]]*\\)?")
+;;      (2 realgud-backtrace-number-face)
+;;      (3 font-lock-keyword-face)         ; e.g. METHOD, TOP
+;;      (4 font-lock-constant-face)        ; e.g. Object
+;;      (5 font-lock-function-name-face nil t))   ; t means optional
+;;     ;; Instruction sequence
+;;     ("<\\(.+\\)>"
+;;      (1 font-lock-variable-name-face))
+;;     ;; "::Type", which occurs in class name of function and in
+;;     ;; parameter list.  Parameter sequence
+;;     ("(\\(.+\\))"
+;;      (1 font-lock-variable-name-face))
+;;     ;; "::Type", which occurs in class name of function and in
+;;     ;; parameter list.
+;;     ("::\\([a-zA-Z_][a-zA-Z0-9_]*\\)"
+;;      (1 font-lock-type-face))
+;;     ;; File name.
+;;     (realgud--jdb-frame-file-regexp (1 realgud-file-name-face))
+;;     ;; Line number.
+;;     (realgud--jdb-frame-line-regexp (1 realgud-line-number-face))
+;;     ;; Function name.
+;;     ("\\<\\([a-zA-Z_][a-zA-Z0-9_]*\\)\\.\\([a-zA-Z_][a-zA-Z0-9_]*\\)"
+;;      (1 font-lock-type-face)
+;;      (2 font-lock-function-name-face))
+;;     ;; (jdb-frames-match-current-line
+;;     ;;  (0 jdb-frames-current-frame-face append))
+;;     ))
+
+;; realgud-loc-pat for a termination message.
+(setf (gethash "termination" realgud--jdb-pat-hash)
+       "^The application exited\n")
+
+(setf (gethash realgud--jdb-debugger-name realgud-pat-hash) 
realgud--jdb-pat-hash)
+
+(defvar realgud--jdb-command-hash (make-hash-table :test 'equal)
+  "Hash key is command name like 'quit' and the value is
+  the jdb command to use, like 'quit!'")
+
+(setf (gethash realgud--jdb-debugger-name
+              realgud-command-hash) realgud--jdb-command-hash)
+
+;;  Prefix used in variable names (e.g. short-key-mode-map) for
+;; this debugger
+
+(setf (gethash "jdb" realgud:variable-basename-hash) "realgud--jdb")
+
+(setf (gethash "backtrace"   realgud--jdb-command-hash) "where")
+
+;; For these we need to deal with java classpaths.
+;; Also jdb is pretty sucky when it comes to giving an prompt that
+;; we can write a regex for. So we don't even know often when there
+;; is a prompt!
+(setf (gethash "break"       realgud--jdb-command-hash) "*not-implemented*")
+(setf (gethash "clear"       realgud--jdb-command-hash) "*not-implemented*")
+(setf (gethash "restart"     realgud--jdb-command-hash) "*not-implemented*")
+
+(setf (gethash "info-breakpoints" realgud--jdb-command-hash) "clear")
+
+(setf (gethash "continue"    realgud--jdb-command-hash) "cont")
+(setf (gethash "finish"      realgud--jdb-command-hash) "step up")
+(setf (gethash "up"          realgud--jdb-command-hash) "up\C-Mwhere")
+(setf (gethash "down"        realgud--jdb-command-hash) "down\C-Mwhere")
+
+
+(provide-me "realgud-jdb-")
diff --git a/realgud-jdb/jdb.el b/realgud-jdb/jdb.el
new file mode 100644
index 0000000..21b9c88
--- /dev/null
+++ b/realgud-jdb/jdb.el
@@ -0,0 +1,113 @@
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program 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 3 of the License, or
+;; (at your option) any later version.
+
+;;  `realgud-jdb' Main interface to jdb via Emacs
+
+(require 'gud) ;; For class-path and source-path handling
+
+(require 'load-relative)
+(require 'realgud)
+(require-relative-list '("core" "track-mode") "realgud-jdb-")
+
+(declare-function realgud--jdb-query-cmdline  'realgud--jdb-core)
+(declare-function realgud--jdb-parse-cmd-args 'realgud--jdb-core)
+(declare-function realgud--run-process        'realgud--core)
+(declare-function realgud--flatten            'realgud-utils)
+
+(defvar realgud--jdb-file-remap nil
+  "A buffer-local hash table to map a Java file reproted by jdb into a file 
seen in the filesystem."
+)
+
+
+;; This is needed, or at least the docstring part of it is needed to
+;; get the customization menu to work in Emacs 25.
+(defgroup realgud--jdb nil
+  "The realgud interface to the Java's jdb debugger"
+  :group 'java
+  :group 'realgud
+  :version "25.1")
+
+;; -------------------------------------------------------------------
+;; User-definable variables
+;;
+
+(defcustom realgud--jdb-command-name
+  ;;"jdb --emacs 3"
+  "jdb"
+  "File name for executing the Java debugger and command options.
+This should be an executable on your path, or an absolute file name."
+  :type 'string
+  :group 'realgud--jdb)
+
+;;;###autoload
+(defun realgud--jdb (&optional opt-cmd-line no-reset)
+  "Invoke the Java jdb debugger and start the Emacs user interface.
+
+String OPT-CMD-LINE is treated like a shell string; arguments are
+tokenized by `split-string-and-unquote'. The tokenized string is
+parsed by `jdb-parse-cmd-args' and path elements found by that
+are expanded using `expand-file-name'.
+
+Normally, command buffers are reused when the same debugger is
+reinvoked inside a command buffer with a similar command. If we
+discover that the buffer has prior command-buffer information and
+NO-RESET is nil, then that information which may point into other
+buffers and source buffers which may contain marks and fringe or
+marginal icons is reset. See `loc-changes-clear-buffer' to clear
+fringe and marginal icons.
+"
+  (interactive)
+
+  (setq gud-jdb-classpath nil)
+  (setq gud-jdb-sourcepath nil)
+  ;; Set gud-jdb-classpath from the CLASSPATH environment variable,
+  ;; if CLASSPATH is set.
+  (setq gud-jdb-classpath-string (or (getenv "CLASSPATH") "."))
+  (if gud-jdb-classpath-string
+      (setq gud-jdb-classpath
+           (gud-jdb-parse-classpath-string gud-jdb-classpath-string)))
+
+  (setq gud-jdb-class-source-alist
+       (gud-jdb-build-class-source-alist
+        (setq gud-jdb-source-files
+              (gud-jdb-build-source-files-list gud-jdb-directories
+                                               "\\.java$"))))
+  (fset 'gud-jdb-find-source 'gud-jdb-find-source-file)
+
+
+  ;; reset for future invocations
+  (setq gud-jdb-classpath-string nil)
+
+  (let* (
+        (cmd-str (or opt-cmd-line (realgud--jdb-query-cmdline "jdb")))
+        (cmd-args (split-string-and-unquote cmd-str))
+        (parsed-args (realgud--jdb-parse-cmd-args cmd-args))
+        (script-args (caddr parsed-args))
+        (script-name (car script-args))
+        (parsed-cmd-args
+         (cl-remove-if 'nil (realgud--flatten parsed-args)))
+        (cmd-buf (realgud--run-process "jdb" script-name parsed-cmd-args
+                        'realgud--jdb-track-mode-hook no-reset))
+        )
+    (if cmd-buf
+       (with-current-buffer cmd-buf
+         (set (make-local-variable 'realgud--jdb-file-remap)
+              (make-hash-table :test 'equal))
+         )
+      )
+    )
+  )
+
+;;;###autoload
+(defalias 'jdb 'realgud--jdb)
+(provide-me "realgud-")
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions)
+;; End:
diff --git a/realgud-jdb/track-mode.el b/realgud-jdb/track-mode.el
new file mode 100644
index 0000000..cb4d87c
--- /dev/null
+++ b/realgud-jdb/track-mode.el
@@ -0,0 +1,87 @@
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program 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 3 of the License, or
+;; (at your option) any later version.
+
+;; Java "jdb" Debugger tracking a comint or eshell buffer.
+
+(require 'load-relative)
+(require 'realgud)
+(require 'realgud-lang-java)
+(require-relative-list '("core" "init") "realgud-jdb-")
+
+(declare-function realgud-track-mode 'realgud-track-mode)
+(declare-function realgud-track-mode-hook 'realgud-track-mode)
+(declare-function realgud-track-mode-setup 'realgud-track-mode)
+(declare-function realgud--track-set-debugger 'realgud-track-mode)
+(declare-function realgud-goto-line-for-pt 'realgud-track-mode)
+(declare-function realgud-java-populate-command-keys 'realgud-lang-java)
+
+(realgud-track-mode-vars "realgud--jdb")
+;;(defvaralias 'jdb-short-key-mode-map 'realgud--jdb-short-key-mode-map)
+;;(defvaralias 'jdb-track-mode         'realgud--track-mode)
+
+(realgud-java-populate-command-keys realgud--jdb-track-mode-map)
+
+
+(define-key realgud-track-mode-map
+  (kbd "C-c !!") 'realgud--goto-lang-backtrace-line)
+(define-key realgud-track-mode-map
+  (kbd "C-c !b") 'realgud--goto-debugger-backtrace-line)
+
+(defun realgud--jdb-goto-control-frame-line (pt)
+  "Display the location mentioned by a control-frame line
+described by PT."
+  (interactive "d")
+  (realgud-goto-line-for-pt pt "control-frame"))
+
+(defun realgud--jdb-goto-syntax-error-line (pt)
+  "Display the location mentioned in a Syntax error line
+described by PT."
+  (interactive "d")
+  (realgud-goto-line-for-pt pt "syntax-error"))
+
+(define-key realgud--jdb-track-mode-map
+  (kbd "C-c !c") 'realgud--jdb-goto-control-frame-line)
+(define-key realgud--jdb-track-mode-map
+  (kbd "C-c !s") 'realgud--jdb-goto-syntax-error-line)
+
+(defun realgud--jdb-track-mode-hook()
+  (if realgud--jdb-track-mode
+      (progn
+       (use-local-map realgud--jdb-track-mode-map)
+       (message "using realgud--jdb-track-mode-map"))
+    ;; else
+    (progn
+      (setq realgud-track-mode nil)
+      ))
+)
+
+(define-minor-mode realgud--jdb-track-mode
+  "Minor mode for tracking jdb source locations inside a process shell via 
realgud. jdb is a Ruby debugger.
+
+If called interactively with no prefix argument, the mode is toggled. A prefix 
argument, captured as ARG, enables the mode if the argument is positive, and 
disables it otherwise.
+
+\\{realgud--jdb-track-mode-map}
+"
+  :init-value nil
+  ;; :lighter " jdb"   ;; mode-line indicator from realgud-track is sufficient.
+  ;; The minor mode bindings.
+  :global nil
+  :group 'realgud--jdb
+  :keymap realgud--jdb-track-mode-map
+  (realgud--track-set-debugger "jdb")
+  (if realgud--jdb-track-mode
+      (progn
+       (realgud-track-mode-setup 't)
+       (realgud--jdb-track-mode-hook))
+    (progn
+      (setq realgud-track-mode nil)
+      ))
+)
+
+(provide-me "realgud-jdb-")
diff --git a/realgud-node-debug/Makefile.am b/realgud-node-debug/Makefile.am
deleted file mode 100644
index aa624b8..0000000
--- a/realgud-node-debug/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-lisp_files = $(wildcard *.el)
-EXTRA_DIST=$(lisp_files)
-lisp_LISP = $(lisp_files)
-include ../common.mk
-lispdir = @lispdir@/node-inspect
diff --git a/realgud-node-debug/core.el b/realgud-node-debug/core.el
deleted file mode 100644
index 96d3092..0000000
--- a/realgud-node-debug/core.el
+++ /dev/null
@@ -1,170 +0,0 @@
-;; Copyright (C) 2019 Free Software Foundation, Inc
-;; This program 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 3 of the License, or
-;; (at your option) any later version.
-
-;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
-
-(eval-when-compile (require 'cl-lib))
-
-(require 'realgud)
-
-(declare-function realgud:expand-file-name-if-exists 'realgud-core)
-(declare-function realgud-lang-mode? 'realgud-lang)
-(declare-function realgud-parse-command-arg 'realgud-core)
-(declare-function realgud-query-cmdline 'realgud-core)
-
-;; FIXME: I think the following could be generalized and moved to
-;; realgud-... probably via a macro.
-(declare-function realgud:expand-file-name-if-exists 'realgud-core)
-(declare-function realgud-parse-command-arg  'realgud-core)
-(declare-function realgud-query-cmdline      'realgud-core)
-(declare-function realgud-suggest-invocation 'realgud-core)
-
-;; FIXME: I think the following could be generalized and moved to
-;; realgud-... probably via a macro.
-(defvar realgud:node-debug-minibuffer-history nil
-  "Minibuffer history list for the command `node-debug'.")
-
-(easy-mmode-defmap realgud:node-debug-minibuffer-local-map
-  '(("\C-i" . comint-dynamic-complete-filename))
-  "Keymap for minibuffer prompting of node-debug startup command."
-  :inherit minibuffer-local-map)
-
-;; FIXME: I think this code and the keymaps and history
-;; variable chould be generalized, perhaps via a macro.
-(defun node-debug-query-cmdline (&optional opt-debugger)
-  (realgud-query-cmdline
-   'realgud:node-debug-suggest-invocation
-   realgud:node-debug-minibuffer-local-map
-   'realgud:node-debug-minibuffer-history
-   opt-debugger))
-
-;;; FIXME: DRY this with other *-parse-cmd-args routines
-(defun node-debug-parse-cmd-args (orig-args)
-  "Parse command line ORIG-ARGS for the name of script to debug.
-
-ORIG-ARGS should contain a tokenized list of the command line to run.
-
-We return the a list containing
-* the name of the debugger given (e.g. ‘node-debug’) and its arguments ,
-  a list of strings
-* the script name and its arguments - list of strings
-
-For example for the following input:
-  (map 'list 'symbol-name
-   '(node --interactive --debugger-port 5858 /tmp node-debug ./gcd.js a b))
-
-we might return:
-   ((\"node\" \"--interactive\" \"--debugger-port\" \"5858\") nil
-    (\"/tmp/gcd.js\" \"a\" \"b\"))
-
-Note that path elements have been expanded via `expand-file-name'."
-
-  ;; Parse the following kind of pattern:
-  ;;  node node-debug-options script-name script-options
-  (let (
-       (args orig-args)
-       (pair)          ;; temp return from
-       (node-two-args '("-debugger_port" "C" "D" "i" "l" "m" "-module" "x"))
-       ;; node doesn't have any optional two-arg options
-       (node-opt-two-args '())
-
-       ;; One dash is added automatically to the below, so
-       ;; h is really -h and -debugger_port is really --debugger_port.
-       (node-debug-two-args '("-debugger_port"))
-       (node-debug-opt-two-args '())
-
-       ;; Things returned
-       (script-name nil)
-       (debugger-name nil)
-       (interpreter-args '())
-       (script-args '())
-       )
-    (if (not (and args))
-       ;; Got nothing: return '(nil, nil, nil)
-       (list interpreter-args nil script-args)
-      ;; else
-      (progn
-       ;; Remove "node-debug" (or "nodemon" or "node") from invocation like:
-       ;; node-debug --node-debug-options script --script-options
-       (setq debugger-name (file-name-sans-extension
-                            (file-name-nondirectory (car args))))
-       (unless (string-match "^node\\(?:js\\|mon\\)?$" debugger-name)
-         (message
-          "Expecting debugger name `%s' to be `node', `nodemon', or 
`node-debug'"
-          debugger-name))
-       (setq interpreter-args (list (pop args)))
-
-       ;; Skip to the first non-option argument.
-       (while (and args (not script-name))
-         (let ((arg (car args)))
-           (cond
-            ((equal "debug" arg)
-             (nconc interpreter-args (list arg))
-             (setq args (cdr args))
-             )
-
-            ;; Options with arguments.
-            ((string-match "^-" arg)
-             (setq pair (realgud-parse-command-arg
-                         args node-debug-two-args node-debug-opt-two-args))
-             (nconc interpreter-args (car pair))
-             (setq args (cadr pair)))
-            ;; Anything else must be the script to debug.
-            (t (setq script-name (realgud:expand-file-name-if-exists arg))
-              (setq script-args (cons script-name (cdr args))))
-            )))
-       (list interpreter-args nil script-args)))
-    ))
-
-;; To silence Warning: reference to free variable
-(defvar realgud:node-debug-command-name)
-
-(defun realgud:node-debug-suggest-invocation (debugger-name)
-  "Suggest a ‘node-debug’ command invocation via `realgud-suggest-invocaton'.
-Argument DEBUGGER-NAME is not used - it is there function compatibility."
-  (realgud-suggest-invocation realgud:node-debug-command-name
-                             realgud:node-debug-minibuffer-history
-                             "js" "\\.js$"))
-
-(defun realgud:node-debug-remove-ansi-shmutz()
-  "Remove ASCII escape sequences that node.js 'decorates' in
-prompts and interactive output."
-  (add-to-list
-   'comint-preoutput-filter-functions
-   (lambda (output)
-     (replace-regexp-in-string "\033\\[[0-9]+[GKJ]" "" output)))
-  )
-
-(defun realgud:node-debug-reset ()
-  "Node-Debug cleanup - remove debugger's internal buffers (frame, 
breakpoints, etc.)."
-  (interactive)
-  ;; (node-debug-breakpoint-remove-all-icons)
-  (dolist (buffer (buffer-list))
-    (when (string-match "\\*node-debug-[a-z]+\\*" (buffer-name buffer))
-      (let ((w (get-buffer-window buffer)))
-        (when w
-          (delete-window w)))
-      (kill-buffer buffer))))
-
-;; (defun node-debug-reset-keymaps()
-;;   "This unbinds the special debugger keys of the source buffers."
-;;   (interactive)
-;;   (setcdr (assq 'node-debug-debugger-support-minor-mode 
minor-mode-map-alist)
-;;       node-debug-debugger-support-minor-mode-map-when-deactive))
-
-
-(defun realgud:node-debug-customize ()
-  "Use `customize' to edit the settings of the `node-debug' debugger."
-  (interactive)
-  (customize-group 'realgud:node-debug))
-
-(provide-me "realgud:node-debug-")
diff --git a/realgud-node-debug/init.el b/realgud-node-debug/init.el
deleted file mode 100644
index fe3a5c3..0000000
--- a/realgud-node-debug/init.el
+++ /dev/null
@@ -1,188 +0,0 @@
-;; Copyright (C) 2019 Free Software Foundation, Inc
-;; Author: Rocky Bernstein
-
-;; This program 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 3 of the License, or
-;; (at your option) any later version.
-
-;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; "node debug" debugger
-
-;;; Note: this protocol is was in use up until node version 6 and
-;;; became became deprecated with node version 8.  The newer protocol
-;;; is in realgud-node-inspect
-;;;
-;;; Regular expressions for nodejs Javascript debugger with "node debug" 
protocol.
-
-(eval-when-compile (require 'cl-lib))   ;For setf.
-
-(require 'realgud)
-(require 'realgud-lang-js)
-(require 'ansi-color)
-
-(defvar realgud:node-debug-pat-hash)
-(declare-function make-realgud-loc-pat (realgud-loc))
-
-(defvar realgud:node-debug-pat-hash (make-hash-table :test 'equal)
-  "Hash key is the what kind of pattern we want to match:
-backtrace, prompt, etc.  The values of a hash entry is a
-realgud-loc-pat struct")
-
-;; before a command prompt.
-;; For example:
-;;   break in /home/indutny/Code/git/indutny/myscript.js:1
-(setf (gethash "loc" realgud:node-debug-pat-hash)
-      (make-realgud-loc-pat
-       :regexp (format
-               "\\(?:%s\\)*\\(?:break\\|exception\\) in %s:%s"
-               realgud:js-term-escape "\\([^:]+\\)"
-               realgud:regexp-captured-num)
-       :file-group 1
-       :line-group 2))
-
-;; Regular expression that describes a node-debug command prompt
-;; For example:
-;;   debug>
-(setf (gethash "prompt" realgud:node-debug-pat-hash)
-      (make-realgud-loc-pat
-       :regexp (format "^\\(?:%s\\)*debug> " realgud:js-term-escape)
-       ))
-
-;; Need an improved setbreak for this.
-;; ;;  Regular expression that describes a "breakpoint set" line
-;; ;;   3 const armlet = require('armlet');
-;; ;; * 4 const client = new armlet.Client(
-;; ;; ^^^^
-;; ;;
-;; (setf (gethash "brkpt-set" realgud:node-debug-pat-hash)
-;;       (make-realgud-loc-pat
-;;        :regexp "^\*[ ]*\\([0-9]+\\) \\(.+\\)"
-;;        :line-group 1
-;;        :text-group 2))
-
-;; Regular expression that describes a V8 backtrace line.
-;; For example:
-;;    at repl:1:7
-;;    at Interface.controlEval 
(/src/external-vcs/github/trepanjs/lib/interface.js:352:18)
-;;    at REPLServer.b [as eval] (domain.js:183:18)
-(setf (gethash "lang-backtrace" realgud:node-debug-pat-hash)
-  realgud:js-backtrace-loc-pat)
-
-;; Regular expression that describes a debugger "delete" (breakpoint)
-;; response.
-;; For example:
-;;   Removed 1 breakpoint(s).
-(setf (gethash "brkpt-del" realgud:node-debug-pat-hash)
-      (make-realgud-loc-pat
-       :regexp (format "^Removed %s breakpoint(s).\n"
-                      realgud:regexp-captured-num)
-       :num 1))
-
-
-(defconst realgud:node-debug-frame-start-regexp  "\\(?:^\\|\n\\)\\(?:#\\)")
-(defconst realgud:node-debug-frame-num-regexp    realgud:regexp-captured-num)
-(defconst realgud:node-debug-frame-module-regexp "[^ \t\n]+")
-(defconst realgud:node-debug-frame-file-regexp   "[^ \t\n]+")
-
-;; Regular expression that describes a node-debug location generally shown
-;; Regular expression that describes a debugger "backtrace" command line.
-;; For example:
-;; #0 module.js:380:17
-;; #1 dbgtest.js:3:9
-;; #2 Module._compile module.js:456:26
-;; #3 Module._extensions..js module.js:474:10
-;; #4 Module.load module.js:356:32
-;; #5 Module._load module.js:312:12
-;; #6 Module.runMain module.js:497:10
-; ;#7 timers.js:110:15
-(setf (gethash "debugger-backtrace" realgud:node-debug-pat-hash)
-      (make-realgud-loc-pat
-       :regexp         (concat realgud:node-debug-frame-start-regexp
-                       realgud:node-debug-frame-num-regexp " "
-                       "\\(?:" realgud:node-debug-frame-module-regexp " \\)?"
-                       "\\(" realgud:node-debug-frame-file-regexp "\\)"
-                       ":"
-                       realgud:regexp-captured-num
-                       ":"
-                       realgud:regexp-captured-num
-                       )
-       :num 1
-       :file-group 2
-       :line-group 3
-       :char-offset-group 4))
-
-(defconst realgud:node-debug-debugger-name "node-debug" "Name of debugger.")
-
-;; ;; Regular expression that for a termination message.
-;; (setf (gethash "termination" realgud:node-debug-pat-hash)
-;;        "^node-debug: That's all, folks...\n")
-
-(setf (gethash "font-lock-keywords" realgud:node-debug-pat-hash)
-  '(
-    ;; #0 module.js:380:17
-    ;;  ^ ^^^^^^^^^ ^^^ ^^
-    (concat realgud:node-debug-frame-start-regexp
-           realgud:node-debug-frame-num-regexp " "
-           "\\(?:" realgud:node-debug-frame-module-regexp " \\)?"
-           "\\(" realgud:node-debug-frame-file-regexp "\\)"
-           ":"
-           realgud:regexp-captured-num
-           )
-     (1 realgud-file-name-face)
-     (2 realgud-line-number-face)
-     )
-    )
-
-(setf (gethash "node-debug" realgud-pat-hash)
-      realgud:node-debug-pat-hash)
-
-;;  Prefix used in variable names (e.g. short-key-mode-map) for
-;; this debugger
-
-(setf (gethash "node-debug" realgud:variable-basename-hash)
-      "realgud:node-debug")
-
-(defvar realgud:node-debug-command-hash (make-hash-table :test 'equal)
-  "Hash key is command name like 'finish' and the value is the node-debug 
command to use, like 'out'.")
-
-(setf (gethash realgud:node-debug-debugger-name
-              realgud-command-hash)
-      realgud:node-debug-command-hash)
-
-(setf (gethash "backtrace"  realgud:node-debug-command-hash) "backtrace")
-(setf (gethash "break"      realgud:node-debug-command-hash)
-      "setBreakpoint('%X',%l)")
-(setf (gethash "clear"      realgud:node-debug-command-hash)
-      "clearBreakpoint('%X', %l)")
-(setf (gethash "continue"         realgud:node-debug-command-hash) "cont")
-(setf (gethash "kill"             realgud:node-debug-command-hash) "kill")
-(setf (gethash "quit"             realgud:node-debug-command-hash) ".exit")
-(setf (gethash "finish"           realgud:node-debug-command-hash) "out")
-(setf (gethash "shell"            realgud:node-debug-command-hash) "repl")
-(setf (gethash "eval"             realgud:node-debug-command-hash) 
"exec('%s')")
-(setf (gethash "info-breakpoints" realgud:node-debug-command-hash) 
"breakpoints")
-
-;; We need aliases for step and next because the default would
-;; do step 1 and node-debug doesn't handle this. And if it did,
-;; it would probably look like step(1).
-(setf (gethash "step"       realgud:node-debug-command-hash) "step")
-(setf (gethash "next"       realgud:node-debug-command-hash) "next")
-
-;; Unsupported features:
-(setf (gethash "jump"       realgud:node-debug-command-hash) 
"*not-implemented*")
-(setf (gethash "up"         realgud:node-debug-command-hash) 
"*not-implemented*")
-(setf (gethash "down"       realgud:node-debug-command-hash) 
"*not-implemented*")
-(setf (gethash "frame"      realgud:node-debug-command-hash) 
"*not-implemented*")
-
-(setf (gethash "node-debug" realgud-command-hash) 
realgud:node-debug-command-hash)
-(setf (gethash "node-debug" realgud-pat-hash) realgud:node-debug-pat-hash)
-
-(provide-me "realgud:node-debug-")
diff --git a/realgud-node-debug/main.el b/realgud-node-debug/main.el
deleted file mode 100644
index 187a9c4..0000000
--- a/realgud-node-debug/main.el
+++ /dev/null
@@ -1,85 +0,0 @@
-;; Copyright (C) 2019 Free Software Foundation, Inc
-;; Author: Rocky Bernstein
-
-;; This program 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 3 of the License, or
-;; (at your option) any later version.
-
-;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;;  `realgud:node-debug' Main interface to older "node debugb" debugger via 
Emacs
-
-(require 'cl-lib)
-(require 'load-relative)
-(require 'realgud)
-(require-relative-list '("core" "track-mode") "realgud:node-debug-")
-
-;; This is needed, or at least the docstring part of it is needed to
-;; get the customization menu to work in Emacs 24.
-(defgroup realgud:node-debug nil
-  "The realgud interface to the node-debug debugger"
-  :group 'realgud
-  :version "24.3")
-
-;; -------------------------------------------------------------------
-;; User-definable variables
-;;
-
-(defcustom realgud:node-debug-command-name
-  "node debug"
-  "File name for executing the Javascript debugger and command options.
-This should be an executable on your path, or an absolute file name."
-  :type 'string
-  :group 'realgud:node-debug)
-
-;; -------------------------------------------------------------------
-;; The end.
-;;
-
-(declare-function node-debug-track-mode     'realgud-node-debug-track-mode)
-(declare-function node-debug-query-cmdline  'realgud:node-debug-core)
-(declare-function node-debug-parse-cmd-args 'realgud:node-debug-core)
-
-;;;###autoload
-(defun realgud:node-debug (&optional opt-cmd-line no-reset)
-  "Invoke the node-debug shell debugger and start the Emacs user interface.
-
-String OPT-CMD-LINE specifies how to run node-debug.
-
-OPT-CMD-LINE is treated like a shell string; arguments are
-tokenized by `split-string-and-unquote'.  The tokenized string is
-parsed by `node-debug-parse-cmd-args' and path elements found by that
-are expanded using `realgud:expand-file-name-if-exists'.
-
-Normally, command buffers are reused when the same debugger is
-reinvoked inside a command buffer with a similar command.  If we
-discover that the buffer has prior command-buffer information and
-NO-RESET is nil, then that information which may point into other
-buffers and source buffers which may contain marks and fringe or
-marginal icons is reset.  See `loc-changes-clear-buffer' to clear
-fringe and marginal icons."
-  (interactive)
-  (let ((cmd-buf
-        (realgud:run-debugger "node-debug"
-                              'node-debug-query-cmdline 
'node-debug-parse-cmd-args
-                              'realgud:node-debug-minibuffer-history
-                              opt-cmd-line no-reset)))
-    ;; (if cmd-buf
-    ;;         (with-current-buffer cmd-buf
-    ;;           ;; FIXME should allow customization whether to do or not
-    ;;           ;; and also only do if hook is not already there.
-    ;;           (realgud:remove-ansi-schmutz)
-    ;;           )
-    ;;   )
-    ))
-
-(defalias 'node-debug 'realgud:node-debug)
-
-(provide-me "realgud-")
diff --git a/realgud-node-debug/track-mode.el b/realgud-node-debug/track-mode.el
deleted file mode 100644
index f18fd0b..0000000
--- a/realgud-node-debug/track-mode.el
+++ /dev/null
@@ -1,84 +0,0 @@
-;; track-mode.el ---
-;; Copyright (C) 2019 Free Software Foundation, Inc
-;; Author: Rocky Bernstein
-
-;; This program 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 3 of the License, or
-;; (at your option) any later version.
-
-;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;; "node debug" tracking a comint or eshell buffer.
-
-(declare-function realgud:track-set-debugger 'realgud-track-mode)
-(declare-function realgud-track-mode-setup   'realgud-track-mode)
-(declare-function realgud:remove-ansi-schmutz 'realgud:utils)
-
-(require 'realgud)
-
-(require-relative-list '("core" "init") "realgud:node-debug-")
-
-(realgud-track-mode-vars "realgud:node-debug")
-
-(defun realgud:node-debug-track-mode-hook()
-  (if realgud:node-debug-track-mode
-      (progn
-       (use-local-map realgud:node-debug-track-mode-map)
-       (realgud:remove-ansi-schmutz)
-       (message "using node-debug mode map")
-       )
-    (message "node-debug track-mode-hook disable called"))
-)
-
-;; FIXME: this shouldn't be needed
-(defvar realgud:node-debug-track-mode-map (make-keymap))
-(define-key realgud:node-debug-track-mode-map
-  (kbd "C-c !f") 'realgud:js-goto-file-line)
-
-(define-minor-mode realgud:node-debug-track-mode
-  "Minor mode for tracking node-debug source locations inside a node-debug 
shell via realgud.
-
-If called interactively with no prefix argument, the mode is
-toggled. A prefix argument, captured as ARG, enables the mode if
-the argument is positive, and disables it otherwise.
-
-\\{realgud:node-debug-track-mode-map}"
-  :init-value nil
-  ;; :lighter " node-debug"   ;; mode-line indicator from realgud-track is 
sufficient.
-  ;; The minor mode bindings.
-  :global nil
-  :group 'realgud:node-debug
-  :keymap realgud:node-debug-track-mode-map
-
-  (if realgud:node-debug-track-mode
-      (progn
-       (realgud:track-set-debugger "node-debug")
-        (realgud:node-debug-track-mode-hook)
-        (realgud:track-mode-enable))
-    (progn
-      (setq realgud-track-mode nil)
-      ))
-  )
-
-;; ;; Debugger commands that node-debug doesn't have
-;; (define-key node-debug-track-mode-map
-;;   [remap realgud:cmd-newer-frame] 'undefined)
-;; (define-key node-debug-track-mode-map
-;;   [remap realgud:cmd-older-frame] 'undefined)
-(defvar realgud:node-debug-short-key-mode-map (make-keymap))
-
-(define-key realgud:node-debug-short-key-mode-map
-  [remap realgud:cmd-step] 'realgud:cmd-step-no-arg)
-(define-key realgud:node-debug-short-key-mode-map
-  [remap realgud:cmd-step] 'realgud:cmd-step-no-arg)
-(define-key realgud:node-debug-short-key-mode-map
-  [remap realgud:cmd-next] 'realgud:cmd-next-no-arg)
-
-(provide-me "realgud:node-debug-")
diff --git a/test/gcd.js b/test/gcd.js
deleted file mode 100644
index ee56555..0000000
--- a/test/gcd.js
+++ /dev/null
@@ -1,45 +0,0 @@
-//!/usr/bin/env node
-var util = require("util");
-require("console");
-
-function ask(question, format, callback) {
- var stdin = process.stdin, stdout = process.stdout;
-
- stdin.resume();
- stdout.write(question + ": ");
-
- stdin.once('data', function(data) {
-   data = data.toString().trim();
-
-   if (format.test(data)) {
-     callback(data);
-   } else {
-     stdout.write("It should match: "+ format +"\n");
-     ask(question, format, callback);
-   }
- });
-}
-
-// GCD. We assume positive numbers
-function gcd(a, b) {
-    // Make: a <= b
-    if (a > b) {
-       var temp = a;
-       a = b;
-       b = temp;
-    }
-
-    if (a <= 0) { return null };
-
-    if (a == 1 || b-a == 0) {
-       return a;
-    }
-    return gcd(b-a, a);
-}
-
-var a = parseInt(process.argv[0]) || 24,
-    b = parseInt(process.argv[0]) || 5;
-
-console.log(util.format("The GCD of %d and %d is %d", a, b,
-                       gcd(a, b)));
-process.exit();
diff --git a/test/test-jdb.el b/test/test-jdb.el
new file mode 100644
index 0000000..1f40011
--- /dev/null
+++ b/test/test-jdb.el
@@ -0,0 +1,18 @@
+;; Press C-x C-e at the end of the next line to run this file test 
non-interactively
+;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory 
(locate-library "test-simple.elc")) buffer-file-name)
+
+(require 'test-simple)
+(require 'load-relative)
+(load-file "../realgud-jdb/core.el")
+(test-simple-start)
+
+(declare-function __FILE__  'load-relative)
+(declare-function realgud:jdb-parse-cmd-args 'realgud:jdb-core)
+(declare-function realgud:jdb-dot-to-slash   'realgud:jdb-core)
+
+(assert-equal '("jdb" nil ("./TestMe.java"))
+             (realgud:jdb-parse-cmd-args '("jdb" "./TestMe.java")))
+(assert-equal "mcb/pcingola/SnpEff/main"
+             (realgud:jdb-dot-to-slash "mcb.pcingola.SnpEff.main"))
+
+(end-tests)
diff --git a/test/test-loc-regexp-node-debug.el 
b/test/test-loc-regexp-node-debug.el
deleted file mode 100644
index 538fe29..0000000
--- a/test/test-loc-regexp-node-debug.el
+++ /dev/null
@@ -1,118 +0,0 @@
-;; Press C-x C-e at the end of the next line to run this file test 
non-interactively
-;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory 
(locate-library "test-simple.elc")) buffer-file-name)
-
-(require 'test-simple)
-(require 'load-relative)
-(require 'realgud)
-
-(load-file "./regexp-helper.el")
-(load-file "../realgud-node-debug/init.el")
-
-(declare-function realgud-cmdbuf-info-loc-regexp 'realgud-buffer-command)
-(declare-function cmdbuf-loc-match               'realgud-regexp-helper)
-(declare-function realgud-loc-pat-regexp         'realgud-regexp)
-(declare-function realgud-loc-pat-file-group     'realgud-regexp)
-(declare-function realgud-loc-pat-line-group     'realgud-regexp)
-(declare-function realgud-cmdbuf-info-file-group 'realgud-regexp)
-(declare-function realgud-cmdbuf-info-line-group 'realgud-regexp)
-(declare-function realgud-cmdbuf-info            'realgud-regexp)
-(declare-function make-realgud-cmdbuf-info       'realgud-regexp)
-(declare-function realgud-loc-pat-num            'realgud-regexp)
-(declare-function test-simple-start 'test-simple)
-(declare-function assert-t 'test-simple)
-(declare-function assert-equal 'test-simple)
-(declare-function note 'test-simple)
-(declare-function end-tests 'test-simple)
-(declare-function realgud-loc-pat-char-offset-group  'realgud:nodejs-init)
-
-(test-simple-start)
-
-(eval-when-compile
-  (defvar file-group)
-  (defvar frame-re)
-  (defvar line-group)
-  (defvar num-group)
-  (defvar col-group)
-  (defvar test-pos)
-  (defvar bt-re)
-  (defvar dbg-name)
-  (defvar realgud-pat-hash)
-  (defvar loc-pat)
-  (defvar test-dbgr)
-  (defvar test-s1)
-  (defvar realgud-pat-bt)
-  (defvar realgud:nodejs-pat-hash)
-)
-
-; Some setup usually done in setting up the buffer.
-; We customize this for the debugger trepan. Others may follow.
-; FIXME: encapsulate this.
-(setq dbg-name "nodejs")
-(setq loc-pat (gethash "loc" (gethash dbg-name realgud-pat-hash)))
-
-(setq test-dbgr (make-realgud-cmdbuf-info
-                :debugger-name dbg-name
-                :loc-regexp (realgud-loc-pat-regexp loc-pat)
-                :file-group (realgud-loc-pat-file-group loc-pat)
-                :line-group (realgud-loc-pat-line-group loc-pat)))
-
-
-(note "debugger-backtrace")
-(setq realgud-pat-bt  (gethash "debugger-backtrace"
-                            realgud:nodejs-pat-hash))
-(setq test-s1
-      "#0 module.js:380:17
-#1 Module._compile module2.js:456:26
-#2 Module._extensions..js module.js:474:10
-#3 Module.load module.js:356:32
-")
-
-(setq bt-re (realgud-loc-pat-regexp realgud-pat-bt))
-(setq num-group (realgud-loc-pat-num realgud-pat-bt))
-(setq file-group (realgud-loc-pat-file-group realgud-pat-bt))
-(setq line-group (realgud-loc-pat-line-group realgud-pat-bt))
-(setq col-group (realgud-loc-pat-char-offset-group realgud-pat-bt))
-(assert-equal 0 (string-match bt-re test-s1))
-(assert-equal "0" (substring test-s1
-                            (match-beginning num-group)
-                            (match-end num-group)))
-(assert-equal "module.js"
-             (substring test-s1
-                        (match-beginning file-group)
-                        (match-end file-group)))
-(assert-equal "380"
-             (substring test-s1
-                        (match-beginning line-group)
-                        (match-end line-group)))
-(assert-equal "17" (substring test-s1
-                            (match-beginning col-group)
-                            (match-end col-group)))
-
-(setq test-pos (match-end 0))
-(assert-equal 19 (string-match bt-re test-s1 test-pos))
-
-(setq test-s1
-      "#1 Module._compile module2.js:456:26
-#2 Module._extensions..js module.js:474:10
-#3 Module.load module.js:356:32
-")
-(assert-equal 0 (string-match bt-re test-s1))
-
-(assert-equal "1" (substring test-s1
-                            (match-beginning num-group)
-                            (match-end num-group)))
-(assert-equal "module2.js"
-             (substring test-s1
-                        (match-beginning file-group)
-                        (match-end file-group)))
-(assert-equal "456"
-             (substring test-s1
-                        (match-beginning line-group)
-                        (match-end line-group)))
-(assert-equal "26" (substring test-s1
-                             (match-beginning col-group)
-                             (match-end col-group)))
-(setq test-pos (match-end 0))
-(assert-equal 36 test-pos)
-
-(end-tests)
diff --git a/test/test-node-debug.el b/test/test-node-debug.el
deleted file mode 100644
index 7762de6..0000000
--- a/test/test-node-debug.el
+++ /dev/null
@@ -1,37 +0,0 @@
-;; Press C-x C-e at the end of the next line to run this file test 
non-interactively
-;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory 
(locate-library "test-simple.elc")) buffer-file-name)
-
-(require 'test-simple)
-(load-file "../realgud-node-debug/main.el")
-
-(eval-when-compile (defvar test:run-process-save))
-
-(declare-function nodejs-parse-cmd-args 'realgud:nodejs)
-(declare-function nodejs                'realgud:nodejs)
-(declare-function __FILE__              'load-relative)
-
-(test-simple-start)
-
-;; Save value realgud:run-process and change it to something we want
-(setq test:run-process-save (symbol-function 'realgud:run-process))
-(defun realgud:run-process(debugger-name script-filename cmd-args
-                                        minibuf-history &optional no-reset)
-  "Fake realgud:run-process used in testing"
-  (note
-   (format "%s %s %s" debugger-name script-filename cmd-args))
-  (assert-equal "node" debugger-name "debugger name gets passed")
-  (let ((expanded-name (expand-file-name "./gcd.js")))
-    (assert-equal  expanded-name script-filename "file name check")
-    ))
-
-(note "nodejs-parse-cmd-args")
-(assert-equal (list '("node" "debug") nil '("foo"))
-             (nodejs-parse-cmd-args '("node" "debug" "foo")))
-
-;; FIXME: need to mock remove-ansi-schmutz in realgud:nodejs
-;; (realgud:nodejs "node debug ./gcd.js 3 5")
-
-;; Restore the old value of realgud:run-process
-(fset 'realgud:run-process test:run-process-save)
-
-(end-tests)
diff --git a/test/test-regexp-jdb.el b/test/test-regexp-jdb.el
new file mode 100644
index 0000000..5b06927
--- /dev/null
+++ b/test/test-regexp-jdb.el
@@ -0,0 +1,78 @@
+;; Press C-x C-e at the end of the next line to run this file test 
non-interactively
+;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory 
(locate-library "test-simple.elc")) buffer-file-name)
+
+(require 'test-simple)
+(require 'realgud)
+(load-file "../realgud-jdb/init.el")
+(load-file "./regexp-helper.el")
+
+(declare-function __FILE__              'load-relative)
+(declare-function prompt-match          'regexp-helper)
+
+(eval-when-compile
+  (defvar dbg-name)   (defvar realgud-pat-hash)   (defvar loc-pat)
+  (defvar test-dbgr)  (defvar test-text)         (defvar prompt-pat)
+  (defvar realgud:jdb-pat-hash)
+)
+
+(test-simple-start)
+
+(note "jdb prompt matching")
+(set (make-local-variable 'prompt-pat)
+     (gethash "prompt" realgud:jdb-pat-hash))
+(prompt-match "main[1] "  "1" "most common main prompt")
+(prompt-match "main[2] "  "2" "main prompt up a level")
+(prompt-match "> " nil "no loc prompt")
+
+
+; Some setup usually done in setting up the buffer.
+; We customize this for this debugger.
+; FIXME: encapsulate this.
+(setq dbg-name "jdb")
+
+(setq loc-pat (gethash "loc" (gethash dbg-name realgud-pat-hash)))
+(setq test-dbgr (make-realgud-cmdbuf-info
+                :debugger-name dbg-name
+                :loc-regexp (realgud-loc-pat-regexp loc-pat)
+                :file-group (realgud-loc-pat-file-group loc-pat)
+                :line-group (realgud-loc-pat-line-group loc-pat)))
+
+;; FIXME: we get a void variable somewhere in here when running
+;;        even though we define it in lexical-let. Dunno why.
+;;        setq however will workaround this.
+(let ((text "Breakpoint hit: \"thread=main\", TestMe.main(), line=7 bci=0"))
+
+  (note "traceback location matching")
+
+  (assert-t (numberp (cmdbuf-loc-match text test-dbgr)) "breakpoint location")
+  (assert-equal "7"
+             (match-string (realgud-cmdbuf-info-line-group test-dbgr)
+                           text) "extract line number from breakpoint"))
+
+(let ((text "Step completed: \"thread=main\", TestMe.main(), line=71 bci=0"))
+  (assert-t (numberp (cmdbuf-loc-match text test-dbgr)) "breakpoint location")
+  (assert-equal "71"
+               (match-string (realgud-cmdbuf-info-line-group test-dbgr)
+                             text) "extract line number from step"))
+
+;; (note "debugger-backtrace")
+;; (setq realgud-bt-pat  (gethash "debugger-backtrace"
+;;                         realgud:jdb-pat-hash))
+;; (setq s1
+;;       "  [1] java.lang.Class.getDeclaredMethods0 (native method)
+;;   [2] java.lang.Class.privateGetDeclaredMethods (Class.java:2,570)
+;;   [3] java.lang.Class.getMethod0 (Class.java:2,813)
+;;   [4] java.lang.Class.getMethod (Class.java:1,663)
+;;   [5] sun.launcher.LauncherHelper.getMainMethod (LauncherHelper.java:494)
+;;   [6] sun.launcher.LauncherHelper.checkAndLoadMain (LauncherHelper.java:486)
+;; ")
+;; (setq realgud-bt-re (realgud-loc-pat-regexp realgud-bt-pat))
+;; (setq file-group (realgud-loc-pat-file-group realgud-bt-pat))
+;; (setq line-group (realgud-loc-pat-line-group realgud-bt-pat))
+;; (assert-equal 0 (string-match realgud-bt-re s1))
+;; (assert-equal "570"
+;;           (substring s1
+;;                      (match-beginning line-group)
+;;                      (match-end line-group)))
+
+(end-tests)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]