Browse Prior Art Database

Code Coverage Tool with Reentrant Indication

IP.com Disclosure Number: IPCOM000015745D
Original Publication Date: 2002-Feb-01
Included in the Prior Art Database: 2003-Jun-21
Document File: 5 page(s) / 40K

Publishing Venue

IBM

Abstract

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.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 54% of the total text.

Page 1 of 5

Code Coverage Tool with Reentrant Indication

   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.

ATC OS/400 Code Coverage Assistant V00R02M02 Mon Apr 16
10:38:42 2001
Annotated Report for WAHEED/CCACPPTST2(CCACPPTST2) Program
Type: *PGM

   Line Stmt
-L-------1--------2--------3-Source--4--------5--------6--------7
-R------8

1 : #include <iostream.h>
2

3 // Global Variables
4 const int iArraySize = 5;
5 const float PI = 2.718;
6

7 class BaseClass
8{

1

Page 2 of 5

 9 protected:
10 float Radius;
11 float Area;
12

13 public:
14 BaseClass ();
15 ~BaseClass ();
16 void SetRadius (float);
17 float GetRadius ();
18 float CalculateArea ();
19 int NeverCalled ();
20

21 private:
22 // Private Variables
23 // Private Methods
24 };
25

26 class DerivedClass : public BaseClass
27 {
28 public:
29 DerivedClass ();
30 ~DerivedClass ();
31 void SetBallWeight (int);
32 int GetBallWeight ();
33 void SetBallColor (char *);
34 char * GetBallColor ();
35

36 private:
37 int BallWeight;
38 char BallColor[20];
39 };
40

41

     42 BaseClass :: BaseClass ()
43 {
44 : cout <<"...