1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 2010 Ian Hulin <ian@hulin.org.uk>
5 ;;;; LilyPond is free software: you can redistribute it and/or modify
6 ;;;; it under the terms of the GNU General Public License as published by
7 ;;;; the Free Software Foundation, either version 3 of the License, or
8 ;;;; (at your option) any later version.
10 ;;;; LilyPond 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
13 ;;;; GNU General Public License for more details.
15 ;;;; You should have received a copy of the GNU General Public License
16 ;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 ;;; This file provides the support routines for a guile debugger called
21 ;;; from a environment controlled by LilyPond. It works in conjunction
22 ;;; with file guile-debugger.ly.
26 (define-module (scm guile-debugger)
27 #:use-module (ice-9 debugger)
28 #:use-module (ice-9 debugging traps)
29 #:use-module (ice-9 debugging trace)
30 #:use-module (ice-9 debugging steps)
31 #:use-module (ice-9 debugging ice-9-debugger-extensions)
32 #:use-module (ice-9 readline)
41 (define (set-break! proc)
42 (install-trap (make <procedure-trap>
44 #:behaviour debug-trap)))
45 (define (clear-break! proc)
46 (uninstall-trap (make <procedure-trap>
48 #:behaviour debug-trap)))
51 (define (set-trace-call! proc)
52 (install-trap (make <procedure-trap>
54 #:behaviour (list trace-trap
56 (define (clear-trace-call! proc)
57 (uninstall-trap (make <procedure-trap>
59 #:behaviour (list trace-trap
62 (define (set-trace-subtree! proc)
63 (install-trap (make <procedure-trap>
65 #:behaviour (list trace-trap
68 (define (clear-trace-subtree! proc)
69 (uninstall-trap (make <procedure-trap>
71 #:behaviour (list trace-trap
75 (display "\nYou may add the following commands as debugging statements in your source file\n")
76 (display "or enter the set-x! commands at the guile prompt:\n\n")
77 (display " (set-break! <procedure>)\n")
78 (display " causes guile to enter debugger on a call to <procedure>\n")
79 (display " (clear-break! <procedure>)\n")
80 (display " disables a breakpoint previously set on a call to <procedure>\n")
81 (display " (set-trace-call! <procedure>)\n")
82 (display " prints out a line when Scheme enters or exits <procedure>\n")
83 (display " (clear-trace-call! <procedure>)\n")
84 (display " turns off tracing calls to <procedure>\n")
85 (display " (set-trace-subtree! <procedure>)\n")
86 (display " displays each line of Scheme code executed during a call to <procedure>\n")
87 (display " (clear-trace-subtree! <procedure>)\n")
88 (display " turns off tracing code during calls to <procedure>\n\n")
89 (display "Enter help at the guile debug> prompt for further information on debugger commands\n")