summaryrefslogtreecommitdiff
path: root/emacs/gud-guile.el
blob: 5d295268fa5e95bf5854bf907a58f764018cb2c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;;; gud-guile.el --- Support for debugging guile internals

;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.

;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;; 
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; Lesser General Public License for more details.
;;;; 
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA

;;; Author: Thien-Thi Nguyen <ttn@gnu.org>
;;; Version: 1
;;; Favorite-Favorite: Favorite-Favorite

;;; Commentary:

;; This is a grab bag of stuff for doing "gdb guile" in Emacs.
;; The var `gdb-guile-suggested-gdbinit' has a string that is
;; snarfed from ../HACKING.  (todo: Write `gdb-guile-init' to
;; send it to gdb...)

;;; Code:

(require 'cl)

(defun gdb-guile-display-scm ()
  (interactive)
  (save-excursion
    (let ((sym (thing-at-point 'symbol))
          (proc (get-buffer-process
                 (find-if (lambda (buf)
                            (string-match "^.gud-." (buffer-name buf)))
                          (buffer-list)))))
      (mapc (lambda (template)
              (process-send-string proc (format template sym)))
            (list
             "set gdb_print(%s)\n"
             "printf \"%s: %%s\\n\", gdb_output\n")))))

(defvar gdb-guile-suggested-gdbinit "
define gp
set gdb_print($arg0)
print gdb_output
end
document gp
Executes (object->string arg)
end

define ge
call gdb_read($arg0)
call gdb_eval(gdb_result)
set gdb_print(gdb_result)
print gdb_output
end
document ge
Executes (print (eval (read arg))): ge \"(+ 1 2)\" => 3
end

define gh
call g_help(scm_str2symbol($arg0), 20)
set gdb_print($1)
print gdb_output
end
document gh
Prints help string for arg: gh \"enved-target\"
end
"
  "A useful .gdbinit")

(provide 'gud-guile)

;;; gud-guile.el ends here