New Guile Debugging Interface

I've recently been hacking on a new Emacs-based interface for debugging and developing Guile applications. My thoughts and partial design are described in Guile CVS in the file workbook/use/debugging.text.

The following screenshots give an idea of what the new interface does so far; I'm very interested to receive comments, whether for features to add, or for changes to improve or rework what's there already, or for improving this page itself.

Thanks in advance - Neil Jerram

Getting started

An application XYZ that wants to use this interface needs to kick off the communication by including

(use-modules (ice-9 debugger ui-client))
(ui-connect "XYZ")
somewhere in its startup code, ideally after loading all interesting modules. This causes a window to pop up in Emacs, that looks like this:

The application has stopped as though a breakpoint was set just after the ui-connect call, and won't run again until the user tells it to continue.

While the application is stopped like this, the user can set a breakpoint on some procedure(s). Say an interesting procedure is in the (ossau fns) module, the user clicks on that module's [+] button to see its bindings --

-- then moves down to, say, facti and types b <RET>.

When all breakpoints are set, the user types g (for "go"), which tells the application to continue running.

Hitting a breakpoint

Assume now that the application runs code that hits this breakpoint. The "*Guile Debug: XYZ*" window will pop up again in Emacs, now looking like this:

The upper window shows

The lower window shows the corresponding source code, with the exact relevant expression highlighted.

There are now several options.

These bindings are selected to mirror the most closely corresponding Edebug bindings. (Or at least, that is the intention.)

Example 1 - single stepping

For example, after a few presses of <SPC> in this scenario, the window looks like this:

Note: The "T" in the stack section indicates a tail-recursive frame; in other words, that when that frame returns, all the frames above it marked "T" will also return in the same operation. "T" is the exact opposite of what Guile's current backtraces denote by "*".

Example 2 - evaluation

At this point one might like to know what n is, and what the result of (= n 0) is going to be. This can be discovered by evaluating a suitable expression in the selected stack frame, for example

(cons n (= n 0))

If you therefore type e (cons n (= n 0)) <RET>, the debug window responds:

The line near the top tells you that n is 2 and that (= n 0) is #f.

Coming next...

The main next things are support for easy editing and reevaluation of application code, and for the setting of source location breakpoints (as opposed to procedural breakpoints). Other items on the eventual list are: Please let me know which of these or any other unmentioned features are important to you.