Code Coverage Tool with Reentrant Indication
Original Publication Date: 2002-Feb-01
Included in the Prior Art Database: 2003-Jun-21
This invention provides an indication within a code coverage report as to whether or not a particular routine has been called in a recursive manner. Today, one way that many code coverage tools (such as the ATC code coverage tool) work is by using the debugger support to set a breakpoint on each statement. As the statements are encountered the fact that they where hit is recorded. After this, the breakpoint can be removed. This invention uses a similar concept to detect if a routine is called recursively. The invention handles the breakpoint set on an entry point to a routine differently than the rest of the breakpoints set to gather coverage data. When the breakpoint on the entry point is hit, the invention will examine the call stack and conclude if another instance of this routine is currently active on the stack. If so, it records the fact that this routine was recursively invoked. Then the breakpoint is removed. If the routine was not recursively called, then the fact the statement was executed is recorded but the breakpoint is not removed since a recursive version of the call has not yet been detected. Recursion depth is another statistic that can be reported by the tool. To do this the breakpoint that tests for recursion is not removed so that one can get a cumulative picture of the recursion taking place in the program. The when the breakpoint that tracks recursion fires the it check the recursion depth and includes the maximum recursion depth in the report. In the example ATC report below the function foo() was called recursively.