dbgr/debugger/rdebug/Makefile \
dbgr/debugger/remake/Makefile \
dbgr/debugger/trepan/Makefile \
+ dbgr/debugger/trepanpl/Makefile \
dbgr/debugger/trepanx/Makefile \
dbgr/debugger/trepan8/Makefile \
dbgr/debugger/zshdb/Makefile \
"./dbgr/debugger/rdebug/rdebug"
"./dbgr/debugger/remake/remake"
"./dbgr/debugger/trepan/trepan"
+ "./dbgr/debugger/trepanpl/trepanpl"
"./dbgr/debugger/trepanx/trepanx"
"./dbgr/debugger/trepan8/trepan8"
"./dbgr/debugger/zshdb/zshdb"
/Makefile
/Makefile.in
/elc-stamp
+/elc.*
(cond
((equal debugger-name "gdb") "dbgr-gdb")
((equal debugger-name "perldb") "dbgr-perldb")
+ ((equal debugger-name "trepanpl") "dbgr-trepanpl")
('t debugger-name)))
(specific-track-mode (intern (concat prefix "-track-mode")))
)
SUBDIRS = bashdb gdb kshdb perldb pydbgr rdebug remake \
- trepan trepanx trepan8 zshdb
+ trepan trepanpl trepanx trepan8 zshdb
EXTRA_DIST = common.mk
.PHONY: check all
For example for the following input
(map 'list 'symbol-name
- '(perl -W -C /tmp -d ./gcd.rb a b))
+ '(perl -W -C /tmp -d ./gcd.pl a b))
we might return:
- ((perl -W -C -d) (./gcd.rb a b))
+ ((perl -W -C -d) (./gcd.pl a b))
NOTE: the above should have each item listed in quotes.
"
;;; Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
-;;; Ruby "perldb" Debugger tracking a comint or eshell buffer.
+;;; Stock Perl Debugger "perldb5" tracking a comint or eshell buffer.
(eval-when-compile (require 'cl))
(require 'load-relative)
--- /dev/null
+/*.elc
+/*~
+/Makefile
+/Makefile.in
+/elc-stamp
--- /dev/null
+include $(srcdir)/../common.mk
--- /dev/null
+;;; Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
+
+;;; Mode for parsing various kinds of backtraces found in the Ruby
+
+(eval-when-compile (require 'cl))
+(require 'load-relative)
+(require-relative-list '(
+ "../../common/cmds"
+ "../../common/menu"
+ "../../common/backtrack-mode"
+ )
+ "dbgr-")
+(require-relative-list '("core" "init") "dbgr-trepanpl-")
+(require-relative-list '("../../lang/ruby") "dbgr-lang-")
+
+(dbgr-backtrack-mode-vars "trepanpl")
+(set-keymap-parent trepanpl-backtrack-mode-map dbgr-backtrack-mode-map)
+
+(declare-function dbgr-backtrack-mode(bool))
+
+(defun dbgr-trepanpl-goto-control-frame-line (pt)
+ "Display the location mentioned by a control-frame line
+described by PT."
+ (interactive "d")
+ (dbgr-goto-line-for-pt pt "control-frame"))
+
+(dbgr-ruby-populate-command-keys trepanpl-backtrack-mode-map)
+(define-key trepanpl-backtrack-mode-map
+ (kbd "C-c !c") 'dbgr-trepanpl-goto-control-frame-line)
+
+(define-minor-mode trepanpl-backtrack-mode
+ "Minor mode for tracking ruby debugging inside a file which may not have process shell."
+ :init-value nil
+ ;; :lighter " trepanpl" ;; mode-line indicator from dbgr-track is sufficient.
+ ;; The minor mode bindings.
+ :global nil
+ :group 'trepanpl
+ :keymap trepanpl-backtrack-mode-map
+
+ (dbgr-backtrack-set-debugger "trepanpl")
+ (if trepanpl-backtrack-mode
+ (progn
+ (dbgr-backtrack-mode 't)
+ (run-mode-hooks (intern (trepanpl-backtrack-mode-hook))))
+ (progn
+ (dbgr-backtrack-mode nil)
+ ))
+)
+
+(defun trepanpl-backtrack-mode-hook()
+ (if trepanpl-backtrack-mode
+ (progn
+ (use-local-map trepanpl-backtrack-mode-map)
+ (message "using trepanpl mode map")
+ )
+ (message "trepanpl backtrack-mode-hook disable called"))
+)
+
+(provide-me "dbgr-trepanpl-")
--- /dev/null
+;;; Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
+(eval-when-compile (require 'cl))
+
+(require 'load-relative)
+(require-relative-list '("../../common/track"
+ "../../common/core"
+ "../../common/lang")
+ "dbgr-")
+(require-relative-list '("init") "dbgr-trepanpl-")
+
+;; FIXME: I think the following could be generalized and moved to
+;; dbgr-... probably via a macro.
+(defvar trepanpl-minibuffer-history nil
+ "minibuffer history list for the command `trepanpl'.")
+
+(easy-mmode-defmap dbgr-trepanpl-minibuffer-local-map
+ '(("\C-i" . comint-dynamic-complete-filename))
+ "Keymap for minibuffer prompting of trepanpl 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 dbgr-trepanpl-query-cmdline (&optional opt-debugger)
+ (dbgr-query-cmdline
+ 'dbgr-trepanpl-suggest-invocation
+ dbgr-trepanpl-minibuffer-local-map
+ 'dbgr-trepanpl-minibuffer-history
+ opt-debugger))
+
+(defun dbgr-trepanpl-parse-cmd-args (orig-args)
+ "Parse command line ARGS for the annotate level and name of script to debug.
+
+ARGS should contain a tokenized list of the command line to run.
+
+We return the a list containing
+
+- the command processor (e.g. perl) and it's arguments if any - a
+ list of strings
+
+- the script name and its arguments - list of strings
+
+For example for the following input
+ (map 'list 'symbol-name
+ '(perl5.10 -W -C /tmp trepanpl --emacs ./gcd.pl a b))
+
+we might return:
+ ((perl -W -C) (trepanpl --emacs) (./gcd.pl a b) 't)
+
+NOTE: the above should have each item listed in quotes.
+"
+
+ ;; Parse the following kind of pattern:
+ ;; [perl perl-options] trepanpl trepanpl-options script-name script-options
+ (let (
+ (args orig-args)
+ (pair) ;; temp return from
+ (perl-opt-two-args '("0" "C" "D" "i" "l" "m" "-module" "x"))
+ ;; Perl doesn't have mandatory 2-arg options in our sense,
+ ;; since the two args can be run together, e.g. "-C/tmp" or "-C /tmp"
+ ;;
+ (perl-two-args '())
+ ;; One dash is added automatically to the below, so
+ ;; h is really -h and -host is really --host.
+ (trepanpl-two-args '("h" "-host" "p" "-port"
+ "I" "-include"))
+ (trepanpl-opt-two-args '())
+ (interp-regexp
+ (if (member system-type (list 'windows-nt 'cygwin 'msdos))
+ "^perl\\(?:5[0-9.]*\\)\\(.exe\\)?$"
+ "^perl\\(?:5[0-9.]*\\)?$"))
+
+ ;; Things returned
+ (script-name nil)
+ (debugger-name nil)
+ (interpreter-args '())
+ (debugger-args '())
+ (script-args '())
+ (annotate-p nil))
+
+ (if (not (and args))
+ ;; Got nothing: return '(nil, nil)
+ (list interpreter-args debugger-args script-args annotate-p)
+ ;; else
+ ;; Strip off optional "perl" or "perl5.10.1" etc.
+ (when (string-match interp-regexp
+ (file-name-sans-extension
+ (file-name-nondirectory (car args))))
+ (setq interpreter-args (list (pop args)))
+
+ ;; Strip off optional "perl" or "perl5.10.1" etc.
+ (while (and args
+ (string-match "^-" (car args)))
+ (setq pair (dbgr-parse-command-arg
+ args perl-two-args perl-opt-two-args))
+ (nconc interpreter-args (car pair))
+ (setq args (cadr pair))))
+
+ (list interpreter-args args))
+ ))
+
+; # To silence Warning: reference to free variable
+(defvar dbgr-trepanpl-command-name)
+
+(defun dbgr-trepanpl-suggest-invocation (debugger-name)
+ "Suggest a trepanpl command invocation via `dbgr-suggest-invocaton'"
+ (dbgr-suggest-invocation dbgr-trepanpl-command-name
+ trepanpl-minibuffer-history
+ "perl" "\\.pl$"))
+
+(defun dbgr-trepanpl-reset ()
+ "Trepanpl cleanup - remove debugger's internal buffers (frame,
+breakpoints, etc.)."
+ (interactive)
+ ;; (trepanpl-breakpoint-remove-all-icons)
+ (dolist (buffer (buffer-list))
+ (when (string-match "\\*trepanpl-[a-z]+\\*" (buffer-name buffer))
+ (let ((w (get-buffer-window buffer)))
+ (when w
+ (delete-window w)))
+ (kill-buffer buffer))))
+
+;; (defun trepanpl-reset-keymaps()
+;; "This unbinds the special debugger keys of the source buffers."
+;; (interactive)
+;; (setcdr (assq 'trepanpl-debugger-support-minor-mode minor-mode-map-alist)
+;; trepanpl-debugger-support-minor-mode-map-when-deactive))
+
+
+(defun dbgr-trepanpl-customize ()
+ "Use `customize' to edit the settings of the `trepanpl' debugger."
+ (interactive)
+ (customize-group 'dbgr-trepanpl))
+
+(provide-me "dbgr-trepanpl-")
--- /dev/null
+;;; Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
+;;; Trepanning Perl debugger
+(eval-when-compile (require 'cl))
+
+(require 'load-relative)
+(require-relative-list '("../../common/regexp"
+ "../../common/loc"
+ "../../common/init")
+ "dbgr-")
+
+(defvar dbgr-pat-hash)
+(declare-function make-dbgr-loc-pat (dbgr-loc))
+
+(defvar dbgr-trepanpl-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
+dbgr-loc-pat struct")
+
+;; Regular expression that describes a trepanpl location generally shown
+;; before a command prompt.
+;; For example:
+;; -- (/tmp/linecache.pl:64)
+;; C> (/tmp/eval.pl:2)
+(setf (gethash "loc" dbgr-trepanpl-pat-hash)
+ (make-dbgr-loc-pat
+ :regexp ".. (\\(?:.+ \\(?:via\\|remapped\\) \\)?\\(.+\\):\\([0-9]+\\)\\(?: @[0-9]+\\)?)"
+ :file-group 1
+ :line-group 2))
+
+;; Regular expression that describes a trepanpl command prompt
+;; For example:
+;; (trepanpl):
+;; ((trepanpl)):
+;; (trepanpl@main):
+;; (trepanpl@55):
+(setf (gethash "prompt" dbgr-trepanpl-pat-hash)
+ (make-dbgr-loc-pat
+ :regexp "^(+trepanpl\\(@[0-9]+\\|@main\\)?)+: "
+ ))
+
+;; Regular expression that describes a Ruby YARV 1.9 backtrace line.
+;; For example:
+;; <internal:lib/rubygems/custom_require>:29:in `require'
+;; <internal:lib/rubygems/custom_require>:29:in `require'
+;; /tmp/Rakefile:50:in `<top /src/external-vcs/laser/Rakefile>'
+;; from /usr/lib/ruby/gems/rspec/compatibility.pl:6:in `const_missing'
+(setf (gethash "lang-backtrace" dbgr-trepanpl-pat-hash)
+ (make-dbgr-loc-pat
+ :regexp "^\\(?:[\t]from \\)?\\([^:]+\\):\\([0-9]+\\)\\(?:in `.*'\\)?"
+ :file-group 1
+ :line-group 2))
+
+;; Regular expression that describes a "breakpoint set" line.
+;; For example:
+;; Breakpoint 1 set at VM offset 2 of instruction sequence "require",
+;; line 29 in file <internal:lib/rubygems/custom_require>.
+;; Breakpoint 2 set at VM offset 29 of instruction sequence "<top /xx.pl>",
+;; line 64 in file /src/external-vcs/linecache/trunk/lib/linecache.pl.
+(setf (gethash "brkpt-set" dbgr-trepanpl-pat-hash)
+ (make-dbgr-loc-pat
+ :regexp "^Breakpoint \\([0-9]+\\) set at .*[\n\t ]+line \\([0-9]+\\)[ \t\n]+in file \\(.+\\)."
+ :num 1
+ :file-group 3
+ :line-group 2))
+
+;; Regular expression that describes a debugger "delete" (breakpoint) response.
+;; For example:
+;; Deleted breakpoint 1.
+(setf (gethash "brkpt-del" dbgr-trepanpl-pat-hash)
+ (make-dbgr-loc-pat
+ :regexp "^Deleted breakpoint \\([0-9]+\\)\n"
+ :num 1))
+
+(defconst dbgr-trepanpl-selected-frame-indicator "-->"
+"String that describes which frame is selected in a debugger
+backtrace listing.")
+
+(defconst dbgr-trepanpl-frame-file-regexp
+ "[ \t\n]+in file \\([^ \n]+\\)")
+
+(defconst dbgr-trepanpl-debugger-name "trepanpl" "Name of debugger")
+
+;; Top frame number
+(setf (gethash "top-frame-num" dbgr-trepanpl-pat-hash) 0)
+
+;; Regular expression that describes a debugger "selected" frame in in
+;; a frame-motion command.
+;; For example:
+;; --> #1 TOP Object#<top /usr/local/bin/irb> in file /usr/local/bin/ipl at line 9
+(setf (gethash "selected-frame" dbgr-trepanpl-pat-hash)
+ (make-dbgr-loc-pat
+ :regexp
+ (format "^%s #\\([0-9]+\\) .*%s"
+ dbgr-trepanpl-selected-frame-indicator
+ dbgr-trepanpl-frame-file-regexp)
+ :num 1))
+
+;; Regular expression that for a termination message.
+(setf (gethash "termination" dbgr-trepanpl-pat-hash)
+ "^trepanpl: That's all, folks...\n")
+
+(setf (gethash "font-lock-keywords" dbgr-trepanpl-pat-hash)
+ '(
+ ;; The frame number and first type name, if present.
+ ("^\\(-->\\| \\)? #\\([0-9]+\\) \\([A-Z]+\\) *\\([A-Z_][a-zA-Z0-9_]*\\)[#]\\([a-zA-Z_][a-zA-Z_[0-9]]*\\)?"
+ (2 dbgr-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 dbgr-file-name-face))
+ ;; Line number.
+ ("[ \t]+at line \\([0-9]+\\)$"
+ (1 dbgr-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))
+ ;; (trepanpl-frames-match-current-line
+ ;; (0 trepanpl-frames-current-frame-face append))
+ ))
+
+;; (setf (gethash "font-lock-keywords" dbgr-trepanpl-pat-hash)
+;; '(
+;; ;; The frame number and first type name, if present.
+;; ((concat dbgr-trepanpl-frame-start-regexp " "
+;; dbgr-trepanpl-frame-num-regexp " "
+;; "\\([A-Z]+\\) *\\([A-Z_][a-zA-Z0-9_]*\\)[#]\\([a-zA-Z_][a-zA-Z_[0-9]]*\\)?")
+;; (2 dbgr-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.
+;; (dbgr-trepanpl-frame-file-regexp (1 dbgr-file-name-face))
+;; ;; Line number.
+;; (dbgr-trepanpl-frame-line-regexp (1 dbgr-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))
+;; ;; (trepanpl-frames-match-current-line
+;; ;; (0 trepanpl-frames-current-frame-face append))
+;; ))
+
+(setf (gethash dbgr-trepanpl-debugger-name dbgr-pat-hash) dbgr-trepanpl-pat-hash)
+
+(defvar dbgr-trepanpl-command-hash (make-hash-table :test 'equal)
+ "Hash key is command name like 'quit' and the value is
+ the trepanpl command to use, like 'quit!'")
+
+(setf (gethash "quit" dbgr-trepanpl-command-hash) "quit!")
+(setf (gethash dbgr-trepanpl-debugger-name
+ dbgr-command-hash) dbgr-trepanpl-command-hash)
+
+(provide-me "dbgr-trepanpl-")
--- /dev/null
+;;; Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
+;;; Perl trepanning Debugger tracking a comint or eshell buffer.
+
+(eval-when-compile (require 'cl))
+(require 'load-relative)
+(require-relative-list '(
+ "../../common/cmds"
+ "../../common/menu"
+ "../../common/track"
+ "../../common/track-mode"
+ )
+ "dbgr-")
+(require-relative-list '("core" "init") "dbgr-trepanpl-")
+
+(dbgr-track-mode-vars "dbgr-trepanpl")
+
+(declare-function dbgr-track-mode(bool))
+
+(defun dbgr-trepanpl-goto-syntax-error-line (pt)
+ "Display the location mentioned in a Syntax error line
+described by PT."
+ (interactive "d")
+ (dbgr-goto-line-for-pt pt "syntax-error"))
+
+(define-key dbgr-trepanpl-track-mode-map
+ (kbd "C-c !s") 'dbgr-trepanpl-goto-syntax-error-line)
+
+(defun dbgr-trepanpl-track-mode-hook()
+ (if dbgr-trepanpl-track-mode
+ (progn
+ (use-local-map dbgr-trepanpl-track-mode-map)
+ (message "using trepanpl mode map")
+ )
+ (message "trepanpl track-mode-hook disable called"))
+)
+
+(define-minor-mode dbgr-trepanpl-track-mode
+ "Minor mode for tracking Perl debugging inside a process shell."
+ :init-value nil
+ ;; :lighter " trepanpl" ;; mode-line indicator from dbgr-track is sufficient.
+ ;; The minor mode bindings.
+ :global nil
+ :group 'trepanpl
+ :keymap dbgr-trepanpl-track-mode-map
+
+ (dbgr-track-set-debugger "trepanpl")
+ (if dbgr-trepanpl-track-mode
+ (progn
+ (dbgr-track-mode 't)
+ (run-mode-hooks (intern (dbgr-trepanpl-track-mode-hook))))
+ (progn
+ (dbgr-track-mode nil)
+ ))
+)
+
+(provide-me "dbgr-trepanpl-")
--- /dev/null
+;;; Copyright (C) 2010, 2011 Rocky Bernstein <rocky@gnu.org>
+;; `trepanpl' Main interface to trepanpl via Emacs
+(require 'load-relative)
+(require-relative-list '("../../common/helper") "dbgr-")
+(require-relative-list '("../../common/track") "dbgr-")
+(require-relative-list '("core" "track-mode") "dbgr-trepanpl-")
+;; This is needed, or at least the docstring part of it is needed to
+;; get the customization menu to work in Emacs 23.
+(defgroup trepanpl nil
+ "The Ruby 1.9.2 \"trepanning\" debugger"
+ :group 'processes
+ :group 'ruby
+ :group 'dbgr
+ :version "23.1")
+
+;; -------------------------------------------------------------------
+;; User definable variables
+;;
+
+(defcustom trepan-command-name
+ ;;"trepanpl --emacs 3"
+ "trepanpl"
+ "File name for executing the Ruby debugger and command options.
+This should be an executable on your path, or an absolute file name."
+ :type 'string
+ :group 'trepanpl)
+
+;; -------------------------------------------------------------------
+;; The end.
+;;
+
+;;;###autoload
+(defun dbgr-trepanpl (&optional opt-command-line no-reset)
+ "Invoke the trepanpl Ruby debugger and start the Emacs user interface.
+
+String COMMAND-LINE specifies how to run trepanpl.
+
+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."
+ (interactive)
+ (let* ((cmd-str (or opt-command-line
+ (dbgr-trepanpl-query-cmdline "trepanpl")))
+ (cmd-args (split-string-and-unquote cmd-str))
+ (parsed-args (dbgr-trepanpl-parse-cmd-args cmd-args))
+ (script-args (cdr cmd-args))
+ (script-name (car script-args))
+ (cmd-buf
+ (dbgr-run-process "trepanpl" script-name cmd-args
+ 'trepanpl-track-mode no-reset)
+ ))
+ ))
+
+(defalias 'trepanpl 'dbgr-trepanpl)
+(provide-me "dbgr-")
+;;; trepanpl.el ends here