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.

121 lines
4.7 KiB

  1. ;; Copyright (C) 2015-2017, 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 Bash shell debugger: bashdb
  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. (require-relative-list '("../../lang/posix-shell") "realgud-lang-")
  21. (defvar realgud:bashdb-pat-hash)
  22. (declare-function make-realgud-loc-pat 'realgud-regexp)
  23. (defvar realgud:bashdb-pat-hash (make-hash-table :test 'equal)
  24. "Hash key is the what kind of pattern we want to match:
  25. backtrace, prompt, etc. The values of a hash entry is a
  26. realgud-loc-pat struct")
  27. ;; Regular expression that describes a bashdb location generally shown
  28. ;; before a command prompt.
  29. ;; For example:
  30. ;; (/etc/init.d/apparmor:35):
  31. (setf (gethash "loc" realgud:bashdb-pat-hash) realgud:POSIX-debugger-loc-pat)
  32. ;; Top frame number
  33. (setf (gethash "top-frame-num" realgud:bashdb-pat-hash) 0)
  34. ;; Regular expression that describes a bashdb command prompt
  35. ;; For example:
  36. ;; bashdb<10>
  37. ;; bashdb<(5)>
  38. ;; bashdb<<1>>
  39. (setf (gethash "prompt" realgud:bashdb-pat-hash)
  40. (make-realgud-loc-pat
  41. :regexp (format "^bashdb[<]+[(]*%s[)]*[>]+ "
  42. realgud:regexp-captured-num)
  43. :num 1
  44. ))
  45. ;; realgud-loc-pat that describes a "breakpoint set" line
  46. (setf (gethash "brkpt-set" realgud:bashdb-pat-hash)
  47. realgud:POSIX-debugger-brkpt-set-pat)
  48. ;; realgud-loc-pat that describes a debugger "delete" (breakpoint) response.
  49. ;; For example:
  50. ;; Deleted breakpoint 1.
  51. (setf (gethash "brkpt-del" realgud:bashdb-pat-hash)
  52. realgud:POSIX-debugger-brkpt-del-pat)
  53. ;; realgud-loc-pat that describes a debugger "disable" (breakpoint) response.
  54. ;; For example:
  55. ;; Breakpoint entry 4 disabled.
  56. (setf (gethash "brkpt-disable" realgud:bashdb-pat-hash)
  57. realgud:POSIX-debugger-brkpt-disable-pat)
  58. ;; realgud-loc-pat that describes a debugger "enable" (breakpoint) response.
  59. ;; For example:
  60. ;; Breakpoint entry 4 enabled.
  61. (setf (gethash "brkpt-enable" realgud:bashdb-pat-hash)
  62. realgud:POSIX-debugger-brkpt-enable-pat)
  63. ;; realgud-loc-pat that describes a debugger "backtrace" command line.
  64. ;; For example:
  65. ;; ->0 in file `../bashdb/test/example/subshell.sh' at line 6
  66. ;; ##1 source("../bashdb/shell.sh") called from file `/bin/bashdb' at line 140
  67. ;; ##2 main() called from file `/bin/bashdb' at line 0
  68. (setf (gethash "debugger-backtrace" realgud:bashdb-pat-hash)
  69. realgud:POSIX-debugger-backtrace-pat)
  70. ;; FIXME breakpoints aren't locations. It should be a different structure
  71. ;; realgud-loc that describes a zshdb "info breakpoints" line.
  72. (setf (gethash "debugger-breakpoint" realgud:bashdb-pat-hash)
  73. realgud:POSIX-debugger-breakpoint-pat)
  74. ;; realgud-loc-pat for a termination message.
  75. (setf (gethash "termination" realgud:bashdb-pat-hash)
  76. "^bashdb: That's all, folks...\n")
  77. (setf (gethash "font-lock-keywords" realgud:bashdb-pat-hash)
  78. realgud:POSIX-debugger-font-lock-keywords)
  79. (setf (gethash "font-lock-breakpoint-keywords" realgud:bashdb-pat-hash)
  80. realgud:POSIX-debugger-font-lock-breakpoint-keywords)
  81. (setf (gethash "bashdb" realgud-pat-hash) realgud:bashdb-pat-hash)
  82. (defvar realgud:bashdb-command-hash (make-hash-table :test 'equal)
  83. "Hash key is command name like 'quit' and the value is
  84. the bashdb command to use, like 'quit!'")
  85. (setf (gethash "bashdb" realgud-command-hash) realgud:bashdb-command-hash)
  86. (setf (gethash "clear" realgud:bashdb-command-hash) "clear %l")
  87. (setf (gethash "eval" realgud:bashdb-command-hash) "eval %s")
  88. (setf (gethash "info-breakpoints" realgud:bashdb-command-hash) "info breakpoints")
  89. (setf (gethash "quit" realgud:bashdb-command-hash) "quit")
  90. (setf (gethash "until" realgud:bashdb-command-hash) "continue %l")
  91. ;; Unsupported features:
  92. (setf (gethash "break-fn" realgud:bashdb-command-hash) "*not-implemented*")
  93. (setf (gethash "finish" realgud:bashdb-command-hash) "*not-implemented*")
  94. (setf (gethash "jump" realgud:bashdb-command-hash) "*not-implemented*")
  95. (provide-me "realgud:bashdb-")