4.6 Haltepunkte setzen

Ein sehr mächtiges Hilfsmittel beim Debuggen besteht darin, Haltepunkte zu setzen. Wenn die Abarbeitung an einer solchen Stelle ankommt, wird der Debugger aktiviert.

Das Kommando break erlaubt es, solche Haltepunkte zu setzen. Regel und Zeilennummer können dabei implizit bestimmt oder explizit angegeben werden. Wie das genau geschieht, kann dem Kapitel „Der Befehlssatz des Debuggers“ entnommen werden.

Ein Haltepunkt kann mit einer Bedingung ausgestattet sein. Der hier angegebene Ausdruck wird bei Erreichen des Haltepunkts ausgewertet. Wenn das Ergebnis false ist, wird der Haltepunkt als inaktiv behandelt, ansonsten ist er gültig.

Weiter kann ein Haltepunkt mit den Befehlen enable und disable aktiviert und deaktiviert werden.

Die Liste aller Haltepunkte kann man mit bplist ausgeben, delete löscht einen Haltepunkt endgültig aus der Liste.

Der Befehl continue schließlich setzt die Ausführung des Programms fort, bis der nächste Haltepunkt erreicht ist.

(Rule r1:"on dialog start" at depth 1 line 8)>break
Breakpoint 1 set at rule "on dialog start", line 8
(Rule r1:"on dialog start" at depth 1 line 8)>continue
11
8        if IsPrime(I) then
(Rule r1:"on dialog start" at depth 1 line 8)>disp I
11: I = 12
8        if IsPrime(I) then
(Rule r1:"on dialog start" at depth 1 line 8)>c
11: I = 13
8        if IsPrime(I) then
(Rule r1:"on dialog start" at depth 1 line 8)>c
13
11: I = 14
8        if IsPrime(I) then
(Rule r1:"on dialog start" at depth 1 line 8)>b r3
Breakpoint 2 set at rule "TestDialog.IsPrime", line 5
(Rule r1:"on dialog start" at depth 1 line 8)>c
2: M = 14
3: P = nothing
4: W = nothing
5: O = nothing
5     variable boolean P := true;
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)>br r2 15
Breakpoint 3 set at rule "TestDialog.Root", line 15
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)>c
6: X = 14
7: I = 0;
8: J = 14
9: K = 7
15            J := K;
(Rule r2:"TestDialog.Root" at depth 3 line 15)>bplist
Bp   1: on dialog start               , line    8, enabled
Bp   2: TestDialog.IsPrime            , line    5, enabled
Bp   3: TestDialog.Root               , line   15, enabled+
(Rule r2:"TestDialog.Root" at depth 3 line 15)>disable 1
Disabled breakpoint 1
(Rule r2:"TestDialog.Root" at depth 3 line 15)>c
6: X = 14
7: I = 3;
8: J = 7
9: K = 5
15            J := K;
(Rule r2:"TestDialog.Root" at depth 3 line 15)>disable 3
Disabled breakpoint 3
(Rule r2:"TestDialog.Root" at depth 3 line 15)>c
2: M = 15
3: P = nothing
4: W = nothing
5: O = nothing
5     variable boolean P := true;
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)>bplist
Bp   1: on dialog start               , line    8, disabled
Bp   2: TestDialog.IsPrime            , line    5, enabled
Bp   3: TestDialog.Root               , line   15, disabled
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)>delete 3
Deleted breakpoint 3
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)>bplist
Bp   1: on dialog start               , line    8, disabled
Bp   2: TestDialog.IsPrime            , line    5, enabled
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)>br r1 8 if I=17
Breakpoint 4 set at rule "on dialog start", line 8 (if I=17)
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)>c
2: M = 16
3: P = nothing
4: W = nothing
5: O = nothing
5     variable boolean P := true;
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)del 2
Deleted breakpoint 2
(Rule r3:"TestDialog.IsPrime" at depth 2 line 5)c
11: I = 17
8        if IsPrime(I) then