summaryrefslogtreecommitdiffstats
path: root/covoar
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-08-31 20:44:25 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-08-31 20:44:25 +0000
commit9cd7fc9b9cadaa8cf955ef9d2c5cb72968d7612e (patch)
tree3ee74421ec3ffff86541993400871f82c2243917 /covoar
parent2011-08-31 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-testing-9cd7fc9b9cadaa8cf955ef9d2c5cb72968d7612e.tar.bz2
*** empty log message ***
Diffstat (limited to 'covoar')
-rw-r--r--covoar/ChangeLog12
-rw-r--r--covoar/CoverageMapBase.cc66
-rw-r--r--covoar/CoverageMapBase.h55
-rw-r--r--covoar/DesiredSymbols.cc18
-rw-r--r--covoar/DesiredSymbols.h2
-rw-r--r--covoar/app_common.cc1
-rw-r--r--covoar/app_common.h1
7 files changed, 133 insertions, 22 deletions
diff --git a/covoar/ChangeLog b/covoar/ChangeLog
index c28b69e..4affb54 100644
--- a/covoar/ChangeLog
+++ b/covoar/ChangeLog
@@ -1,3 +1,15 @@
+2011-08-31 Pawel Zagorski <pzagor@agh.edu.pl>
+
+ * covoar/CoverageMapBase.cc, covoar/CoverageMapBase.h,
+ covoar/DesiredSymbols.cc, covoar/DesiredSymbols.h,
+ covoar/app_common.cc, covoar/app_common.h,
+ rtems-coverage/do_coverage:
+ Modified do_coverage script and source code to gather information
+ about object files from which symbols originate. Changed tracking
+ of "branch was taken" and "branch was not taken" from booleans to
+ counters. Change propagated and new helper methods added:
+ (getWasTaken, getWasNotTaken, sumWasTaken, sumWasNotTaken)
+
2011-08-21 Pawel Zagorski <pzagor@agh.edu.pl>
PR 1900/testing
diff --git a/covoar/CoverageMapBase.cc b/covoar/CoverageMapBase.cc
index 6141127..2dd814b 100644
--- a/covoar/CoverageMapBase.cc
+++ b/covoar/CoverageMapBase.cc
@@ -43,8 +43,8 @@ namespace Coverage {
i->wasExecuted = 0;
i->isBranch = false;
i->isNop = false;
- i->wasTaken = false;
- i->wasNotTaken = false;
+ i->wasTaken = 0;
+ i->wasNotTaken = 0;
}
}
@@ -292,7 +292,7 @@ namespace Coverage {
if (determineOffset( address, &offset ) != true)
return;
- Info[ offset ].wasTaken = true;
+ Info[ offset ].wasTaken += 1;
}
void CoverageMapBase::setWasNotTaken(
@@ -304,7 +304,7 @@ namespace Coverage {
if (determineOffset( address, &offset ) != true)
return;
- Info[ offset ].wasNotTaken = true;
+ Info[ offset ].wasNotTaken += 1;
}
bool CoverageMapBase::wasAlwaysTaken( uint32_t address ) const
@@ -331,10 +331,36 @@ namespace Coverage {
bool CoverageMapBase::wasNotTaken( uint32_t address ) const
{
+ uint32_t offset;
+ bool result;
+
+ result = true;
+
+ if (determineOffset( address, &offset ) != true)
+ result = false;
+
+ if (Info[ offset ].wasNotTaken <= 0)
+ result = false;
+
+ return result;
+ }
+
+ void CoverageMapBase::sumWasNotTaken( uint32_t address, uint32_t addition)
+ {
uint32_t offset;
-
+
if (determineOffset( address, &offset ) != true)
- return false;
+ return;
+
+ Info[ offset ].wasNotTaken += addition;
+ }
+
+ uint32_t CoverageMapBase::getWasNotTaken( uint32_t address ) const
+ {
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
+ return 0;
return Info[ offset ].wasNotTaken;
}
@@ -342,9 +368,35 @@ namespace Coverage {
bool CoverageMapBase::wasTaken( uint32_t address ) const
{
uint32_t offset;
+ bool result;
+
+ result = true;
if (determineOffset( address, &offset ) != true)
- return false;
+ result = false;
+
+ if (Info[ offset ].wasTaken <= 0)
+ result = false;
+
+ return result;
+ }
+
+ void CoverageMapBase::sumWasTaken( uint32_t address, uint32_t addition)
+ {
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
+ return;
+
+ Info[ offset ].wasTaken += addition;
+ }
+
+ uint32_t CoverageMapBase::getWasTaken( uint32_t address ) const
+ {
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
+ return 0;
return Info[ offset ].wasTaken;
}
diff --git a/covoar/CoverageMapBase.h b/covoar/CoverageMapBase.h
index bdf10a0..ab21a5c 100644
--- a/covoar/CoverageMapBase.h
+++ b/covoar/CoverageMapBase.h
@@ -253,22 +253,65 @@ namespace Coverage {
bool isBranch( uint32_t address ) const;
/*!
- * This method sets the boolean which indicates if the branch
- * at the specified address was taken.
+ * This method increments the counter which indicates how many times
+ * the branch at the specified address was taken.
*
* @param[in] address specifies the address of the branch instruction
*/
void setWasTaken( uint32_t address );
/*!
- * This method sets the boolean which indicates if the branch
- * at the specified address was NOT taken.
+ * This method increases the counter which indicates how many times
+ * the branch at the specified address was taken. 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 sumWasTaken( uint32_t address, uint32_t addition );
+
+ /*!
+ * This method returns an unsigned integer which indicates how often
+ * the branch at the specified address was taken.
+ *
+ * @param[in] address specifies the address to check
+ *
+ * @return Returns number of executins
+ */
+ uint32_t getWasTaken( uint32_t address ) const;
+
+ /*!
+ * This method increments the counter which indicates how many times
+ * the branch at the specified address was not taken.
*
* @param[in] address specifies the address of the branch instruction
*/
void setWasNotTaken( uint32_t address );
/*!
+ * This method increases the counter which indicates how many times
+ * the branch at the specified address was not taken. 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 sumWasNotTaken( uint32_t address, uint32_t addition );
+
+ /*!
+ * This method returns an unsigned integer which indicates how often
+ * the branch at the specified address was not taken.
+ *
+ * @param[in] address specifies the address to check
+ *
+ * @return Returns number of executins
+ */
+ uint32_t getWasNotTaken( uint32_t address ) const;
+
+
+ /*!
* This method returns a boolean which indicates if the branch
* instruction at the specified address is ALWAYS taken.
*
@@ -340,12 +383,12 @@ namespace Coverage {
* When isBranch is TRUE, this member indicates that the branch
* instruction at the address was taken.
*/
- bool wasTaken;
+ uint32_t wasTaken;
/*!
* When isBranch is TRUE, this member indicates that the branch
* instruction at the address was NOT taken.
*/
- bool wasNotTaken;
+ uint32_t wasNotTaken;
} perAddressInfo_t;
/*!
diff --git a/covoar/DesiredSymbols.cc b/covoar/DesiredSymbols.cc
index 0b0be0f..c3afd32 100644
--- a/covoar/DesiredSymbols.cc
+++ b/covoar/DesiredSymbols.cc
@@ -34,7 +34,7 @@ namespace Coverage {
const char* const symbolsFile
)
{
- char* cStatus;
+ int cStatus;
bool done = false;
FILE* sFile;
SymbolInformation* symInfo;
@@ -69,12 +69,14 @@ namespace Coverage {
// Skip blank lines between symbols
do {
inputBuffer[0] = '\0';
- cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, sFile );
- if ( cStatus == NULL ) {
+ inputBuffer2[0] = '\0';
+ cStatus = fscanf( sFile, "%s %s", inputBuffer, inputBuffer2 );
+ //TODO: Store inputBuffer2 value containing symbol source file
+ if ( cStatus == EOF ) {
done = true;
}
else {
- inputBuffer[ strlen(inputBuffer) - 1] = '\0';
+ //inputBuffer[ strlen(inputBuffer) - 1] = '\0';
line++;
}
} while ( !done && (inputBuffer[0] == '\0') );
@@ -678,11 +680,11 @@ namespace Coverage {
destinationCoverageMap->sumWasExecuted( dAddress, executionCount );
// Merge the branch data.
- if (sourceCoverageMap->wasTaken( sAddress ))
- destinationCoverageMap->setWasTaken( dAddress );
+ executionCount = sourceCoverageMap->getWasTaken( sAddress );
+ destinationCoverageMap->sumWasTaken( dAddress, executionCount );
- if (sourceCoverageMap->wasNotTaken( sAddress ))
- destinationCoverageMap->setWasNotTaken( dAddress );
+ executionCount = sourceCoverageMap->getWasNotTaken( sAddress );
+ destinationCoverageMap->sumWasNotTaken( dAddress, executionCount );
}
}
diff --git a/covoar/DesiredSymbols.h b/covoar/DesiredSymbols.h
index 5911766..ce7c36c 100644
--- a/covoar/DesiredSymbols.h
+++ b/covoar/DesiredSymbols.h
@@ -190,7 +190,7 @@ namespace Coverage {
typedef std::map<std::string, SymbolInformation> symbolSet_t;
/*!
- * This variable contains a map of ymbol sets for each
+ * This variable contains a map of symbol sets for each
* symbol in the system keyed on the symbol name.
*/
symbolSet_t set;
diff --git a/covoar/app_common.cc b/covoar/app_common.cc
index 47b69b0..de814a7 100644
--- a/covoar/app_common.cc
+++ b/covoar/app_common.cc
@@ -35,6 +35,7 @@ Target::TargetBase* TargetInfo = NULL;
const char* dynamicLibrary = NULL;
const char* projectName = NULL;
char inputBuffer[MAX_LINE_LENGTH];
+char inputBuffer2[MAX_LINE_LENGTH];
bool FileIsNewer(
diff --git a/covoar/app_common.h b/covoar/app_common.h
index 04a5c5b..70c4e41 100644
--- a/covoar/app_common.h
+++ b/covoar/app_common.h
@@ -23,6 +23,7 @@ extern const char* projectName;
#define MAX_LINE_LENGTH 512
extern char inputBuffer[MAX_LINE_LENGTH];
+extern char inputBuffer2[MAX_LINE_LENGTH];
bool FileIsNewer( const char *f1, const char *f2 );