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
| | #! /bin/sh
# -*-scheme-*-
exec guile -e main -s "$0" "$@"
!#
;; Experimental GUD support for Guile REPL
;; Find a gud.el that you want to patch, e.g.
;; zcat /usr/share/emacs/24.3/lisp/progmodes/gud.el.gz > ~/.emacs.d/gud.el
;; or
;; M-x find-function gdb RET
;; C-x C-w ~/.emacs.d/gud.el RET
;; Patch it
;; patch ~/.emacs.d/gud.el < 0001-Initial-Guile-REPL-guiler-debugger-support-for-GUD.patch
;; M-x load-library ~/.emacs.d/gud.el RET
;; M-x guiler RET
;; ,m gud-break
;; ,br main
;; ,r
;; ,n
;; ,n # no easy RET shortcut yet
;;
;; And see |> marker in Emac's left margin track the program's execution.
(read-set! keywords 'prefix)
(define (main . args)
(eval '(main (command-line)) (resolve-module '(gud-break))))
(define-module (gud-break)
:export (main))
(define (stderr fmt . args)
(apply format (cons (current-error-port) (cons* fmt args)))
(force-output (current-error-port)))
(define (main . args)
(stderr "~a:hello world\n" (current-source-location))
(let
((a #f)
(b #f))
(set! a 1)
(stderr "set: a=~a\n" a)
(set! b 2)
(stderr "set: b=~a\n" b)
(let
((c #f)
(d #f))
(set! c 3)
(stderr "set: c=~a\n" c)
(set! d 4)
(stderr "set: d=~a\n" d))
(stderr "~a:leaving...\n" (current-source-location)))
(stderr "~a:goodbye world\n" (current-source-location)))
|