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