(require 'load-relative)
(require-relative-list '("../regexp" "../loc") "dbgr-")
+(require-relative-list '("../../lang/perl") "dbgr-lang-")
(defvar dbgr-pat-hash)
(declare-function make-dbgr-loc-pat (dbgr-loc))
:file-group 1
:line-group 2))
+;; Regular expression that describes location in a Perl errmsg
+(setf (gethash "perl-errmsg" dbgr-perldb-pat-hash)
+ dbgr-perl-errmsg-loc-pat)
+
;; Regular expression that describes a Perl Carp backtrace line.
;; at /tmp/foo.pl line 7
;; main::__ANON__('Illegal division by zero at /tmp/foo.pl line 4.\x{a}') called at /tmp/foo.pl line 4
;; main::foo(3) called at /tmp/foo.pl line 8
-2
-(setf (gethash "lang-backtrace" dbgr-perldb-pat-hash)
- (make-dbgr-loc-pat
- :regexp (concat
- "\\(?:^\\|
-\\)"
- "\\(?:[ \t]+\\(?:\\|.* called \\)at \\(.*\\) line \\([0-9]+\\)\\)")
- :file-group 1
- :line-group 2))
+(setf (gethash "lang-backtrace" dbgr-perldb-pat-hash)
+ dbgr-perl-carp-loc-pat)
(defvar dbgr-perldb-command-hash (make-hash-table :test 'equal)
"Hash key is command name like 'quit' and the value is
(dbgr-track-mode-vars "dbgr-perldb")
(declare-function dbgr-track-mode(bool))
-
-(define-key dbgr-perldb-track-mode-map
- (kbd "C-c !!") 'dbgr-goto-lang-backtrace-line)
-(define-key dbgr-perldb-track-mode-map
- (kbd "C-c !b") 'dbgr-goto-debugger-backtrace-line)
+(dbgr-perl-populate-command-keys dbgr-perldb-track-mode-map )
;; Perldb doesn't have stack switching commands.
(define-key dbgr-perldb-short-key-mode-map
"../../common/loc"
"../../common/init")
"dbgr-")
+(require-relative-list '("../../lang/perl") "dbgr-lang-")
(defvar dbgr-pat-hash)
(declare-function make-dbgr-loc-pat (dbgr-loc))
:regexp "^(+trepanpl\\(@[0-9]+\\|@main\\)?)+: "
))
-;; Regular expression that describes a Ruby YARV 1.9 backtrace line.
+;; Regular expression that describes a Perl 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)
+;; $ = main::top_navigation_panel called from file `./latex2html' line 7400
+;; $ = main::BEGIN() called from file `(eval 19)[/usr/bin/latex2html:126]' line 2
+(setf (gethash "debugger-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 location in a Perl errmsg
+(setf (gethash "perl-errmsg" dbgr-trepanpl-pat-hash)
+ dbgr-perl-errmsg-loc-pat)
+
+;; Regular expression that describes a Perl Carp backtrace line.
+;; at /tmp/foo.pl line 7
+;; main::__ANON__('Illegal division by zero at /tmp/foo.pl line 4.\x{a}') called at /tmp/foo.pl line 4
+;; main::foo(3) called at /tmp/foo.pl line 8
+(setf (gethash "lang-backtrace" dbgr-trepanpl-pat-hash)
+ dbgr-perl-carp-loc-pat)
+
;; Regular expression that describes a "breakpoint set" line.
;; For example:
;; Breakpoint 1 set at VM offset 2 of instruction sequence "require",
(define-key dbgr-trepanpl-track-mode-map
(kbd "C-c !s") 'dbgr-trepanpl-goto-syntax-error-line)
+(dbgr-perl-populate-command-keys dbgr-trepanpl-track-mode-map)
+
(defun dbgr-trepanpl-track-mode-hook()
(if dbgr-trepanpl-track-mode
(progn
--- /dev/null
+;;; Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org>
+;;; Common Perl constants and regular expressions.
+(eval-when-compile (require 'cl))
+
+(require 'load-relative)
+(require-relative-list '("../common/regexp" "../common/loc" "../common/track")
+ "dbgr-")
+
+
+;; Regular expression that describes a Perl Carp backtrace line.
+;; at /tmp/foo.pl line 7
+;; main::__ANON__('Illegal division by zero at /tmp/foo.pl line 4.\x{a}') called at /tmp/foo.pl line 4
+;; main::foo(3) called at /tmp/foo.pl line 8
+(defconst dbgr-perl-carp-loc-pat
+ (make-dbgr-loc-pat
+ :regexp (concat
+ "\\(?:^\\|
+\\)"
+ "\\(?:[ \t]+\\(?:\\|.* called \\)at \\(.*\\) line \\([0-9]+\\)\\)")
+ :file-group 1
+ :line-group 2)
+ "A dbgr-loc-pat struct that describes a line used in a Carp message" )
+
+(defconst dbgr-perl-errmsg-loc-pat
+ (make-dbgr-loc-pat
+ :regexp (concat
+ " at \\(.+\\) line \\([0-9]+\\).$")
+ :file-group 1
+ :line-group 2)
+ "A dbgr-loc-pat struct that describes a line used in an error message" )
+
+;; FIXME: there is probably a less redundant way to do the following
+;; FNS.
+(defun dbgr-perl-goto-errmsg-line (pt)
+ "Display the location mentioned by the Perl error message described by PT."
+ (interactive "d")
+ (dbgr-goto-line-for-pt pt "perl-errmsg"))
+
+(defun dbgr-perl-populate-command-keys (&optional map)
+ "Bind the debugger function key layout used by many debuggers.
+
+\\{dbgr-example-map-standard}"
+ (define-key map (kbd "C-c !b") 'dbgr-goto-debugger-backtrace-line)
+ (define-key map (kbd "C-c !!") 'dbgr-goto-lang-backtrace-line)
+ (define-key map (kbd "C-c !e") 'dbgr-perl-goto-errmsg-line)
+ )
+
+(provide-me "dbgr-lang-")
dbgr-perldb-pat-hash))
(setq s1
"$ = main::top_navigation_panel called from file `./latex2html' line 7400
-")
+p")
(setq dbgr-bt-re (dbgr-loc-pat-regexp dbgr-bt-pat))
(setq file-group (dbgr-loc-pat-file-group dbgr-bt-pat))
(setq line-group (dbgr-loc-pat-line-group dbgr-bt-pat))
(match-end line-group)))
)
+ (specify "debugger-errmsg"
+ (setq dbgr-bt-pat (gethash "perl-errmsg"
+ dbgr-perldb-pat-hash))
+ (setq s1
+ "Use of uninitialized value $lines[0] in join or string at bin/../lib/LineCache.pm line 548.")
+ (setq dbgr-bt-re (dbgr-loc-pat-regexp dbgr-bt-pat))
+ (setq file-group (dbgr-loc-pat-file-group dbgr-bt-pat))
+ (setq line-group (dbgr-loc-pat-line-group dbgr-bt-pat))
+ (assert-equal 54 (string-match dbgr-bt-re s1))
+ (assert-equal "bin/../lib/LineCache.pm"
+ (substring s1
+ (match-beginning file-group)
+ (match-end file-group)))
+ (assert-equal "548"
+ (substring s1
+ (match-beginning line-group)
+ (match-end line-group)))
+ )
+
(specify "carp-backtrace"
(setq s1
" at /tmp/foo.pl line 7