1 ;;; Copyright (C) 2011, 2014 Rocky Bernstein <rocky@gnu.org>
2 ;;; Regular expressions for GNU Make debugger: remake
4 (eval-when-compile (require 'cl))
6 (require 'load-relative)
7 (require-relative-list '("../../common/regexp"
12 (defvar realgud-pat-hash)
13 (declare-function make-realgud-loc-pat (realgud-loc))
15 (defvar realgud:remake-pat-hash (make-hash-table :test 'equal)
16 "Hash key is the what kind of pattern we want to match:
17 backtrace, prompt, etc. The values of a hash entry is a
18 realgud-loc-pat struct")
20 ;; Regular expression that describes a remake location generally shown
21 ;; before a command prompt.
23 ;; -- (emacs-dbgr/realgud/debugger/Makefile:168)
24 (setf (gethash "loc" realgud:remake-pat-hash)
26 :regexp "\\(?:^\\|\n\\)\\(?:.. \\)?(\\(\\(?:[a-zA-Z]:\\)?[-a-zA-Z0-9_/.\\\\ ]+\\):\\([0-9]+\\))\\(?:\n\\(.*?\\)\n\\)?"
34 (setf (gethash "prompt" realgud:remake-pat-hash)
36 :regexp "^remake[<]+\\([0-9]+\\)[>]+ "
40 ;; Regular expression that describes a "breakpoint set" line
41 (setf (gethash "brkpt-set" realgud:remake-pat-hash)
43 :regexp "^Breakpoint \\([0-9]+\\) on target \\([^:]*\\): file \\(.+\\), line \\([0-9]+\\).\n"
48 ;; Regular expression that describes a debugger "delete" (breakpoint) response.
50 ;; Removed 1 breakpoint(s).
51 (setf (gethash "brkpt-del" realgud:remake-pat-hash)
53 :regexp "^Breakpoint \\([0-9]+\\) on target .* cleared\n"
56 (defconst realgud:remake-selected-frame-arrow "=>"
57 "String that describes which frame is selected in a debugger
59 (defconst realgud:remake-frame-arrow (format "\\(%s\\| \\)"
60 realgud:remake-selected-frame-arrow))
61 (defconst realgud:remake-frame-num-regexp
64 (defconst realgud:remake-frame-file-regexp " at \\(.*\\):\\([0-9]+\\)")
66 ;; Regular expression that describes a remake "backtrace" command line.
68 ;; #0 Makefile.in at /tmp/Makefile:216
69 ;; #1 Makefile at /tmp/Makefile:230
70 (setf (gethash "lang-backtrace" realgud:remake-pat-hash)
73 realgud:remake-frame-num-regexp
75 realgud:remake-frame-file-regexp
82 ;; Regular expression that describes a debugger "backtrace" command line.
84 ;; =>#0 Makefile.in at /tmp/Makefile:216
85 ;; #1 Makefile at /tmp/Makefile:230
86 (setf (gethash "debugger-backtrace" realgud:remake-pat-hash)
89 realgud:remake-frame-arrow
90 realgud:remake-frame-num-regexp
92 realgud:remake-frame-file-regexp
99 ;; Regular expression that describes which frame is selected in
100 ;; a debugger backtrace listing.
101 (setf (gethash "selected-frame-indicator" realgud:remake-pat-hash)
102 realgud:remake-selected-frame-arrow)
104 ;; Regular expression for a termination message.
105 (setf (gethash "termination" realgud:remake-pat-hash)
106 "^remake: That's all, folks...\n")
108 (setf (gethash "font-lock-keywords" realgud:remake-pat-hash)
110 ;; ;; File name and line number
111 ;; ;; E.g. =>#0 Makefile.in at /tmp/Makefile:216
112 ;; ;; ----^^^^^^^^^^^^^^^^^
113 (" at \\(.*\\):\\([0-9]+\\)"
114 (1 realgud-file-name-face)
115 (2 realgud-line-number-face))
117 ;; The frame number and first type name, if present.
118 ;; E.g. =>#0 Makefile.in at /tmp/Makefile:216
121 (1 realgud-backtrace-number-face))
124 (setf (gethash "remake" realgud-pat-hash) realgud:remake-pat-hash)
126 (defvar realgud:remake-command-hash (make-hash-table :test 'equal)
127 "Hash key is command name like 'quit' and the value is
128 the remake command to use, like 'q'")
130 (setf (gethash "break" realgud:remake-command-hash) "break %l")
131 (setf (gethash "eval" realgud:remake-command-hash) "expand %s")
132 (setf (gethash "remake" realgud-command-hash) realgud:remake-command-hash)
135 (provide-me "realgud:remake-")