Next: Finding Common Errors Up: The Concert Debugger Users Previous: Abstraction-Based Debugging

Coherent Printing

The most common way to debug almost any program is using print statements of one kind or another. Even in sequential languages, print statements have the severe disadvantage that the program must be recompiled to add or change them. In concurrent languages, there is the additional problem that they can get reordered by the communication network, causing them to appear in a different order than they were generated. This gives misleading and sometimes impossible notions of how the program actually behaved.

The Concert Debugger includes an experimental mechanism to handle both of these problems: the coherent print statement. A coherent print statement is a print statement that is added to the program at the debugger command line, alleviating the need to recompile often. Furthermore, and more importantly, they are logged by the debugger as they are created, avoiding the possibility that they will be reordered by the network or scheduler.

The Concert Debugger provides the concert coherent command, which an argument of the following form: <expression>@<filename>:<location>. Expression is a Concert expression, the result of which is to be printed; filename and location are a program position specified as they are for breakpoints. This print statement is executed every time that position in the program is encountered, and the results are recorded, along with time dependencies between this print statement and the others, so that the debugger can construct a log of print statements in the correct order.

An example coherent print session follows; notice that the coherent prints of the value of i are shown at the end of the program, after the final done message. Since there is no way to intermingle the coherent and regular program output in a consistent manner, the coherent output is shown at the end.


(cadb) concert coherent i@ample.ca:1494
coherent print of i at simple-buffer-example.ca:1494
(cadb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: simple-buffer-example.ca.exec 

34767891011121314151617181920212223242526272829303132<object: 2,d1e110>
done
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


program took 1.420000 seconds

-----------------------------------------------------------



Next: Finding Common Errors Up: The Concert Debugger Users Previous: Abstraction-Based Debugging


Julian Dolby
Concurrent Systems Architecture Group