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.

117 lines
4.5 KiB

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