next up previous
Next: Running the Debugged Program Up: User's Manual for Psd Previous: Supported Systems

Preparing Programs for Debugging

The easiest -- many would probably argue the only -- way to use psd is to use the GNU Emacs interface. For now, we'll assume you have all set up for using psd. See section ``Installing Psd'' at the end of this manual, if your friendly system administrator has not already installed psd for you.

To use the interface, start up a Scheme session with M-x run-scheme. If the mode line of the *scheme* buffer says ``Inferior Scheme Psd: run'', then psd is already ready for use. If not, you will need to give the command M-x psd-mode in the Scheme buffer. The necessary Scheme code is now loaded into your Scheme session. If you want psd to be loaded automagically when you start up a Scheme session, you can do that by using a ``hook''. In Emacs 18 this is done by putting the line

  (setq inferior-scheme-mode-hook 
        (cons '(lambda () (psd-mode 1))
              inferior-scheme-mode-hook))
in your .emacs file. With Emacs 19, the kosher way to do is
  (add-hook 'inferior-scheme-mode-hook 
            (function (lambda () (psd-mode 1))))

Psd can only debug procedures that reside in files. Thus, it is not possible to type procedures directly in the Scheme process buffer and debug them with psd.

To debug all procedures in a Scheme source file, give the command C-c d or M-x psd-debug-file either in the inferior Scheme buffer, or in a buffer containing Scheme source. If everything goes well, psd will first produce an instrumented version of your file, and then load it. You can also pick a single procedure to be debugged by going to a Scheme buffer and using the commands ESC C-x, C-c e and C-c C-e. If given a prefix argument, they will instrument the definition the cursor is on and load it into Scheme. For example, the command C-u C-c C-e will instrument a definition and send it to the Scheme process.


next up previous
Next: Running the Debugged Program Up: User's Manual for Psd Previous: Supported Systems

Gary T. Leavens
8/19/1997