Debugging a Program With dbx

Determine the Number of Instructions Executed by a Source Line

To count how many instructions a line of code executes:


(dbx) ...                        # get
to the line in question
(dbx) stop step -instr -count infinity
(dbx) step ...
(dbx)status
(3) stop step -count 48/infinity # 48
instructions were executed

If the line you are stepping over makes a function call, you end up counting those as well. You can use the next event instead of step to count instructions, excluding called functions.