Next: Performance Statistics Up: The Concert Tutorial Previous: Resolving Type Errors

Using the Concert Debugger

Concurrent programming introduces whole new classes of programming errors in addition to the many already inherent in all programming: among these are synchronization errors and deadlocks. To facilitate finding both the new kinds of bugs and the old ones, the Concert Debugger allows one to observe the state of a CA program at various stages of its execution.

Compiling for Debugging

The Concert Debugger requires that programs be compiled with the -g switch. Furthermore, the debugger will not work properly with optimized code. Load the simple buffer example program from section 4.2, and make sure the buffer is in Lisp mode. Type M-c to bring up the concert compile command, and add the -g flag. The compiler will compile the program, and you will notice -DDEBUGGING appears in the compiler's output.

Starting the Debugger

Unlike the rest of the Concert System, the Concert Debugger must run from within Emacs. Switch to the buffer containing the simple buffer program. To start the debugger, type M-x cadb as shown in Figure 12; if this does not produce the minibuffer in Figure 13, make sure that Emacs is set up as done in section 2 and try again.

Enter the filename simple-buffer-example.ca.exec at the prompt; notice that the debugger uses the executable file name.

The Concert Debugger will then run, and produce a banner as shown in Figure 14; as suggested in the banner, type help concert to see a list of the available debugger commands. Typing help followed by any the commands listed will in turn provide more detailed help about each individual command. The top level help message is also shown in Figure 14.

An example debugger session

Much of the debugger functionality is similar to other debuggers such as GDB; a simple debugger session exercising some of it follows. Start in the buffer from section 8.2, and use C-x 2 to open another screen. Switch that other screen to the simply buffer program, and move the cursor within the (isfull self) expression in the get method. Press C-x Space. As in GDB, this will set a breakpoint, but the Concert Debugger will set a breakpoint in a specific expression, rather than a line as GDB does. At this point, the screen will look like Figure 15; note the position of the cursor, which is in the expression where the break is being set.

Now, run the program by typing run, as in GDB. The program will run normally until it hits the expression, when the debugger will stop execution and print a message. The message will say where the program stopped, including the method name, the file position and the arguments to the method; this is analogous to how GDB prints function information. Emacs will also pull up the file in which the break occurred, and show a pointer to the line where execution stopped. This is all shown in Figure 17. Since breakpoints are set more finely than by line, the minibuffer will display a message giving the exact expression where the break occurred, as illustrated in Figure 16.

At a breakpoint, the program state can be browsed; the state consists of the states of the various objects in the system and the methods that have been invoked upon them. Let's start by examining the state of the method that triggered the break. This is done with the concert show current command, and the concert show object command will show the object with which the method is associated. This is illustrated in Figure 18. Note that the file position given may not be the same as the one in the break message; this is because the debugger must sometimes continue execution slightly to create a consistent state on all of the simulated nodes.

The method invocations are arranged as a forest: each method is either the initial_message or a non-blocking send, in which case it is a root, or it was called by another method, in which case it is a child of that method. You start at the method which triggered the break, and can navigate the forest by moving between parents and children. You can also move among the objects, which are attached to the methods. There are three commands used for navigating and examining the state:

method
is used to indicate all of the child methods of the current method.
object
is used to indicate either the object a method is associated with or all of the objects accessible from the current object.
parent
indicates the parent of the current method, or nothing if an object is being examined.

All of these commands work with both concert show and concert goto, both of which do the obvious thing. An extended example of using these constructs to walk around the program state is given in Figure 19

More information

This is only some of the debugger functionality; for more information, and complete documentation, see [3].



Next: Performance Statistics Up: The Concert Tutorial


Julian Dolby
Vijay Karamcheti
John Plevyak
Xingbin Zhang
Concurrent Systems Architecture Group