Sun Studio 12 Update 1: Debugging a Program With dbx

Determining the Number of Lines Executed

To see how many lines have been executed in a small program, type:

(dbx) stop step -count infinity     # step and stop when count=inf
(2) stop step -count 0/infinity
(dbx) run
(dbx) status
(2) stop step -count 133/infinity

The program never stops, the program terminates. The number of lines executed is 133. This process is very slow. It is most useful with breakpoints on functions that are called many times.