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.

124 lines
4.6 KiB

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