Personal emacs config
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
7.0 KiB

  1. ;; Copyright (C) 2011, 2014, 2016, 2019 Free Software Foundation, Inc
  2. ;; Author: Rocky Bernstein <rocky@gnu.org>
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;; This program is distributed in the hope that it will be useful,
  8. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ;; GNU General Public License for more details.
  11. ;; You should have received a copy of the GNU General Public License
  12. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ;;; Regular expressions for GNU Make debugger: remake
  14. (eval-when-compile (require 'cl-lib)) ;For setf.
  15. (require 'load-relative)
  16. (require-relative-list '("../../common/regexp"
  17. "../../common/loc"
  18. "../../common/init")
  19. "realgud-")
  20. (defvar realgud-pat-hash)
  21. (declare-function make-realgud-loc-pat 'realgud-regexp)
  22. (defvar realgud:remake-pat-hash (make-hash-table :test 'equal)
  23. "Hash key is the what kind of pattern we want to match:
  24. backtrace, prompt, etc. The values of a hash entry is a
  25. realgud-loc-pat struct")
  26. ;; Top frame number
  27. (setf (gethash "top-frame-num" realgud:remake-pat-hash) 0)
  28. ;; realgud-loc-pat that describes a remake location generally shown
  29. ;; before a command prompt.
  30. ;; For example:
  31. ;; -- (emacs-dbgr/realgud/debugger/Makefile:168)
  32. (setf (gethash "loc" realgud:remake-pat-hash)
  33. (make-realgud-loc-pat
  34. :regexp "\\(?:^\\|\n\\)\\(?:.. \\)?(\\(\\(?:[a-zA-Z]:\\)?[-a-zA-Z0-9_/.\\\\ ]+\\):\\([0-9]+\\))\\(?:\n\\(.*?\\)\n\\)?"
  35. :file-group 1
  36. :line-group 2
  37. :text-group 3))
  38. ;; For example:
  39. ;; remake<10>
  40. ;; remake<<1>>
  41. (setf (gethash "prompt" realgud:remake-pat-hash)
  42. (make-realgud-loc-pat
  43. :regexp "^remake[<]+\\([0-9]+\\)[>]+ "
  44. :num 1
  45. ))
  46. ;; realgud-loc-pat that describes a "breakpoint set" line
  47. (setf (gethash "brkpt-set" realgud:remake-pat-hash)
  48. (make-realgud-loc-pat
  49. :regexp "^Breakpoint \\([0-9]+\\) on target \\([^:]*\\): file \\(.+\\), line \\([0-9]+\\).\n"
  50. :num 1
  51. :file-group 3
  52. :line-group 4))
  53. ;; realgud-loc-pat that describes a debugger "delete" (breakpoint) response.
  54. ;; For example:
  55. ;; Removed 1 breakpoint(s).
  56. (setf (gethash "brkpt-del" realgud:remake-pat-hash)
  57. (make-realgud-loc-pat
  58. :regexp "^Breakpoint \\([0-9]+\\) on target .* cleared\n"
  59. :num 1))
  60. (defconst realgud:remake-selected-frame-arrow "=>"
  61. "String that describes which frame is selected in a debugger
  62. backtrace listing.")
  63. (defconst realgud:remake-frame-arrow (format "\\(%s\\| \\)"
  64. realgud:remake-selected-frame-arrow))
  65. (defconst realgud:remake-frame-num-regexp
  66. "#\\([0-9]+\\) ")
  67. (defconst realgud:remake-frame-file-regexp " at \\(.*\\):\\([0-9]+\\)")
  68. ;; realgud-loc-pat that describes a remake "backtrace" command line.
  69. ;; For example:
  70. ;; #0 Makefile.in at /tmp/Makefile:216
  71. ;; #1 Makefile at /tmp/Makefile:230
  72. (setf (gethash "lang-backtrace" realgud:remake-pat-hash)
  73. (make-realgud-loc-pat
  74. :regexp (concat "^"
  75. realgud:remake-frame-num-regexp
  76. "\\(.*\\)"
  77. realgud:remake-frame-file-regexp
  78. )
  79. :num 1
  80. :file-group 3
  81. :line-group 4)
  82. )
  83. ;; realgud-loc-pat that describes a debugger "backtrace" command line.
  84. ;; For example:
  85. ;; =>#0 Makefile.in at /tmp/Makefile:216
  86. ;; #1 Makefile at /tmp/Makefile:230
  87. (setf (gethash "debugger-backtrace" realgud:remake-pat-hash)
  88. (make-realgud-loc-pat
  89. :regexp (concat "^"
  90. realgud:remake-frame-arrow
  91. realgud:remake-frame-num-regexp
  92. "\\(.*\\)"
  93. realgud:remake-frame-file-regexp
  94. )
  95. :num 2
  96. :file-group 4
  97. :line-group 5)
  98. )
  99. ;; FIXME breakpoints aren't locations. It should be a different structure
  100. ;; Regular expression that describes a gdb "info breakpoint" line
  101. ;; For example:
  102. ;; 1 breakpoint keep y 0x07 ../../../config.status at /src/realgud/realgud/debugger/remake/Makefile:282
  103. ;; 2 breakpoint keep y 0x07 ../../../configure at /src/realgud/realgud/debugger/remake/Makefile:285
  104. ;; 3 breakpoint keep y 0x07 ../../../configure.ac at /src/realgud/realgud/debugger/remake/Makefile:289
  105. (setf (gethash "debugger-breakpoint" realgud:remake-pat-hash)
  106. (make-realgud-loc-pat
  107. :regexp (format "^[ \t]*%s[ \t]+\\(breakpoint\\)[ \t]+\\(keep\\|del\\)[ \t]+\\([yn]\\)[ \t]+\\(0x??\\).* at \\(.+\\):%s"
  108. realgud:regexp-captured-num realgud:regexp-captured-num)
  109. :num 1
  110. :text-group 2 ;; misnamed Is "breakpoint" or "watchpoint"
  111. :string 3 ;; misnamed. Is "keep" or "del"
  112. ;; Skipped mask
  113. :file-group 6
  114. :line-group 7)
  115. )
  116. (setf (gethash "font-lock-breakpoint-keywords" realgud:remake-pat-hash)
  117. '(
  118. ;; 1 breakpoint keep y 0x07 ../../../config.status at /src/external-vcs/github/rocky/realgud/realgud/debugger/remake/Makefile:282
  119. ;; ^ ^^^^^^^^^^ ^^^^ ^
  120. ("^[ \t]+\\([0-9]+\\)[ \t]+\\(breakpoint\\)[ \t]+\\(keep\\|del\\)[ \t]+\\([yn]\\)"
  121. (1 realgud-breakpoint-number-face)
  122. (2 font-lock-function-name-face nil t) ; t means optional.
  123. (3 font-lock-function-name-face nil t)) ; t means optional.
  124. ;; 1 breakpoint keep y 0x07 ../../../config.status at /src/realgud/realgud/debugger/remake/Makefile:282
  125. ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
  126. (" \\(0x??\\) \\(.+\\) at \\(.+\\):\\([0-9]+\\)"
  127. (3 realgud-file-name-face)
  128. (4 realgud-line-number-face))
  129. ))
  130. ;; realgud-loc-pat that describes which frame is selected in
  131. ;; a debugger backtrace listing.
  132. (setf (gethash "selected-frame-indicator" realgud:remake-pat-hash)
  133. realgud:remake-selected-frame-arrow)
  134. ;; Regular expression for a termination message.
  135. (setf (gethash "termination" realgud:remake-pat-hash)
  136. "^remake: That's all, folks...\n")
  137. (setf (gethash "font-lock-keywords" realgud:remake-pat-hash)
  138. '(
  139. ;; ;; File name and line number
  140. ;; ;; E.g. =>#0 Makefile.in at /tmp/Makefile:216
  141. ;; ;; ----^^^^^^^^^^^^^^^^^
  142. (" at \\(.*\\):\\([0-9]+\\)"
  143. (1 realgud-file-name-face)
  144. (2 realgud-line-number-face))
  145. ;; The frame number and first type name, if present.
  146. ;; E.g. =>#0 Makefile.in at /tmp/Makefile:216
  147. ;; ---^
  148. ("#\\([0-9]+\\) "
  149. (1 realgud-backtrace-number-face))
  150. ))
  151. (setf (gethash "remake" realgud-pat-hash) realgud:remake-pat-hash)
  152. (defvar realgud:remake-command-hash (make-hash-table :test 'equal)
  153. "Hash key is command name like 'quit' and the value is
  154. the remake command to use, like 'q'")
  155. (setf (gethash "break" realgud:remake-command-hash) "break %l")
  156. (setf (gethash "eval" realgud:remake-command-hash) "expand %s")
  157. (setf (gethash "info-breakpoints" realgud:remake-command-hash) "info breakpoints")
  158. (setf (gethash "remake" realgud-command-hash) realgud:remake-command-hash)
  159. ;; Unsupported features:
  160. (setf (gethash "jump" realgud:remake-command-hash) "*not-implemented*")
  161. (provide-me "realgud:remake-")