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. ;;;; This library is free software; you can redistribute it and/or
  4. ;;;; modify it under the terms of the GNU Lesser General Public
  5. ;;;; License as published by the Free Software Foundation; either
  6. ;;;; version 3 of the License, or (at your option) any later version.
  7. ;;;;
  8. ;;;; This library is distributed in the hope that it will be useful,
  9. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. ;;;; Lesser General Public License for more details.
  12. ;;;;
  13. ;;;; You should have received a copy of the GNU Lesser General Public
  14. ;;;; License along with this library; if not, write to the Free
  15. ;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. ;;;; 02111-1307 USA
  17. ;;; Author: Thien-Thi Nguyen <ttn@gnu.org>
  18. ;;; Version: 1
  19. ;;; Favorite-Favorite: Favorite-Favorite
  20. ;;; Commentary:
  21. ;; This is a grab bag of stuff for doing "gdb guile" in Emacs.
  22. ;; The var `gdb-guile-suggested-gdbinit' has a string that is
  23. ;; snarfed from ../HACKING. (todo: Write `gdb-guile-init' to
  24. ;; send it to gdb...)
  25. ;;; Code:
  26. (require 'cl)
  27. (defun gdb-guile-display-scm ()
  28. (interactive)
  29. (save-excursion
  30. (let ((sym (thing-at-point 'symbol))
  31. (proc (get-buffer-process
  32. (find-if (lambda (buf)
  33. (string-match "^.gud-." (buffer-name buf)))
  34. (buffer-list)))))
  35. (mapc (lambda (template)
  36. (process-send-string proc (format template sym)))
  37. (list
  38. "set gdb_print(%s)\n"
  39. "printf \"%s: %%s\\n\", gdb_output\n")))))
  40. (defvar gdb-guile-suggested-gdbinit "
  41. define gp
  42. set gdb_print($arg0)
  43. print gdb_output
  44. end
  45. document gp
  46. Executes (object->string arg)
  47. end
  48. define ge
  49. call gdb_read($arg0)
  50. call gdb_eval(gdb_result)
  51. set gdb_print(gdb_result)
  52. print gdb_output
  53. end
  54. document ge
  55. Executes (print (eval (read arg))): ge \"(+ 1 2)\" => 3
  56. end
  57. define gh
  58. call g_help(scm_str2symbol($arg0), 20)
  59. set gdb_print($1)
  60. print gdb_output
  61. end
  62. document gh
  63. Prints help string for arg: gh \"enved-target\"
  64. end
  65. "
  66. "A useful .gdbinit")
  67. (provide 'gud-guile)
  68. ;;; gud-guile.el ends here