1 | /*! @file CoverageRanges.h |
---|
2 | * @brief CoverageRanges Specification |
---|
3 | * |
---|
4 | * This file contains the specification of the CoverageRanges class. |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __COVERAGE_RANGES_H__ |
---|
8 | #define __COVERAGE_RANGES_H__ |
---|
9 | |
---|
10 | #include <stdint.h> |
---|
11 | #include <list> |
---|
12 | #include <string> |
---|
13 | |
---|
14 | namespace Coverage { |
---|
15 | |
---|
16 | /*! @class CoverageRanges |
---|
17 | * |
---|
18 | * This class defines a set of address ranges for which coverage |
---|
19 | * did not occur. Each address range can either define a range of |
---|
20 | * bytes that was not executed or a range of bytes for a branch |
---|
21 | * instruction that was not completely covered (i.e. taken and NOT |
---|
22 | * taken). |
---|
23 | */ |
---|
24 | class CoverageRanges { |
---|
25 | |
---|
26 | public: |
---|
27 | |
---|
28 | /*! |
---|
29 | * This type defines the reasons to associate with a range. |
---|
30 | */ |
---|
31 | typedef enum { |
---|
32 | UNCOVERED_REASON_NOT_EXECUTED, |
---|
33 | UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN, |
---|
34 | UNCOVERED_REASON_BRANCH_NEVER_TAKEN |
---|
35 | } uncoveredReason_t; |
---|
36 | |
---|
37 | /*! |
---|
38 | * This type defines the information kept for each range. |
---|
39 | */ |
---|
40 | typedef struct { |
---|
41 | /*! |
---|
42 | * This member contains an identification number for this |
---|
43 | * coverage range. |
---|
44 | */ |
---|
45 | uint32_t id; |
---|
46 | |
---|
47 | /*! |
---|
48 | * This member contains the low address of this coverage |
---|
49 | * range. |
---|
50 | */ |
---|
51 | uint32_t lowAddress; |
---|
52 | |
---|
53 | /*! |
---|
54 | * This member contains the source line associated with the |
---|
55 | * low address for this coverage range. |
---|
56 | */ |
---|
57 | std::string lowSourceLine; |
---|
58 | |
---|
59 | /*! |
---|
60 | * This member contains the high address for this coverage range. |
---|
61 | */ |
---|
62 | uint32_t highAddress; |
---|
63 | |
---|
64 | /*! |
---|
65 | * This member contains the high source line for this coverage range. |
---|
66 | */ |
---|
67 | std::string highSourceLine; |
---|
68 | |
---|
69 | /*! |
---|
70 | * This member contains an instruction count for this coverage |
---|
71 | * address range. |
---|
72 | */ |
---|
73 | uint32_t instructionCount; |
---|
74 | |
---|
75 | /*! |
---|
76 | * This member contains the reason that this area was uncovered. |
---|
77 | */ |
---|
78 | uncoveredReason_t reason; |
---|
79 | } coverageRange_t; |
---|
80 | |
---|
81 | /*! |
---|
82 | * This type contains a list of CoverageRange instances. |
---|
83 | */ |
---|
84 | typedef std::list<coverageRange_t> ranges_t; |
---|
85 | |
---|
86 | /*! |
---|
87 | * This member contains a list of the CoverageRange instances. |
---|
88 | */ |
---|
89 | ranges_t set; |
---|
90 | |
---|
91 | /*! |
---|
92 | * This method constructs a CoverageRanges instance. |
---|
93 | */ |
---|
94 | CoverageRanges(); |
---|
95 | |
---|
96 | /*! |
---|
97 | * This method destructs a CoverageRanges instance. |
---|
98 | */ |
---|
99 | ~CoverageRanges(); |
---|
100 | |
---|
101 | /*! |
---|
102 | * This method adds a range entry to the set of ranges. |
---|
103 | * |
---|
104 | * @param[in] lowAddressArg specifies the lowest address of the range |
---|
105 | * @param[in] highAddressArg specifies the highest address of the range |
---|
106 | * @param[in] why specifies the reason that the range was added |
---|
107 | * |
---|
108 | */ |
---|
109 | void add( |
---|
110 | uint32_t lowAddressArg, |
---|
111 | uint32_t highAddressArg, |
---|
112 | uncoveredReason_t why, |
---|
113 | uint32_t numInstructions |
---|
114 | ); |
---|
115 | |
---|
116 | |
---|
117 | /*! |
---|
118 | * This method returns the index of a range given the low address. |
---|
119 | * Upon failure on finding the adress 0 is returned. |
---|
120 | */ |
---|
121 | uint32_t getId( uint32_t lowAddress ); |
---|
122 | |
---|
123 | protected: |
---|
124 | |
---|
125 | |
---|
126 | }; |
---|
127 | |
---|
128 | } |
---|
129 | #endif |
---|