From: Hermann Felbinger <hermann19...@gmail.com> --- tester/covoar/CoverageMap.cc | 7 ++++--- tester/covoar/CoverageMap.h | 5 +++-- tester/covoar/CoverageMapBase.cc | 6 ++++-- tester/covoar/CoverageMapBase.h | 11 +++++++++-- tester/covoar/DesiredSymbols.cc | 25 ++++++++++++++++++------- tester/covoar/DesiredSymbols.h | 25 ++++++++++++++----------- tester/covoar/ExecutableInfo.cc | 3 ++- tester/covoar/ExecutableInfo.h | 2 ++ tester/covoar/ObjdumpProcessor.cc | 21 +++++++++++---------- 9 files changed, 67 insertions(+), 38 deletions(-)
diff --git a/tester/covoar/CoverageMap.cc b/tester/covoar/CoverageMap.cc index 816be11..b470fea 100644 --- a/tester/covoar/CoverageMap.cc +++ b/tester/covoar/CoverageMap.cc @@ -10,9 +10,10 @@ namespace Coverage { CoverageMap::CoverageMap( - uint32_t low, - uint32_t high - ) : CoverageMapBase(low, high) + const std::string& exefileName, + uint32_t low, + uint32_t high + ) : CoverageMapBase(exefileName, low, high) { } diff --git a/tester/covoar/CoverageMap.h b/tester/covoar/CoverageMap.h index 0f2f6d4..c211949 100644 --- a/tester/covoar/CoverageMap.h +++ b/tester/covoar/CoverageMap.h @@ -27,8 +27,9 @@ namespace Coverage { * @param[in] high specifies the highest address of the coverage map. */ CoverageMap( - uint32_t low, - uint32_t high + const std::string& exefileName, + uint32_t low, + uint32_t high ); /* Inherit documentation from base class. */ diff --git a/tester/covoar/CoverageMapBase.cc b/tester/covoar/CoverageMapBase.cc index 407ef5f..ed30603 100644 --- a/tester/covoar/CoverageMapBase.cc +++ b/tester/covoar/CoverageMapBase.cc @@ -16,13 +16,15 @@ namespace Coverage { CoverageMapBase::CoverageMapBase( - uint32_t low, - uint32_t high + const std::string& exefileName, + uint32_t low, + uint32_t high ) { uint32_t a; AddressRange_t range; + range.fileName = exefileName; range.lowAddress = low; range.highAddress = high; RangeList.push_back( range ); diff --git a/tester/covoar/CoverageMapBase.h b/tester/covoar/CoverageMapBase.h index 70b2b30..e1310c9 100644 --- a/tester/covoar/CoverageMapBase.h +++ b/tester/covoar/CoverageMapBase.h @@ -28,6 +28,11 @@ namespace Coverage { */ typedef struct { /*! + * This is the file from which this originated. + */ + std::string fileName; + + /*! * This is the low address of the address map range. */ uint32_t lowAddress; @@ -48,12 +53,14 @@ namespace Coverage { /*! * This method constructs a CoverageMapBase instance. * + * @param[in] exefileName specifies the executable this originated in * @param[in] low specifies the lowest address of the coverage map * @param[in] high specifies the highest address of the coverage map */ CoverageMapBase( - uint32_t low, - uint32_t high + const std::string& exefileName, + uint32_t low, + uint32_t high ); /*! diff --git a/tester/covoar/DesiredSymbols.cc b/tester/covoar/DesiredSymbols.cc index b5032b4..60bc7f7 100644 --- a/tester/covoar/DesiredSymbols.cc +++ b/tester/covoar/DesiredSymbols.cc @@ -335,6 +335,7 @@ namespace Coverage { void DesiredSymbols::createCoverageMap( + const std::string& exefileName, const std::string& symbolName, uint32_t size ) @@ -363,19 +364,27 @@ namespace Coverage { // ensure that the specified size matches the existing size. if (itr->second.stats.sizeInBytes != size) { + // Changed ERROR to INFO because size mismatch is not treated as + // error anymore. + // Set smallest size as size and continue. + // Update value for longer byte size. + // 2015-07-22 fprintf( stderr, - "ERROR: DesiredSymbols::createCoverageMap - Attempt to create " - "unified coverage maps for %s with different sizes (%d != %d)\n", + "INFO: DesiredSymbols::createCoverageMap - Attempt to create " + "unified coverage maps for %s with different sizes (%s/%d != %s/%d)\n", + symbolName.c_str(), + exefileName.c_str(), itr->second.stats.sizeInBytes, + itr->second.sourceFile->getFileName().c_str(), size ); + if ( itr->second.stats.sizeInBytes < size ) itr->second.stats.sizeInBytes = size; else size = itr->second.stats.sizeInBytes; - // exit( -1 ); } } @@ -384,13 +393,14 @@ namespace Coverage { highAddress = size - 1; - aCoverageMap = new CoverageMap( 0, highAddress ); + aCoverageMap = new CoverageMap( exefileName, 0, highAddress ); if (!aCoverageMap) { fprintf( stderr, "ERROR: DesiredSymbols::createCoverageMap - Unable to allocate " - "coverage map for %s\n", + "coverage map for %s:%s\n", + exefileName.c_str(), symbolName.c_str() ); exit( -1 ); @@ -653,6 +663,8 @@ namespace Coverage { // Ensure that the source and destination coverage maps // are the same size. + // Changed from ERROR msg to INFO, because size mismatch is not + // treated as error anymore. 2015-07-20 dMapSize = itr->second.stats.sizeInBytes; sBaseAddress = sourceCoverageMap->getFirstLowAddress(); sMapSize = sourceCoverageMap->getSize(); @@ -660,12 +672,11 @@ namespace Coverage { fprintf( stderr, - "ERROR: DesiredSymbols::mergeCoverageMap - Unable to merge " + "INFO: DesiredSymbols::mergeCoverageMap - Unable to merge " "coverage map for %s because the sizes are different\n", symbolName.c_str() ); return; - // exit( -1 ); } // Merge the data for each address. diff --git a/tester/covoar/DesiredSymbols.h b/tester/covoar/DesiredSymbols.h index 448f263..9524c64 100644 --- a/tester/covoar/DesiredSymbols.h +++ b/tester/covoar/DesiredSymbols.h @@ -20,8 +20,8 @@ namespace Coverage { - /*! - * + /*! + * * This class defines the statistics that are tracked. */ class Statistics { @@ -34,7 +34,7 @@ namespace Coverage { int branchesAlwaysTaken; /*! - * This member variable contains the total number of branches where + * This member variable contains the total number of branches where * one or more paths were executed. */ int branchesExecuted; @@ -55,7 +55,7 @@ namespace Coverage { * This member contains the size in Bytes. */ uint32_t sizeInBytes; - + /*! * This member contains the size in Bytes. */ @@ -93,7 +93,7 @@ namespace Coverage { /*! * This method constructs a Statistics instance. - */ + */ Statistics(): branchesAlwaysTaken(0), branchesExecuted(0), @@ -137,7 +137,7 @@ namespace Coverage { /*! * This member contains the statistics kept on each symbol. - */ + */ Statistics stats; /*! @@ -186,24 +186,24 @@ namespace Coverage { typedef std::map<std::string, SymbolInformation> symbolSet_t; /*! - * This variable contains a map of symbol 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; - /*! + /*! * This method constructs a DesiredSymbols instance. */ DesiredSymbols(); - /*! + /*! * This method destructs a DesiredSymbols instance. */ ~DesiredSymbols(); /*! * This method loops through the coverage map and - * calculates the statistics that have not already + * calculates the statistics that have not already * been filled in. */ void calculateStatistics( void ); @@ -218,11 +218,14 @@ namespace Coverage { * This method creates a coverage map for the specified symbol * using the specified size. * + * @param[in] exefileName specifies the executable from which the + * coverage map is being created * @param[in] symbolName specifies the symbol for which to create * a coverage map * @param[in] size specifies the size of the coverage map to create */ void createCoverageMap( + const std::string& exefileName, const std::string& symbolName, uint32_t size ); @@ -316,7 +319,7 @@ namespace Coverage { /*! * This member contains the statistics kept on each symbol. - */ + */ Statistics stats; private: diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc index 0a7eac3..d71c435 100644 --- a/tester/covoar/ExecutableInfo.cc +++ b/tester/covoar/ExecutableInfo.cc @@ -89,6 +89,7 @@ namespace Coverage { } CoverageMapBase* ExecutableInfo::createCoverageMap ( + const std::string& fileName, const std::string& symbolName, uint32_t lowAddress, uint32_t highAddress @@ -99,7 +100,7 @@ namespace Coverage { itr = coverageMaps.find( symbolName ); if ( itr == coverageMaps.end() ) { - theMap = new CoverageMap( lowAddress, highAddress ); + theMap = new CoverageMap( fileName, lowAddress, highAddress ); coverageMaps[ symbolName ] = theMap; } else { theMap = itr->second; diff --git a/tester/covoar/ExecutableInfo.h b/tester/covoar/ExecutableInfo.h index ca4184a..7242715 100644 --- a/tester/covoar/ExecutableInfo.h +++ b/tester/covoar/ExecutableInfo.h @@ -93,6 +93,7 @@ namespace Coverage { /*! * This method creates a coverage map for the specified symbol. * + * @param[in] exefileName specifies the source of the information * @param[in] symbolName specifies the name of the symbol * @param[in] lowAddress specifies the low address of the coverage map * @param[in] highAddress specifies the high address of the coverage map @@ -100,6 +101,7 @@ namespace Coverage { * @return Returns a pointer to the coverage map */ CoverageMapBase* createCoverageMap ( + const std::string& exefileName, const std::string& symbolName, uint32_t lowAddress, uint32_t highAddress diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc index 486c720..262c0a5 100644 --- a/tester/covoar/ObjdumpProcessor.cc +++ b/tester/covoar/ObjdumpProcessor.cc @@ -3,7 +3,7 @@ * * This file contains the implementation of the functions supporting * the reading of an objdump output file and adding nops to a - * coverage map. + * coverage map. */ #include <assert.h> @@ -97,7 +97,7 @@ namespace Coverage { // Create a coverage map for the symbol. aCoverageMap = executableInfo->createCoverageMap( - symbolName, lowAddress, endAddress + executableInfo->getFileName().c_str(), symbolName, lowAddress, endAddress ); if (aCoverageMap) { @@ -112,7 +112,8 @@ namespace Coverage { // Create a unified coverage map for the symbol. SymbolsToAnalyze->createCoverageMap( - symbolName, endAddress - lowAddress + 1 + executableInfo->getFileName().c_str(), symbolName, + endAddress - lowAddress + 1 ); } } @@ -170,7 +171,7 @@ namespace Coverage { std::string tmp = inLibName; if ( tmp.find( Library ) != tmp.npos ) { // fprintf( stderr, "%s - 0x%08x\n", inLibName, offset ); - address = offset; + address = offset; break; } } @@ -182,9 +183,9 @@ namespace Coverage { } bool ObjdumpProcessor::IsBranch( - const char *instruction + const char *instruction ) - { + { if ( !TargetInfo ) { fprintf( stderr, @@ -230,7 +231,7 @@ namespace Coverage { return TargetInfo->isNopLine( line, size ); } - FILE* ObjdumpProcessor::getFile( std::string fileName ) + FILE* ObjdumpProcessor::getFile( std::string fileName ) { char dumpFile[128]; FILE* objdumpFile; @@ -238,7 +239,7 @@ namespace Coverage { int status; sprintf( dumpFile, "%s.dmp", fileName.c_str() ); - + // Generate the objdump. if (FileIsNewer( fileName.c_str(), dumpFile )) { sprintf( @@ -259,7 +260,7 @@ namespace Coverage { ); exit( -1 ); } - } + } // Open the objdump file. objdumpFile = fopen( dumpFile, "r" ); @@ -283,7 +284,7 @@ namespace Coverage { if (itr == objdumpList.end()) { return 0; } - + itr++; if (itr == objdumpList.end()) { return 0; -- 2.7.4 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel