1 ;;; Copyright (C) 2011, 2014-2015 Rocky Bernstein <rocky@gnu.org>
2 ;;; Stock Perl debugger perldb
4 (eval-when-compile (require 'cl))
6 (require 'load-relative)
7 (require-relative-list '("../../common/regexp" "../../common/loc") "realgud-")
8 (require-relative-list '("../../lang/perl") "realgud-lang-")
10 (defvar realgud-pat-hash)
11 (declare-function make-realgud-loc-pat (realgud-loc))
13 (defvar realgud:perldb-pat-hash (make-hash-table :test 'equal)
14 "Hash key is the what kind of pattern we want to match:
15 lang-backtrace, prompt, etc. The values of a hash entry is a
16 realgud-loc-pat struct")
18 (declare-function make-realgud-loc "realgud-loc" (a b c d e f))
20 ;; Regular expression that describes a perldb location generally shown
21 ;; before a command prompt. We include matching the source text so we
24 ;; Program-location lines look like this:
25 ;; File::Basename::dirname(/usr/share/perl/5.16.0/File/Basename.pm:284):
26 ;; 284: my $path = shift;
28 ;; main::(/usr/bin/latex2html:102):
31 (setf (gethash "loc" realgud:perldb-pat-hash)
33 :regexp "\\(?:CODE(0x[0-9a-h]+)\\)?(\\(.+\\):\\(\[0-9]+\\)):\\(?:\n[0-9]+:\t\\(.*?\\)\n\\)?"
38 ;; perldb debugger prompt.
41 ;; [pid=6489->6502] DB<1>
43 (setf (gethash "prompt" realgud:perldb-pat-hash)
45 :regexp "\\(?:\\[pid=[0-9]+->[0-9]+\\]\\)? DB<\\([0-9]+\\)> "
49 ;; Regular expression that describes a Perl debugger backtrace line.
50 ;; $ = main::top_navigation_panel called from file `./latex2html' line 7400
51 ;; $ = main::BEGIN() called from file `(eval 19)[/usr/bin/latex2html:126]' line 2
52 (setf (gethash "debugger-backtrace" realgud:perldb-pat-hash)
54 :regexp "\s+called from file `\\(.+\\)' line \\([0-9]+\\)"
58 ;; Regular expression that describes location in a Perl errmsg
59 (setf (gethash "perl-errmsg" realgud:perldb-pat-hash)
60 realgud-perl-errmsg-loc-pat)
62 ;; Regular expression that describes a Perl Carp backtrace line.
63 ;; at /tmp/foo.pl line 7
64 ;; main::__ANON__('Illegal division by zero at /tmp/foo.pl line 4.\x{a}') called at /tmp/foo.pl line 4
65 ;; main::foo(3) called at /tmp/foo.pl line 8
66 (setf (gethash "lang-backtrace" realgud:perldb-pat-hash)
67 realgud-perl-carp-loc-pat)
69 (defvar realgud:perldb-command-hash (make-hash-table :test 'equal)
70 "Hash key is command name like 'quit' and the value is
71 the perldb command to use, like 'q'")
73 (setf (gethash "font-lock-keywords" realgud:perldb-pat-hash)
75 ("\s+called from file `\\(.+\\)' line \\([0-9]+\\)"
76 (1 realgud-file-name-face)
77 (2 realgud-line-number-face))
81 (setf (gethash "perldb" realgud-pat-hash) realgud:perldb-pat-hash)
82 (setf (gethash "perl5db" realgud-pat-hash) realgud:perldb-pat-hash)
84 (setf (gethash "backtrace" realgud:perldb-command-hash) "T")
85 (setf (gethash "break" realgud:perldb-command-hash) "b %l")
86 (setf (gethash "clear" realgud:perldb-command-hash) "B %l")
87 (setf (gethash "continue" realgud:perldb-command-hash) "c")
88 (setf (gethash "eval" realgud:perldb-command-hash) "x %s")
89 (setf (gethash "quit" realgud:perldb-command-hash) "q")
90 (setf (gethash "restart" realgud:perldb-command-hash) "R")
91 (setf (gethash "run" realgud:perldb-command-hash) "R")
92 (setf (gethash "step" realgud:perldb-command-hash) "s")
93 (setf (gethash "next" realgud:perldb-command-hash) "n")
94 (setf (gethash "until" realgud:perldb-command-hash) "c %l")
95 (setf (gethash "perldb" realgud-command-hash) realgud:perldb-command-hash)
97 (provide-me "realgud:perldb-")