branch: externals/realgud
commit 4c66076312b1f96b3d9dcf93ca27af41eaf36f44
Author: rocky <[email protected]>
Commit: rocky <[email protected]>
Start nodejs -> node debug rename...
node inspect: add "eval", fix "backtrace"
and remove up/down/frame
---
realgud.el | 16 ++++++++++++----
realgud/debugger/nodejs/core.el | 2 +-
realgud/debugger/nodejs/init.el | 30 ++++++++++++++++++++++++------
realgud/debugger/nodejs/nodejs.el | 11 ++++++++---
test/test-send.el | 7 ++++++-
5 files changed, 51 insertions(+), 15 deletions(-)
diff --git a/realgud.el b/realgud.el
index ff0e9cd..c9a5848 100644
--- a/realgud.el
+++ b/realgud.el
@@ -36,7 +36,7 @@
;; Once upon a time in an Emacs far far away and a programming-style
;; deservedly banished, there was a monolithic Cathederal-like
;; debugger front-end called gud. This interfaced with a number of
-;; debuggers, many now dead. Is there anyone still alive that
+;; debuggers, many now dead.[1] Is there anyone still alive that
;; remembers sdb from UNIX/32V circa 1980?
;;
;; This isn't that. Here we make use of more modern programming
@@ -49,13 +49,15 @@
;; Oh, and because global variables are largely banned, we can support
;; several simultaneous debug sessions.
-;; If you don't see your favorite debugger, see URL
+;; RealGUD supports many external debuggers. See URL
+;; `https://github.com/realgud/realgud/wiki/Debuggers-Supported' for a
+;; list. However, if you don't see your favorite debugger, see URL
;; `https://github.com/realgud/realgud/wiki/How-to-add-a-new-debugger/'
;; for how you can add your own.
;; The debugger is run out of a comint process buffer, or you can use
-;; a `realgud-track-mode' inside an existing comint shell, shell, or
-;; eshell buffer.
+;; a `realgud-track-mode' inside an existing comint shell, or eshell
+;; buffer.
;; To install you will need a couple of other Emacs packages
;; installed. If you install via melpa (`package-install') or
@@ -64,6 +66,12 @@
;; `https://github.com/realgud/realgud/wiki/How-to-Install' for all
;; the ways to to install and more details on installation.
+;; [1] Four or more years in, as of 2018 realgud sports a number of
+;; old debuggers too. However we *mark* them as such, and move them
+;; out of the main code base. See for example:
+;; https://github.com/realgud/realgud-old-debuggers. So that's
+;; another difference: this code better *maintained*.
+
;;; Code:
;; Press C-x C-e at the end of the next line configure the program in
diff --git a/realgud/debugger/nodejs/core.el b/realgud/debugger/nodejs/core.el
index f27b4ed..c60af97 100644
--- a/realgud/debugger/nodejs/core.el
+++ b/realgud/debugger/nodejs/core.el
@@ -126,7 +126,7 @@ Note that path elements have been expanded via
`expand-file-name'.
(defun realgud:nodejs-suggest-invocation (debugger-name)
"Suggest a nodejs command invocation via `realgud-suggest-invocaton'"
- (realgud-suggest-invocation (or debugger-name realgud:nodejs-command-name)
+ (realgud-suggest-invocation realgud:nodejs-command-name
realgud:nodejs-minibuffer-history
"js" "\\.js$"))
diff --git a/realgud/debugger/nodejs/init.el b/realgud/debugger/nodejs/init.el
index 70634af..14b23ac 100644
--- a/realgud/debugger/nodejs/init.el
+++ b/realgud/debugger/nodejs/init.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015-2016 Free Software Foundation, Inc
+;; Copyright (C) 2015-2016, 2018 Free Software Foundation, Inc
;; Author: Rocky Bernstein <[email protected]>
@@ -14,6 +14,10 @@
;; 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 code is obsolete. FIXME: Move into another repository
;;; Regular expressions for nodejs Javascript debugger.
(eval-when-compile (require 'cl-lib)) ;For setf.
@@ -45,7 +49,7 @@ realgud-loc-pat struct")
:file-group 1
:line-group 2))
-;; Regular expression that describes a nodejs command prompt
+;; Regular expression that describes a node-debug command prompt
;; For example:
;; debug>
(setf (gethash "prompt" realgud:nodejs-pat-hash)
@@ -84,7 +88,7 @@ realgud-loc-pat struct")
(defconst realgud:nodejs-frame-module-regexp "[^ \t\n]+")
(defconst realgud:nodejs-frame-file-regexp "[^ \t\n]+")
-;; Regular expression that describes a nodejs location generally shown
+;; 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
@@ -142,18 +146,28 @@ realgud-loc-pat struct")
(setf (gethash realgud:nodejs-debugger-name realgud-pat-hash)
realgud:nodejs-pat-hash)
+;; Prefix used in variable names (e.g. short-key-mode-map) for
+;; this debugger
+
+(setf (gethash "nodejs" realgud:variable-basename-hash)
+ "nodejs")
+
(defvar realgud:nodejs-command-hash (make-hash-table :test 'equal)
"Hash key is command name like 'finish' and the value is
the nodejs command to use, like 'out'")
-(setf (gethash "backtrace" realgud:nodejs-command-hash) "T")
+(setf (gethash realgud:nodejs-debugger-name
+ realgud-command-hash)
+ realgud:nodejs-command-hash)
+
+(setf (gethash "backtrace" realgud:nodejs-command-hash) "backtrace")
(setf (gethash "break" realgud:nodejs-command-hash)
"setBreakpoint('%X',%l)")
(setf (gethash "continue" realgud:nodejs-command-hash) "cont")
(setf (gethash "quit" realgud:nodejs-command-hash) "quit")
(setf (gethash "finish" realgud:nodejs-command-hash) "out")
(setf (gethash "shell" realgud:nodejs-command-hash) "repl")
-(setf (gethash "eval" realgud:nodejs-command-hash) "*not-implemented*")
+(setf (gethash "eval" realgud:nodejs-command-hash) "exec('%s')")
;; We need aliases for step and next because the default would
;; do step 1 and nodejs doesn't handle this. And if it did,
@@ -162,6 +176,10 @@ realgud-loc-pat struct")
(setf (gethash "next" realgud:nodejs-command-hash) "next")
;; Unsupported features:
-(setf (gethash "jump" realgud:nodejs-command-hash) "*not-implemented*")
+(setf (gethash "jump" realgud:nodejs-command-hash) "*not-implemented*")
+(setf (gethash "up" realgud:nodejs-command-hash) "*not-implemented*")
+(setf (gethash "down" realgud:nodejs-command-hash) "*not-implemented*")
+(setf (gethash "frame" realgud:nodejs-command-hash) "*not-implemented*")
+
(provide-me "realgud:nodejs-")
diff --git a/realgud/debugger/nodejs/nodejs.el
b/realgud/debugger/nodejs/nodejs.el
index 3670820..055d004 100644
--- a/realgud/debugger/nodejs/nodejs.el
+++ b/realgud/debugger/nodejs/nodejs.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc
+;; Copyright (C) 2014-2016, 2018 Free Software Foundation, Inc
;; Author: Free Software Foundation, Inc
@@ -76,7 +76,12 @@ fringe and marginal icons.
;; )
))
-;; There is already a nodejs command in `nodejs-repl'.
-;; (defalias 'nodejs 'realgud:nodejs)
+;; Note: There is already a nodejs command in `nodejs-repl'.
+
+;;;###autoload
+(defalias 'realgud:node-debug 'realgud:nodejs)
+
+;;;###autoload
+(defalias 'node-debug 'realgud:nodejs)
(provide-me "realgud-")
diff --git a/test/test-send.el b/test/test-send.el
index 580cfd5..5eec304 100644
--- a/test/test-send.el
+++ b/test/test-send.el
@@ -7,7 +7,12 @@
(load-file "../realgud/common/regexp.el")
(load-file "../realgud/debugger/trepan/init.el")
-(declare-function realgud-srcbuf-init 'realgud-buffer-source)
+(declare-function realgud-get-srcbuf 'realgud-buffer-source)
+(declare-function realgud-srcbuf-init 'realgud-buffer-source)
+(declare-function realgud-cmdbuf-init 'realgud-buffer-command)
+(declare-function realgud-command 'realgud-buffer-cmds)
+(declare-function realgud-expand-format 'realgud-send)
+
(test-simple-start)
(eval-when-compile