Sun Studio 12 Update 1:使用 dbx 调试程序

确定源代码行执行的指令数

要计算一行代码执行了多少个指令,请键入:


(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

如果步过的行进行函数调用,则该函数中的行也计入在内。可以使用 next 事件而非 step 计算指令数(不包括被调用函数)。