Debugging a Program With dbx

Determine the Number of Lines Executed in a Program

To see how many lines were executed in a small program:


(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. 133 is the number of lines executed. This process is very slow though. This technique is more useful with breakpoints on functions that are called many times.