gud-guile.el 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ;;; gud-guile.el --- Support for debugging guile internals
  2. ;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.
  3. ;; GNU Emacs 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 2, or (at your option)
  6. ;; any later version.
  7. ;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the
  13. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. ;; Boston, MA 02110-1301, USA.
  15. ;;; Author: Thien-Thi Nguyen <ttn@gnu.org>
  16. ;;; Version: 1
  17. ;;; Favorite-Favorite: Favorite-Favorite
  18. ;;; Commentary:
  19. ;; This is a grab bag of stuff for doing "gdb guile" in Emacs.
  20. ;; The var `gdb-guile-suggested-gdbinit' has a string that is
  21. ;; snarfed from ../HACKING. (todo: Write `gdb-guile-init' to
  22. ;; send it to gdb...)
  23. ;;; Code:
  24. (require 'cl)
  25. (defun gdb-guile-display-scm ()
  26. (interactive)
  27. (save-excursion
  28. (let ((sym (thing-at-point 'symbol))
  29. (proc (get-buffer-process
  30. (find-if (lambda (buf)
  31. (string-match "^.gud-." (buffer-name buf)))
  32. (buffer-list)))))
  33. (mapc (lambda (template)
  34. (process-send-string proc (format template sym)))
  35. (list
  36. "set gdb_print(%s)\n"
  37. "printf \"%s: %%s\\n\", gdb_output\n")))))
  38. (defvar gdb-guile-suggested-gdbinit "
  39. define gp
  40. set gdb_print($arg0)
  41. print gdb_output
  42. end
  43. document gp
  44. Executes (object->string arg)
  45. end
  46. define ge
  47. call gdb_read($arg0)
  48. call gdb_eval(gdb_result)
  49. set gdb_print(gdb_result)
  50. print gdb_output
  51. end
  52. document ge
  53. Executes (print (eval (read arg))): ge \"(+ 1 2)\" => 3
  54. end
  55. define gh
  56. call g_help(scm_str2symbol($arg0), 20)
  57. set gdb_print($1)
  58. print gdb_output
  59. end
  60. document gh
  61. Prints help string for arg: gh \"enved-target\"
  62. end
  63. "
  64. "A useful .gdbinit")
  65. (provide 'gud-guile)
  66. ;;; gud-guile.el ends here