[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bd45ec9 023/215: backtrace.el: fix some bugs and remove so
From: |
Rocky Bernstein |
Subject: |
[elpa] master bd45ec9 023/215: backtrace.el: fix some bugs and remove some warnings |
Date: |
Sat, 30 Jul 2016 14:48:49 +0000 (UTC) |
branch: master
commit bd45ec939c37cbf0f8239c9d63b6f20ca8748608
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
backtrace.el: fix some bugs and remove some warnings
posix-shell.el: remove python constants
nodejs/init.el Add backtrace regexp to nodejs
Add more FSF copyrights
---
realgud/common/attach.el | 17 +++++-
realgud/common/backtrack-mode.el | 26 +++++++--
realgud/common/buffer/backtrace.el | 4 +-
realgud/common/track.el | 5 +-
realgud/debugger/bashdb/bashdb.el | 18 +++++-
realgud/debugger/nodejs/core.el | 18 +++++-
realgud/debugger/nodejs/init.el | 54 +++++++++++++-----
realgud/lang/posix-shell.el | 9 ---
test/test-loc-regexp-nodejs.el | 109 ++++++++++++++++++++++++++++++++++++
test/test-regexp-nodejs.el | 14 +++++
10 files changed, 240 insertions(+), 34 deletions(-)
diff --git a/realgud/common/attach.el b/realgud/common/attach.el
index 32734b0..f0efbff 100644
--- a/realgud/common/attach.el
+++ b/realgud/common/attach.el
@@ -1,4 +1,19 @@
-;;; Copyright (C) 2014 Rocky Bernstein <address@hidden>
+;; Copyright (C) 2015 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/>.
;;; Emacs Commands to associate or attach a source buffer to a command
;;; buffer and vice versa.
diff --git a/realgud/common/backtrack-mode.el b/realgud/common/backtrack-mode.el
index 46ef27c..9fe1157 100644
--- a/realgud/common/backtrack-mode.el
+++ b/realgud/common/backtrack-mode.el
@@ -1,8 +1,24 @@
-;;; Copyright (C) 2011, 2013, 2014 Rocky Bernstein <address@hidden>
-;;; Used to parse programming-language backtrace-like tracks
-;;; output. In contrast to track-mode, there doesn't have to be a
-;;; process shell arround Compare with backtrace-mode.el which
-;;; handles backtraces inside the debugger
+;; Copyright (C) 2015 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/>.
+
+;; Used to parse programming-language backtrace-like tracks
+;; output. In contrast to track-mode, there doesn't have to be a
+;; process shell arround Compare with backtrace-mode.el which
+;; handles backtraces inside the debugger
(eval-when-compile (require 'cl))
(require 'shell)
diff --git a/realgud/common/buffer/backtrace.el
b/realgud/common/buffer/backtrace.el
index 08a3faa..98b1ec5 100644
--- a/realgud/common/buffer/backtrace.el
+++ b/realgud/common/buffer/backtrace.el
@@ -22,6 +22,8 @@
;; along with this program. If not, see
;; <http://www.gnu.org/licenses/>.
+(require 'ansi-color)
+(require 'ring)
(require 'load-relative)
(eval-when-compile (require 'cl-lib))
(require-relative-list
@@ -142,7 +144,7 @@
(if divert-string
(let* ((triple
(realgud:backtrace-add-text-properties
- frame-pat cmdbuf indicator-re))
+ frame-pat cmdbuf divert-string indicator-re))
(string-with-props
(ansi-color-filter-apply (car triple)))
(frame-num-pos-list (caddr triple))
diff --git a/realgud/common/track.el b/realgud/common/track.el
index a087615..f6dc1f5 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -103,7 +103,10 @@ marks set in buffer-local variables to extract text"
(curr-proc (get-buffer-process cmd-buff))
(cmdbuf-last-output-end
(realgud-cmdbuf-info-last-input-end realgud-cmdbuf-info))
- (last-output-end (process-mark curr-proc))
+ (last-output-end
+ (if curr-proc
+ (process-mark curr-proc)
+ cmdbuf-last-output-end))
(last-output-start (max comint-last-input-start
(- last-output-end
realgud-track-char-range))))
;; Sometimes we get called twice and the second time nothing
diff --git a/realgud/debugger/bashdb/bashdb.el
b/realgud/debugger/bashdb/bashdb.el
index d8d10a9..81324de 100644
--- a/realgud/debugger/bashdb/bashdb.el
+++ b/realgud/debugger/bashdb/bashdb.el
@@ -1,4 +1,20 @@
-;;; Copyright (C) 2011, 2013-2015 Rocky Bernstein <address@hidden>
+;; Copyright (C) 2015 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/>.
+
;; `bashdb' Main interface to bashdb via Emacs
(require 'list-utils)
(require 'load-relative)
diff --git a/realgud/debugger/nodejs/core.el b/realgud/debugger/nodejs/core.el
index 9cc5aa2..cc09972 100644
--- a/realgud/debugger/nodejs/core.el
+++ b/realgud/debugger/nodejs/core.el
@@ -1,4 +1,20 @@
-;;; Copyright (C) 2014 Rocky Bernstein <address@hidden>
+;; Copyright (C) 2015 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/>.
+
(eval-when-compile (require 'cl))
(require 'load-relative)
diff --git a/realgud/debugger/nodejs/init.el b/realgud/debugger/nodejs/init.el
index 66ad725..25c7e27 100644
--- a/realgud/debugger/nodejs/init.el
+++ b/realgud/debugger/nodejs/init.el
@@ -1,4 +1,19 @@
-;;; Copyright (C) 2014 Rocky Bernstein <address@hidden>
+;; Copyright (C) 2015 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/>.
;;; Regular expressions for nodejs Javascript debugger.
(eval-when-compile (require 'cl))
@@ -18,9 +33,16 @@
backtrace, prompt, etc. The values of a hash entry is a
realgud-loc-pat struct")
-(defvar realgud:nodejs-term-escape "[[0-9]+[GKJ]"
+(defconst realgud:nodejs-term-escape "[[0-9]+[GKJ]"
"Escape sequence regular expression pattern nodejs often puts in around
prompts")
+(defconst realgud:nodejs-frame-start-regexp "\\(?:^\\|\n\\)\\(?:#\\)")
+(defconst realgud:nodejs-frame-num-regexp "\\([0-9]+\\)")
+(defconst realgud:nodejs-frame-module-regexp "[^ \t\n]+")
+(defconst realgud:nodejs-frame-file-regexp "[^ \t\n]+")
+(defconst realgud:nodejs-frame-line-regexp realgud:nodejs-frame-num-regexp)
+(defconst realgud:nodejs-frame-column-regexp realgud:nodejs-frame-num-regexp)
+
;; Regular expression that describes a nodejs location generally shown
;; before a command prompt.
;; For example:
@@ -66,19 +88,21 @@ realgud-loc-pat struct")
;; #5 Module._load module.js:312:12
;; #6 Module.runMain module.js:497:10
; ;#7 timers.js:110:15
-
-;; (setf (gethash "debugger-backtrace" realgud:nodejs-pat-hash)
-;; (make-realgud-loc-pat
-;; :regexp (concat realgud-shell-frame-start-regexp
-;; realgud-shell-frame-num-regexp "[ ]?"
-;; "\\(.*\\)"
-;; realgud-shell-frame-file-regexp
-;; "\\(?:" realgud-shell-frame-line-regexp "\\)?"
-;; )
-;; :num 2
-;; :file-group 4
-;; :line-group 5)
-;; )
+(setf (gethash "debugger-backtrace" realgud:nodejs-pat-hash)
+ (make-realgud-loc-pat
+ :regexp (concat realgud:nodejs-frame-start-regexp
+ realgud:nodejs-frame-num-regexp " "
+ "\\(?:" realgud:nodejs-frame-module-regexp " \\)?"
+ "\\(" realgud:nodejs-frame-file-regexp "\\)"
+ ":"
+ realgud:nodejs-frame-line-regexp
+ ":"
+ realgud:nodejs-frame-column-regexp
+ )
+ :num 1
+ :file-group 2
+ :line-group 3
+ :char-offset-group 4))
;; ;; Regular expression that for a termination message.
;; (setf (gethash "termination" realgud:nodejs-pat-hash)
diff --git a/realgud/lang/posix-shell.el b/realgud/lang/posix-shell.el
index a3fdc7e..3cbc51a 100644
--- a/realgud/lang/posix-shell.el
+++ b/realgud/lang/posix-shell.el
@@ -40,15 +40,6 @@ traceback) line." )
(define-key map (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
)
-
-;; Patterns common to the my POSIX shell debuggers
-
-(defconst realgud:python-trepan-frame-start-regexp
- "\\(?:^\\|\n\\)\\(->\\|##\\)")
-
-(defconst realgud:python-trepan-frame-num-regexp
- "\\([0-9]+\\)")
-
;; Regular expression that describes a bashdb/zshdb location generally shown
;; before a command prompt.
;; For example:
diff --git a/test/test-loc-regexp-nodejs.el b/test/test-loc-regexp-nodejs.el
new file mode 100644
index 0000000..0f17553
--- /dev/null
+++ b/test/test-loc-regexp-nodejs.el
@@ -0,0 +1,109 @@
+(load-file "./regexp-helper.el")
+(load-file "../realgud/common/regexp.el")
+(load-file "../realgud/debugger/nodejs/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)
+
+(test-simple-start)
+
+(eval-when-compile
+ (defvar file-group)
+ (defvar frame-re)
+ (defvar line-group)
+ (defvar num-group)
+ (defvar test-pos)
+ (defvar dbg-name)
+ (defvar realgud-pat-hash)
+ (defvar loc-pat)
+ (defvar test-dbgr)
+ (defvar test-s1)
+ (defvar realgud-pat-bt)
+ (defvar realgud:trepanpl-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-regexp-nodejs.el b/test/test-regexp-nodejs.el
index c1f4064..f05fd8a 100644
--- a/test/test-regexp-nodejs.el
+++ b/test/test-regexp-nodejs.el
@@ -10,6 +10,9 @@
(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 make-realgud-cmdbuf-info 'realgud-regexp)
+(declare-function realgud-cmdbuf-info-file-group 'realgud-regexp)
+(declare-function realgud-cmdbuf-info-line-group 'realgud-regexp)
(declare-function __FILE__ 'load-relative)
(test-simple-start)
@@ -17,11 +20,13 @@
(eval-when-compile
(defvar dbg-name)
(defvar loc-pat)
+ (defvar bt-pat)
(defvar prompt-pat)
(defvar realgud:nodejs-pat-hash)
(defvar realgud-pat-hash)
(defvar test-dbgr)
(defvar test-text)
+ (defvar test-s1)
)
(note "nodejs prompt matching")
@@ -54,4 +59,13 @@
(realgud-cmdbuf-info-line-group test-dbgr)
test-text) "extract line number")
+(note "debugger-backtrace")
+(set (make-local-variable 'test-s1)
+ "#0 module.js:380:17
+")
+
+(set (make-local-variable
+ 'bt-pat)
+ (gethash "debugger-backtrace" realgud:nodejs-pat-hash))
+
(end-tests)
- [elpa] master bfa52c5 046/215: caddr -> cl-caddr. Fill in %s on format., (continued)
- [elpa] master bfa52c5 046/215: caddr -> cl-caddr. Fill in %s on format., Rocky Bernstein, 2016/07/30
- [elpa] master 0a1dbc4 036/215: Remove node asci schmutz. put in lang/js.el, Rocky Bernstein, 2016/07/30
- [elpa] master 74eedc2 030/215: Start js lang. add js backtrace regexp, Rocky Bernstein, 2016/07/30
- [elpa] master 6df0f6a 051/215: trepanjs location format has changed, Rocky Bernstein, 2016/07/30
- [elpa] master bbab251 048/215: gdb: DRY captured number uses., Rocky Bernstein, 2016/07/30
- [elpa] master be999ea 054/215: trepanjs backtrace format changes next release, Rocky Bernstein, 2016/07/30
- [elpa] master 5078d4e 056/215: Doc gdb regexp more., Rocky Bernstein, 2016/07/30
- [elpa] master 0664fb9 037/215: trepanjs/init.el: handle newly added fully-qualified paths, Rocky Bernstein, 2016/07/30
- [elpa] master e5d0f95 057/215: Fix typo poined out by dfelch., Rocky Bernstein, 2016/07/30
- [elpa] master 071b66c 052/215: DRY gub init captured numbered re's., Rocky Bernstein, 2016/07/30
- [elpa] master bd45ec9 023/215: backtrace.el: fix some bugs and remove some warnings,
Rocky Bernstein <=
- [elpa] master 8e1ef01 047/215: core.el: correct trepanjs options, Rocky Bernstein, 2016/07/30
- [elpa] master 3a84860 040/215: DRY realgud:regexp-capture-num and add more FSF copyrights, Rocky Bernstein, 2016/07/30
- [elpa] master aa3125d 041/215: posix-shell.el: sometimes I can't use (format), Rocky Bernstein, 2016/07/30
- [elpa] master 2598619 039/215: init.el: bracketed short name is optional, Rocky Bernstein, 2016/07/30
- [elpa] master e554cad 027/215: Add trepanjs, Rocky Bernstein, 2016/07/30
- [elpa] master ba7a8b1 045/215: bang on trepanjs and nodejs., Rocky Bernstein, 2016/07/30
- [elpa] master 5f664e2 055/215: Python trepan debuggers include instruction offset in location, Rocky Bernstein, 2016/07/30
- [elpa] master a4f3509 058/215: Add realgud:pdb-remote for remote kinds of pdb execution, e.g. telnet, Rocky Bernstein, 2016/07/30
- [elpa] master 1790056 059/215: Typo: Issue #45, Rocky Bernstein, 2016/07/30
- [elpa] master a016c6f 050/215: Administrivia, Rocky Bernstein, 2016/07/30