This section demonstrates some advanced techniques for using breakpoints:
Using breakpoint counts
Using bounded breakpoints
Picking a useful breakpoint count
Watchpoints
Using breakpoint conditions
Micro replay using pop
Using fix and continue
This section, and the example program, are inspired by an actual bug discovered in dbx using much the same sequence described in this section.
The source code includes a sample input file named in, which triggers a bug in the example program. in contains the following code:
display nonexistent_var # should yield an error display var stop in X # will cause one "stopped" message and display stop in Y # will cause second "stopped" message and display run cont cont run cont cont
When you run the program with the input file, the output is as follows:
$ a.out < in
> display nonexistent_var
error: Don't know about 'nonexistent_var'
> display var
will display 'var'
> stop in X
> stop in Y
> run
running ...
stopped in X
var = {
a = '100'
b = '101
c = '<error>'
d = '102
e = '103'
f = '104'
}
> cont
stopped in Y
var = {
a = '105'
b = '106'
c = '<error>'
d = '107'
e = '108'
f = '109'
}
> cont
exited
> run
running ...
stopped in X
var = {
a = '110'
b = '111'
c = '<error>'
d = '112'
e = '113'
f = '114'
}
> cont
stopped in Y
var = {
a = '115'
b = '116'
c = '<error>'
d = '117'
e = '118'
f = '119'
}
> cont
exited
> quit
Goodby
This output might seem voluminous but the point of this example is to illustrate techniques to be used with long running, complex programs where stepping through code or tracing just are not practical.
Notice that when showing the value of field c, you get a value of <error>. Such a situation might occur if the field contains a bad address.