summaryrefslogtreecommitdiffstats
path: root/covoar
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-08-21 16:00:07 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-08-21 16:00:07 +0000
commit6332f684c84555ccebd0feaa39f84d30a1a43d99 (patch)
tree314df7ee9ce39d49389488fb75f4f2ceb87f785b /covoar
parent2011-08-21 Jie Liu <lj8175@gmail.com> (diff)
downloadrtems-testing-6332f684c84555ccebd0feaa39f84d30a1a43d99.tar.bz2
2011-08-21 Pawel Zagorski <pzagor@agh.edu.pl>
PR 1900/testing * CoverageMapBase.cc, CoverageMapBase.h, DesiredSymbols.cc: Changed tracking of "instruction was executed" from a boolean to a counter. This change was propagated as needed and a helper method to access new information (getWasExecuted) was added. * covoar.cc: Removed unnecessary blank line.
Diffstat (limited to 'covoar')
-rw-r--r--covoar/ChangeLog9
-rw-r--r--covoar/CoverageMapBase.cc34
-rw-r--r--covoar/CoverageMapBase.h29
-rw-r--r--covoar/DesiredSymbols.cc5
-rw-r--r--covoar/covoar.cc1
5 files changed, 67 insertions, 11 deletions
diff --git a/covoar/ChangeLog b/covoar/ChangeLog
index 6abcf7b..c28b69e 100644
--- a/covoar/ChangeLog
+++ b/covoar/ChangeLog
@@ -1,3 +1,12 @@
+2011-08-21 Pawel Zagorski <pzagor@agh.edu.pl>
+
+ PR 1900/testing
+ * CoverageMapBase.cc, CoverageMapBase.h, DesiredSymbols.cc:
+ Changed tracking of "instruction was executed" from a boolean
+ to a counter. This change was propagated as needed and a helper
+ method to access new information (getWasExecuted) was added.
+ * covoar.cc: Removed unnecessary blank line.
+
2011-03-08 Joel Sherrill <joel.sherrilL@OARcorp.com>
* DesiredSymbols.cc, DesiredSymbols.h, covoar.cc: Fix typo.
diff --git a/covoar/CoverageMapBase.cc b/covoar/CoverageMapBase.cc
index b09e309..6141127 100644
--- a/covoar/CoverageMapBase.cc
+++ b/covoar/CoverageMapBase.cc
@@ -40,7 +40,7 @@ namespace Coverage {
perAddressInfo_t *i = &Info[ a ];
i->isStartOfInstruction = false;
- i->wasExecuted = false;
+ i->wasExecuted = 0;
i->isBranch = false;
i->isNop = false;
i->wasTaken = false;
@@ -200,17 +200,43 @@ namespace Coverage {
if (determineOffset( address, &offset ) != true)
return;
- Info[ offset ].wasExecuted = true;
+ Info[ offset ].wasExecuted += 1;
+ }
+
+ void CoverageMapBase::sumWasExecuted( uint32_t address, uint32_t addition)
+ {
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
+ return;
+
+ Info[ offset ].wasExecuted += addition;
}
bool CoverageMapBase::wasExecuted( uint32_t address ) const
{
uint32_t offset;
+ bool result;
+ result = true;
+
if (determineOffset( address, &offset ) != true)
- return false;
+ result = false;
+
+ if (Info[ offset ].wasExecuted <= 0)
+ result = false;
+
+ return result;
+ }
+
+ uint32_t CoverageMapBase::getWasExecuted( uint32_t address ) const
+ {
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
+ return 0;
- return Info[ offset ].wasExecuted;
+ return Info[ offset ].wasExecuted;
}
void CoverageMapBase::setIsBranch(
diff --git a/covoar/CoverageMapBase.h b/covoar/CoverageMapBase.h
index a3e22d5..bdf10a0 100644
--- a/covoar/CoverageMapBase.h
+++ b/covoar/CoverageMapBase.h
@@ -175,8 +175,8 @@ namespace Coverage {
bool isStartOfInstruction( uint32_t address ) const;
/*!
- * This method sets the boolean which indicates that the instruction
- * at the specified address was executed.
+ * This method increments the counter which indicates how many times
+ * the instruction at the specified address was executed.
*
* @param[in] address specifies the address which was executed
*/
@@ -194,6 +194,27 @@ namespace Coverage {
bool wasExecuted( uint32_t address ) const;
/*!
+ * This method increases the counter which indicates how many times
+ * the instruction at the specified address was executed. It is used
+ * for merging coverage maps.
+ *
+ * @param[in] address specifies the address which was executed
+ * @param[in] address specifies the execution count that should be
+ * added
+ */
+ virtual void sumWasExecuted( uint32_t address, uint32_t addition );
+
+ /*!
+ * This method returns an unsigned integer which indicates how often
+ * the instruction at the specified address was executed.
+ *
+ * @param[in] address specifies the address to check
+ *
+ * @return Returns number of executins
+ */
+ uint32_t getWasExecuted( uint32_t address ) const;
+
+ /*!
* This method sets the boolean which indicates if the specified
* address is the starting address of a branch instruction.
*
@@ -304,9 +325,9 @@ namespace Coverage {
*/
bool isStartOfInstruction;
/*!
- * This member indicates that the address was executed.
+ * This member indicates how many times the address was executed.
*/
- bool wasExecuted;
+ uint32_t wasExecuted;
/*!
* This member indicates that the address is a branch instruction.
*/
diff --git a/covoar/DesiredSymbols.cc b/covoar/DesiredSymbols.cc
index cc20776..0b0be0f 100644
--- a/covoar/DesiredSymbols.cc
+++ b/covoar/DesiredSymbols.cc
@@ -629,6 +629,7 @@ namespace Coverage {
uint32_t sAddress;
uint32_t sBaseAddress;
uint32_t sMapSize;
+ uint32_t executionCount;
// Ensure that the symbol is a desired symbol.
itr = set.find( symbolName );
@@ -673,8 +674,8 @@ namespace Coverage {
destinationCoverageMap->setIsStartOfInstruction( dAddress );
// Merge the execution data.
- if (sourceCoverageMap->wasExecuted( sAddress ))
- destinationCoverageMap->setWasExecuted( dAddress );
+ executionCount = sourceCoverageMap->getWasExecuted( sAddress );
+ destinationCoverageMap->sumWasExecuted( dAddress, executionCount );
// Merge the branch data.
if (sourceCoverageMap->wasTaken( sAddress ))
diff --git a/covoar/covoar.cc b/covoar/covoar.cc
index 80324c2..b349f78 100644
--- a/covoar/covoar.cc
+++ b/covoar/covoar.cc
@@ -81,7 +81,6 @@ void usage()
*/
#include "ConfigFile.h"
Configuration::FileReader *CoverageConfiguration;
-
Configuration::Options_t Options[] = {
{ "explanations", NULL },
{ "format", NULL },