When Calling a Function Hundreds of Times, Which Call Failed?
My program fails on a call to a certain function,
CnvtV. The program probably calls that function a couple hundred times before it fails. If I set a location breakpoint on
CnvtV, the program stops on every call to that function, and I do not want that. I do not know what conditions cause the call to fail, so I cannot set a conditional breakpoint. What can I do?
You can set a breakpoint on the function with the Hit Count field to a value so high that it will never be reached. In this case, because you believe the function
CnvtV is called a couple hundred times, you might set Hit Count to 1000 or more. Then run the program and wait for the call to fail. When it does, open the Breakpoints window and look at the list of breakpoints. The breakpoint you set on
CnvtV appears, followed by the hit count and number of iterations remaining:
CnvtV(int) (no condition) when hit count is equal to 1000 (currently 101)
You now know that the function failed on the 101st call. If you reset the breakpoint with a hit count of 101 and run the program again, the program stops at the call to
CnvtV that caused it to fail.