mirror of
https://git.rtems.org/rtems-tools/
synced 2025-06-15 15:49:23 +08:00
Remove SymbolsToAnalyze global variable
- Removed SymbolsToAnalyze from app_common and replaced it with the symbolsToAnalyze_m member variable in DesiredSymbols, GcovData, and ObjdumpProcessor - Added a parameter to constructors to initialize symbolsToAnalyze_m - Moved the definition of objdumpLine_t out of ObjdumpProcessor to make it work with DesiredSymbols
This commit is contained in:
parent
d5178b8dc5
commit
a1d0e5515e
@ -25,7 +25,6 @@
|
|||||||
#include "DesiredSymbols.h"
|
#include "DesiredSymbols.h"
|
||||||
#include "app_common.h"
|
#include "app_common.h"
|
||||||
#include "CoverageMap.h"
|
#include "CoverageMap.h"
|
||||||
#include "ObjdumpProcessor.h"
|
|
||||||
|
|
||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
|
|
||||||
@ -116,10 +115,10 @@ namespace Coverage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesiredSymbols::preprocess( void )
|
void DesiredSymbols::preprocess( const DesiredSymbols& symbolsToAnalyze )
|
||||||
{
|
{
|
||||||
// Look at each symbol.
|
// Look at each symbol.
|
||||||
for (auto& s : SymbolsToAnalyze->set) {
|
for (auto& s : symbolsToAnalyze.set) {
|
||||||
// If the unified coverage map does not exist, the symbol was
|
// If the unified coverage map does not exist, the symbol was
|
||||||
// never referenced by any executable. Just skip it.
|
// never referenced by any executable. Just skip it.
|
||||||
CoverageMapBase* theCoverageMap = s.second.unifiedCoverageMap;
|
CoverageMapBase* theCoverageMap = s.second.unifiedCoverageMap;
|
||||||
@ -441,10 +440,13 @@ namespace Coverage {
|
|||||||
return &set[ symbolName ];
|
return &set[ symbolName ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesiredSymbols::findSourceForUncovered( bool verbose )
|
void DesiredSymbols::findSourceForUncovered(
|
||||||
|
bool verbose,
|
||||||
|
const DesiredSymbols& symbolsToAnalyze
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Process uncovered ranges and/or branches for each symbol.
|
// Process uncovered ranges and/or branches for each symbol.
|
||||||
for (auto& d : SymbolsToAnalyze->set) {
|
for (auto& d : symbolsToAnalyze.set) {
|
||||||
// First the unexecuted ranges, ...
|
// First the unexecuted ranges, ...
|
||||||
CoverageRanges* theRanges = d.second.uncoveredRanges;
|
CoverageRanges* theRanges = d.second.uncoveredRanges;
|
||||||
if (theRanges != nullptr) {
|
if (theRanges != nullptr) {
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
|
|
||||||
|
class ObjdumpProcessor;
|
||||||
|
struct objdumpLine_t;
|
||||||
|
class ExecutableInfo;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
@ -139,7 +143,7 @@ namespace Coverage {
|
|||||||
/*!
|
/*!
|
||||||
* This member contains the disassembly associated with a symbol.
|
* This member contains the disassembly associated with a symbol.
|
||||||
*/
|
*/
|
||||||
std::list<ObjdumpProcessor::objdumpLine_t> instructions;
|
std::list<objdumpLine_t> instructions;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This member contains the executable that was used to
|
* This member contains the executable that was used to
|
||||||
@ -263,8 +267,12 @@ namespace Coverage {
|
|||||||
* uncovered ranges or branches.
|
* uncovered ranges or branches.
|
||||||
*
|
*
|
||||||
* @param[in] verbose specifies whether to be verbose with output
|
* @param[in] verbose specifies whether to be verbose with output
|
||||||
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
*/
|
*/
|
||||||
void findSourceForUncovered( bool verbose );
|
void findSourceForUncovered(
|
||||||
|
bool verbose,
|
||||||
|
const DesiredSymbols& symbolsToAnalyze
|
||||||
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This method returns the total number of branches always taken
|
* This method returns the total number of branches always taken
|
||||||
@ -398,8 +406,10 @@ namespace Coverage {
|
|||||||
/*!
|
/*!
|
||||||
* This method preprocesses each symbol's coverage map to mark nop
|
* This method preprocesses each symbol's coverage map to mark nop
|
||||||
* and branch information.
|
* and branch information.
|
||||||
|
*
|
||||||
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
*/
|
*/
|
||||||
void preprocess( void );
|
void preprocess( const DesiredSymbols& symbolsToAnalyze );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
#include <rld.h>
|
#include <rld.h>
|
||||||
|
|
||||||
#include "ExecutableInfo.h"
|
#include "ExecutableInfo.h"
|
||||||
|
#include "ObjdumpProcessor.h"
|
||||||
#include "app_common.h"
|
#include "app_common.h"
|
||||||
#include "CoverageMap.h"
|
#include "CoverageMap.h"
|
||||||
#include "DesiredSymbols.h"
|
|
||||||
#include "SymbolTable.h"
|
#include "SymbolTable.h"
|
||||||
|
|
||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
@ -20,9 +20,11 @@ namespace Coverage {
|
|||||||
ExecutableInfo::ExecutableInfo(
|
ExecutableInfo::ExecutableInfo(
|
||||||
const char* const theExecutableName,
|
const char* const theExecutableName,
|
||||||
const std::string& theLibraryName,
|
const std::string& theLibraryName,
|
||||||
bool verbose
|
bool verbose,
|
||||||
|
DesiredSymbols& symbolsToAnalyze
|
||||||
) : fileName(theExecutableName),
|
) : fileName(theExecutableName),
|
||||||
loadAddress(0)
|
loadAddress(0),
|
||||||
|
symbolsToAnalyze_m(symbolsToAnalyze)
|
||||||
{
|
{
|
||||||
if ( !theLibraryName.empty() )
|
if ( !theLibraryName.empty() )
|
||||||
libraryName = theLibraryName;
|
libraryName = theLibraryName;
|
||||||
@ -59,7 +61,7 @@ namespace Coverage {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SymbolsToAnalyze->isDesired(func.name())) {
|
if (!symbolsToAnalyze_m.isDesired(func.name())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,8 +211,8 @@ namespace Coverage {
|
|||||||
|
|
||||||
void ExecutableInfo::mergeCoverage( void ) {
|
void ExecutableInfo::mergeCoverage( void ) {
|
||||||
for (auto& cm : coverageMaps) {
|
for (auto& cm : coverageMaps) {
|
||||||
if (SymbolsToAnalyze->isDesired( cm.first ))
|
if (symbolsToAnalyze_m.isDesired( cm.first ))
|
||||||
SymbolsToAnalyze->mergeCoverageMap( cm.first, cm.second );
|
symbolsToAnalyze_m.mergeCoverageMap( cm.first, cm.second );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,9 +18,12 @@
|
|||||||
#include "AddressToLineMapper.h"
|
#include "AddressToLineMapper.h"
|
||||||
#include "CoverageMapBase.h"
|
#include "CoverageMapBase.h"
|
||||||
#include "SymbolTable.h"
|
#include "SymbolTable.h"
|
||||||
|
#include "DesiredSymbols.h"
|
||||||
|
|
||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
|
|
||||||
|
class DesiredSymbols;
|
||||||
|
|
||||||
/*! @class ExecutableInfo
|
/*! @class ExecutableInfo
|
||||||
*
|
*
|
||||||
* This class holds a collection of information for an executable
|
* This class holds a collection of information for an executable
|
||||||
@ -41,11 +44,13 @@ namespace Coverage {
|
|||||||
* @param[in] theExecutableName specifies the name of the executable
|
* @param[in] theExecutableName specifies the name of the executable
|
||||||
* @param[in] theLibraryName specifies the name of the executable
|
* @param[in] theLibraryName specifies the name of the executable
|
||||||
* @param[in] verbose specifies whether to be verbose with output
|
* @param[in] verbose specifies whether to be verbose with output
|
||||||
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
*/
|
*/
|
||||||
ExecutableInfo(
|
ExecutableInfo(
|
||||||
const char* const theExecutableName,
|
const char* const theExecutableName,
|
||||||
const std::string& theLibraryName = "",
|
const std::string& theLibraryName,
|
||||||
bool verbose = false
|
bool verbose,
|
||||||
|
DesiredSymbols& symbolsToAnalyze
|
||||||
);
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -198,6 +203,11 @@ namespace Coverage {
|
|||||||
*/
|
*/
|
||||||
SymbolTable theSymbolTable;
|
SymbolTable theSymbolTable;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains the symbols to be analyzed.
|
||||||
|
*/
|
||||||
|
DesiredSymbols& symbolsToAnalyze_m;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,9 +25,10 @@
|
|||||||
|
|
||||||
namespace Gcov {
|
namespace Gcov {
|
||||||
|
|
||||||
GcovData::GcovData()
|
GcovData::GcovData( Coverage::DesiredSymbols& symbolsToAnalyze ):
|
||||||
|
numberOfFunctions( 0 ),
|
||||||
|
symbolsToAnalyze_m( symbolsToAnalyze )
|
||||||
{
|
{
|
||||||
numberOfFunctions = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GcovData::~GcovData()
|
GcovData::~GcovData()
|
||||||
@ -416,7 +417,7 @@ namespace Gcov {
|
|||||||
function->setChecksum( intBuffer[1] );
|
function->setChecksum( intBuffer[1] );
|
||||||
|
|
||||||
header.length -= readString( buffer, gcovFile );
|
header.length -= readString( buffer, gcovFile );
|
||||||
function->setFunctionName( buffer );
|
function->setFunctionName( buffer, symbolsToAnalyze_m );
|
||||||
header.length -= readString( buffer, gcovFile );
|
header.length -= readString( buffer, gcovFile );
|
||||||
function->setFileName( buffer );
|
function->setFileName( buffer );
|
||||||
status = fread( &intBuffer, 4, header.length, gcovFile );
|
status = fread( &intBuffer, 4, header.length, gcovFile );
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "GcovFunctionData.h"
|
#include "GcovFunctionData.h"
|
||||||
|
#include "DesiredSymbols.h"
|
||||||
|
|
||||||
namespace Gcov {
|
namespace Gcov {
|
||||||
|
|
||||||
@ -56,6 +57,8 @@ struct gcov_statistics
|
|||||||
uint64_t sumMax; // sum of individual runs max values
|
uint64_t sumMax; // sum of individual runs max values
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DesiredSymbols;
|
||||||
|
|
||||||
/*! @class GcovData
|
/*! @class GcovData
|
||||||
*
|
*
|
||||||
* This is the specification of the GcovData class.
|
* This is the specification of the GcovData class.
|
||||||
@ -66,8 +69,10 @@ struct gcov_statistics
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This method constructs a GcnoReader instance.
|
* This method constructs a GcnoReader instance.
|
||||||
|
*
|
||||||
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
*/
|
*/
|
||||||
GcovData();
|
GcovData( Coverage::DesiredSymbols& symbolsToAnalyze );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This method destructs a GcnoReader instance.
|
* This method destructs a GcnoReader instance.
|
||||||
@ -194,6 +199,11 @@ struct gcov_statistics
|
|||||||
* to a specified report file
|
* to a specified report file
|
||||||
*/
|
*/
|
||||||
void printGcnoFileInfo( FILE * textFile );
|
void printGcnoFileInfo( FILE * textFile );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains the symbols to be analyzed
|
||||||
|
*/
|
||||||
|
Coverage::DesiredSymbols& symbolsToAnalyze_m;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "GcovFunctionData.h"
|
#include "GcovFunctionData.h"
|
||||||
#include "ObjdumpProcessor.h"
|
#include "ObjdumpProcessor.h"
|
||||||
#include "CoverageMapBase.h"
|
#include "CoverageMapBase.h"
|
||||||
|
#include "DesiredSymbols.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Gcov {
|
namespace Gcov {
|
||||||
@ -44,7 +45,10 @@ namespace Gcov {
|
|||||||
firstLineNumber = lineNo;
|
firstLineNumber = lineNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GcovFunctionData::setFunctionName( const char* fcnName )
|
bool GcovFunctionData::setFunctionName(
|
||||||
|
const char* fcnName,
|
||||||
|
Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
|
)
|
||||||
{
|
{
|
||||||
std::string symbolName;
|
std::string symbolName;
|
||||||
|
|
||||||
@ -62,7 +66,7 @@ namespace Gcov {
|
|||||||
strcpy (functionName, fcnName);
|
strcpy (functionName, fcnName);
|
||||||
|
|
||||||
// Tie function to its coverage map
|
// Tie function to its coverage map
|
||||||
symbolInfo = SymbolsToAnalyze->find( symbolName );
|
symbolInfo = symbolsToAnalyze.find( symbolName );
|
||||||
if ( symbolInfo != NULL )
|
if ( symbolInfo != NULL )
|
||||||
coverageMap = symbolInfo->unifiedCoverageMap;
|
coverageMap = symbolInfo->unifiedCoverageMap;
|
||||||
|
|
||||||
@ -237,7 +241,7 @@ namespace Gcov {
|
|||||||
uint32_t baseAddress = 0;
|
uint32_t baseAddress = 0;
|
||||||
uint32_t baseSize;
|
uint32_t baseSize;
|
||||||
uint32_t currentAddress;
|
uint32_t currentAddress;
|
||||||
std::list<Coverage::ObjdumpProcessor::objdumpLine_t>::iterator instruction;
|
std::list<Coverage::objdumpLine_t>::iterator instruction;
|
||||||
|
|
||||||
if ( coverageMap != NULL ) {
|
if ( coverageMap != NULL ) {
|
||||||
|
|
||||||
@ -399,7 +403,7 @@ namespace Gcov {
|
|||||||
|
|
||||||
uint32_t baseAddress = 0;
|
uint32_t baseAddress = 0;
|
||||||
uint32_t currentAddress = 0;
|
uint32_t currentAddress = 0;
|
||||||
std::list<Coverage::ObjdumpProcessor::objdumpLine_t>::iterator instruction;
|
std::list<Coverage::objdumpLine_t>::iterator instruction;
|
||||||
blocks_iterator_t blockIterator;
|
blocks_iterator_t blockIterator;
|
||||||
blocks_iterator_t blockIterator2;
|
blocks_iterator_t blockIterator2;
|
||||||
arcs_iterator_t arcIterator;
|
arcs_iterator_t arcIterator;
|
||||||
@ -567,7 +571,7 @@ namespace Gcov {
|
|||||||
{
|
{
|
||||||
uint32_t baseAddress = 0;
|
uint32_t baseAddress = 0;
|
||||||
uint32_t currentAddress;
|
uint32_t currentAddress;
|
||||||
std::list<Coverage::ObjdumpProcessor::objdumpLine_t>::iterator instruction;
|
std::list<Coverage::objdumpLine_t>::iterator instruction;
|
||||||
|
|
||||||
if ( coverageMap == NULL )
|
if ( coverageMap == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
@ -44,6 +44,8 @@ typedef std::list<gcov_arc_info>::iterator arcs_iterator_t;
|
|||||||
typedef std::list<gcov_block_info> blocks_t;
|
typedef std::list<gcov_block_info> blocks_t;
|
||||||
typedef std::list<gcov_block_info>::iterator blocks_iterator_t;
|
typedef std::list<gcov_block_info>::iterator blocks_iterator_t;
|
||||||
|
|
||||||
|
class DesiredSymbols;
|
||||||
|
|
||||||
/*! @class GcovFunctionData
|
/*! @class GcovFunctionData
|
||||||
*
|
*
|
||||||
* This is the specification of the GcovFunctionData class.
|
* This is the specification of the GcovFunctionData class.
|
||||||
@ -94,11 +96,13 @@ typedef std::list<gcov_block_info>::iterator blocks_iterator_t;
|
|||||||
* unified coverage map.
|
* unified coverage map.
|
||||||
*
|
*
|
||||||
* @param[in] functionName passes name of the the function
|
* @param[in] functionName passes name of the the function
|
||||||
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
*
|
*
|
||||||
* @return Returns TRUE if the method succeeded and FALSE if it failed.
|
* @return Returns TRUE if the method succeeded and FALSE if it failed.
|
||||||
*/
|
*/
|
||||||
bool setFunctionName(
|
bool setFunctionName(
|
||||||
const char* fcnName
|
const char* fcnName,
|
||||||
|
Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
);
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -32,7 +32,8 @@ namespace Coverage {
|
|||||||
ExecutableInfo* const executableInfo,
|
ExecutableInfo* const executableInfo,
|
||||||
std::string& symbolName,
|
std::string& symbolName,
|
||||||
ObjdumpProcessor::objdumpLines_t instructions,
|
ObjdumpProcessor::objdumpLines_t instructions,
|
||||||
bool verbose
|
bool verbose,
|
||||||
|
DesiredSymbols& symbolsToAnalyze
|
||||||
) {
|
) {
|
||||||
// Find the symbol's coverage map.
|
// Find the symbol's coverage map.
|
||||||
try {
|
try {
|
||||||
@ -88,7 +89,7 @@ namespace Coverage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there are NOT already saved instructions, save them.
|
// If there are NOT already saved instructions, save them.
|
||||||
SymbolInformation* symbolInfo = SymbolsToAnalyze->find( symbolName );
|
SymbolInformation* symbolInfo = symbolsToAnalyze.find( symbolName );
|
||||||
if (symbolInfo->instructions.empty()) {
|
if (symbolInfo->instructions.empty()) {
|
||||||
symbolInfo->sourceFile = executableInfo;
|
symbolInfo->sourceFile = executableInfo;
|
||||||
symbolInfo->baseAddress = lowAddress;
|
symbolInfo->baseAddress = lowAddress;
|
||||||
@ -107,7 +108,7 @@ namespace Coverage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a unified coverage map for the symbol.
|
// Create a unified coverage map for the symbol.
|
||||||
SymbolsToAnalyze->createCoverageMap(
|
symbolsToAnalyze.createCoverageMap(
|
||||||
executableInfo->getFileName().c_str(),
|
executableInfo->getFileName().c_str(),
|
||||||
symbolName,
|
symbolName,
|
||||||
size,
|
size,
|
||||||
@ -122,7 +123,9 @@ namespace Coverage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjdumpProcessor::ObjdumpProcessor()
|
ObjdumpProcessor::ObjdumpProcessor(
|
||||||
|
DesiredSymbols& symbolsToAnalyze
|
||||||
|
): symbolsToAnalyze_m( symbolsToAnalyze )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +366,8 @@ namespace Coverage {
|
|||||||
executableInformation,
|
executableInformation,
|
||||||
currentSymbol,
|
currentSymbol,
|
||||||
theInstructions,
|
theInstructions,
|
||||||
verbose
|
verbose,
|
||||||
|
symbolsToAnalyze_m
|
||||||
);
|
);
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
@ -419,7 +423,8 @@ namespace Coverage {
|
|||||||
executableInformation,
|
executableInformation,
|
||||||
currentSymbol,
|
currentSymbol,
|
||||||
theInstructions,
|
theInstructions,
|
||||||
verbose
|
verbose,
|
||||||
|
symbolsToAnalyze_m
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +449,7 @@ namespace Coverage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if the new symbol is one that we care about.
|
// See if the new symbol is one that we care about.
|
||||||
if (SymbolsToAnalyze->isDesired( symbol )) {
|
if (symbolsToAnalyze_m.isDesired( symbol )) {
|
||||||
currentSymbol = symbol;
|
currentSymbol = symbol;
|
||||||
processSymbol = true;
|
processSymbol = true;
|
||||||
theInstructions.push_back( lineInfo );
|
theInstructions.push_back( lineInfo );
|
||||||
@ -462,7 +467,8 @@ namespace Coverage {
|
|||||||
executableInformation,
|
executableInformation,
|
||||||
currentSymbol,
|
currentSymbol,
|
||||||
theInstructions,
|
theInstructions,
|
||||||
verbose
|
verbose,
|
||||||
|
symbolsToAnalyze_m
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
processSymbol = false;
|
processSymbol = false;
|
||||||
|
@ -12,11 +12,54 @@
|
|||||||
|
|
||||||
#include "ExecutableInfo.h"
|
#include "ExecutableInfo.h"
|
||||||
#include "TargetBase.h"
|
#include "TargetBase.h"
|
||||||
|
#include "DesiredSymbols.h"
|
||||||
|
|
||||||
#include "rld-process.h"
|
#include "rld-process.h"
|
||||||
|
|
||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
|
|
||||||
|
class DesiredSymbols;
|
||||||
|
class ExecutableInfo;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This type defines the elements of an objdump line.
|
||||||
|
*/
|
||||||
|
struct objdumpLine_t {
|
||||||
|
/*!
|
||||||
|
* This member variable contains the actual line from the object dump.
|
||||||
|
*/
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains the address from the object dump line.
|
||||||
|
*/
|
||||||
|
uint32_t address;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains an indication of whether the line
|
||||||
|
* is an instruction.
|
||||||
|
*/
|
||||||
|
bool isInstruction;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains an indication of whether the line
|
||||||
|
* is a nop instruction.
|
||||||
|
*/
|
||||||
|
bool isNop;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains the size of the nop instruction.
|
||||||
|
*/
|
||||||
|
int nopSize;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains an indication of whether the line
|
||||||
|
* is a branch instruction.
|
||||||
|
*/
|
||||||
|
bool isBranch;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/*! @class ObjdumpProcessor
|
/*! @class ObjdumpProcessor
|
||||||
*
|
*
|
||||||
* This class implements the functionality which reads the output of
|
* This class implements the functionality which reads the output of
|
||||||
@ -31,45 +74,6 @@ namespace Coverage {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
|
||||||
* This type defines the elements of an objdump line.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/*!
|
|
||||||
* This member variable contains the actual line from the object dump.
|
|
||||||
*/
|
|
||||||
std::string line;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* This member variable contains the address from the object dump line.
|
|
||||||
*/
|
|
||||||
uint32_t address;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* This member variable contains an indication of whether the line
|
|
||||||
* is an instruction.
|
|
||||||
*/
|
|
||||||
bool isInstruction;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* This member variable contains an indication of whether the line
|
|
||||||
* is a nop instruction.
|
|
||||||
*/
|
|
||||||
bool isNop;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* This member variable contains the size of the nop instruction.
|
|
||||||
*/
|
|
||||||
int nopSize;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* This member variable contains an indication of whether the line
|
|
||||||
* is a branch instruction.
|
|
||||||
*/
|
|
||||||
bool isBranch;
|
|
||||||
|
|
||||||
} objdumpLine_t;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This object defines a list of object dump lines
|
* This object defines a list of object dump lines
|
||||||
* for a file.
|
* for a file.
|
||||||
@ -86,7 +90,9 @@ namespace Coverage {
|
|||||||
/*!
|
/*!
|
||||||
* This method constructs an ObjdumpProcessor instance.
|
* This method constructs an ObjdumpProcessor instance.
|
||||||
*/
|
*/
|
||||||
ObjdumpProcessor();
|
ObjdumpProcessor(
|
||||||
|
DesiredSymbols& symbolsToAnalyze
|
||||||
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This method destructs an ObjdumpProcessor instance.
|
* This method destructs an ObjdumpProcessor instance.
|
||||||
@ -169,6 +175,10 @@ namespace Coverage {
|
|||||||
int& size
|
int& size
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains the symbols to be analyzed
|
||||||
|
*/
|
||||||
|
DesiredSymbols& symbolsToAnalyze_m;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,13 +28,15 @@ ReportsBase::ReportsBase(
|
|||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const DesiredSymbols& symbolsToAnalyze
|
||||||
): reportExtension_m( "" ),
|
): reportExtension_m( "" ),
|
||||||
symbolSetName_m( symbolSetName ),
|
symbolSetName_m( symbolSetName ),
|
||||||
timestamp_m( timestamp ),
|
timestamp_m( timestamp ),
|
||||||
allExplanations_m( allExplanations ),
|
allExplanations_m( allExplanations ),
|
||||||
projectName_m( projectName ),
|
projectName_m( projectName ),
|
||||||
outputDirectory_m( outputDirectory )
|
outputDirectory_m( outputDirectory ),
|
||||||
|
symbolsToAnalyze_m( symbolsToAnalyze )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,11 +215,11 @@ void ReportsBase::WriteAnnotatedReport( const std::string& fileName )
|
|||||||
|
|
||||||
// Process uncovered branches for each symbol.
|
// Process uncovered branches for each symbol.
|
||||||
const std::vector<std::string>& symbols =
|
const std::vector<std::string>& symbols =
|
||||||
SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
|
symbolsToAnalyze_m.getSymbolsForSet( symbolSetName_m );
|
||||||
|
|
||||||
for ( const auto& symbol : symbols ) {
|
for ( const auto& symbol : symbols ) {
|
||||||
const SymbolInformation& info =
|
const SymbolInformation& info =
|
||||||
SymbolsToAnalyze->allSymbols().at( symbol );
|
symbolsToAnalyze_m.allSymbols().at( symbol );
|
||||||
|
|
||||||
// If uncoveredRanges and uncoveredBranches don't exist, then the
|
// If uncoveredRanges and uncoveredBranches don't exist, then the
|
||||||
// symbol was never referenced by any executable. Just skip it.
|
// symbol was never referenced by any executable. Just skip it.
|
||||||
@ -308,7 +310,7 @@ void ReportsBase::WriteBranchReport( const std::string& fileName )
|
|||||||
bool hasBranches = true;
|
bool hasBranches = true;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
( SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) == 0 ) ||
|
( symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) == 0 ) ||
|
||||||
( BranchInfoAvailable == false )
|
( BranchInfoAvailable == false )
|
||||||
) {
|
) {
|
||||||
hasBranches = false;
|
hasBranches = false;
|
||||||
@ -322,17 +324,17 @@ void ReportsBase::WriteBranchReport( const std::string& fileName )
|
|||||||
|
|
||||||
// If no branches were found then branch coverage is not supported
|
// If no branches were found then branch coverage is not supported
|
||||||
if (
|
if (
|
||||||
( SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) != 0 ) &&
|
( symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0 ) &&
|
||||||
( BranchInfoAvailable == true )
|
( BranchInfoAvailable == true )
|
||||||
) {
|
) {
|
||||||
// Process uncovered branches for each symbol in the set.
|
// Process uncovered branches for each symbol in the set.
|
||||||
const std::vector<std::string>& symbols =
|
const std::vector<std::string>& symbols =
|
||||||
SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
|
symbolsToAnalyze_m.getSymbolsForSet( symbolSetName_m );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for ( const auto& symbol : symbols ) {
|
for ( const auto& symbol : symbols ) {
|
||||||
const SymbolInformation& info =
|
const SymbolInformation& info =
|
||||||
SymbolsToAnalyze->allSymbols().at( symbol );
|
symbolsToAnalyze_m.allSymbols().at( symbol );
|
||||||
|
|
||||||
theBranches = info.uncoveredBranches;
|
theBranches = info.uncoveredBranches;
|
||||||
|
|
||||||
@ -375,12 +377,12 @@ void ReportsBase::WriteCoverageReport( const std::string& fileName )
|
|||||||
|
|
||||||
// Process uncovered ranges for each symbol.
|
// Process uncovered ranges for each symbol.
|
||||||
const std::vector<std::string>& symbols =
|
const std::vector<std::string>& symbols =
|
||||||
SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
|
symbolsToAnalyze_m.getSymbolsForSet( symbolSetName_m );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for ( const auto& symbol : symbols ) {
|
for ( const auto& symbol : symbols ) {
|
||||||
const SymbolInformation& info =
|
const SymbolInformation& info =
|
||||||
SymbolsToAnalyze->allSymbols().at( symbol );
|
symbolsToAnalyze_m.allSymbols().at( symbol );
|
||||||
|
|
||||||
theRanges = info.uncoveredRanges;
|
theRanges = info.uncoveredRanges;
|
||||||
|
|
||||||
@ -420,12 +422,12 @@ void ReportsBase::WriteSizeReport( const std::string& fileName )
|
|||||||
|
|
||||||
// Process uncovered ranges for each symbol.
|
// Process uncovered ranges for each symbol.
|
||||||
const std::vector<std::string>& symbols =
|
const std::vector<std::string>& symbols =
|
||||||
SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
|
symbolsToAnalyze_m.getSymbolsForSet( symbolSetName_m );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for ( const auto& symbol : symbols ) {
|
for ( const auto& symbol : symbols ) {
|
||||||
const SymbolInformation& info =
|
const SymbolInformation& info =
|
||||||
SymbolsToAnalyze->allSymbols().at( symbol );
|
symbolsToAnalyze_m.allSymbols().at( symbol );
|
||||||
|
|
||||||
theRanges = info.uncoveredRanges;
|
theRanges = info.uncoveredRanges;
|
||||||
|
|
||||||
@ -440,7 +442,10 @@ void ReportsBase::WriteSizeReport( const std::string& fileName )
|
|||||||
CloseSizeFile( report );
|
CloseSizeFile( report );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportsBase::WriteSymbolSummaryReport( const std::string& fileName )
|
void ReportsBase::WriteSymbolSummaryReport(
|
||||||
|
const std::string& fileName,
|
||||||
|
const DesiredSymbols& symbolsToAnalyze
|
||||||
|
)
|
||||||
{
|
{
|
||||||
std::ofstream report;
|
std::ofstream report;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
@ -453,12 +458,12 @@ void ReportsBase::WriteSymbolSummaryReport( const std::string& fileName )
|
|||||||
|
|
||||||
// Process each symbol.
|
// Process each symbol.
|
||||||
const std::vector<std::string>& symbols =
|
const std::vector<std::string>& symbols =
|
||||||
SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
|
symbolsToAnalyze_m.getSymbolsForSet( symbolSetName_m );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for ( const auto& symbol : symbols ) {
|
for ( const auto& symbol : symbols ) {
|
||||||
const SymbolInformation& info =
|
const SymbolInformation& info =
|
||||||
SymbolsToAnalyze->allSymbols().at( symbol );
|
symbolsToAnalyze_m.allSymbols().at( symbol );
|
||||||
|
|
||||||
PutSymbolSummaryLine( report, count, symbol, info );
|
PutSymbolSummaryLine( report, count, symbol, info );
|
||||||
count++;
|
count++;
|
||||||
@ -468,9 +473,10 @@ void ReportsBase::WriteSymbolSummaryReport( const std::string& fileName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ReportsBase::WriteSummaryReport(
|
void ReportsBase::WriteSummaryReport(
|
||||||
const std::string& fileName,
|
const std::string& fileName,
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Calculate coverage statistics and output results.
|
// Calculate coverage statistics and output results.
|
||||||
@ -491,10 +497,10 @@ void ReportsBase::WriteSummaryReport(
|
|||||||
|
|
||||||
// Look at each symbol.
|
// Look at each symbol.
|
||||||
const std::vector<std::string>& symbols =
|
const std::vector<std::string>& symbols =
|
||||||
SymbolsToAnalyze->getSymbolsForSet( symbolSetName );
|
symbolsToAnalyze.getSymbolsForSet( symbolSetName );
|
||||||
|
|
||||||
for ( const auto& symbol : symbols ) {
|
for ( const auto& symbol : symbols ) {
|
||||||
SymbolInformation info = SymbolsToAnalyze->allSymbols().at( symbol );
|
SymbolInformation info = symbolsToAnalyze.allSymbols().at( symbol );
|
||||||
|
|
||||||
// If the symbol's unified coverage map exists, scan through it
|
// If the symbol's unified coverage map exists, scan through it
|
||||||
// and count bytes.
|
// and count bytes.
|
||||||
@ -518,12 +524,12 @@ void ReportsBase::WriteSummaryReport(
|
|||||||
}
|
}
|
||||||
|
|
||||||
percentageBranches = (double) (
|
percentageBranches = (double) (
|
||||||
SymbolsToAnalyze->getNumberBranchesAlwaysTaken( symbolSetName ) +
|
symbolsToAnalyze.getNumberBranchesAlwaysTaken( symbolSetName ) +
|
||||||
SymbolsToAnalyze->getNumberBranchesNeverTaken( symbolSetName ) +
|
symbolsToAnalyze.getNumberBranchesNeverTaken( symbolSetName ) +
|
||||||
( SymbolsToAnalyze->getNumberBranchesNotExecuted( symbolSetName ) * 2 )
|
( symbolsToAnalyze.getNumberBranchesNotExecuted( symbolSetName ) * 2 )
|
||||||
);
|
);
|
||||||
percentageBranches /=
|
percentageBranches /=
|
||||||
(double) SymbolsToAnalyze->getNumberBranchesFound( symbolSetName ) * 2;
|
(double) symbolsToAnalyze.getNumberBranchesFound( symbolSetName ) * 2;
|
||||||
percentageBranches *= 100.0;
|
percentageBranches *= 100.0;
|
||||||
|
|
||||||
report << "Bytes Analyzed : " << totalBytes << std::endl
|
report << "Bytes Analyzed : " << totalBytes << std::endl
|
||||||
@ -533,31 +539,31 @@ void ReportsBase::WriteSummaryReport(
|
|||||||
<< 100.0 - percentage << std::endl
|
<< 100.0 - percentage << std::endl
|
||||||
<< "Percentage Not Executed : " << percentage << std::endl
|
<< "Percentage Not Executed : " << percentage << std::endl
|
||||||
<< "Unreferenced Symbols : "
|
<< "Unreferenced Symbols : "
|
||||||
<< SymbolsToAnalyze->getNumberUnreferencedSymbols( symbolSetName )
|
<< symbolsToAnalyze.getNumberUnreferencedSymbols( symbolSetName )
|
||||||
<< std::endl << "Uncovered ranges found : "
|
<< std::endl << "Uncovered ranges found : "
|
||||||
<< SymbolsToAnalyze->getNumberUncoveredRanges( symbolSetName )
|
<< symbolsToAnalyze.getNumberUncoveredRanges( symbolSetName )
|
||||||
<< std::endl << std::endl;
|
<< std::endl << std::endl;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
( SymbolsToAnalyze->getNumberBranchesFound( symbolSetName ) == 0 ) ||
|
( symbolsToAnalyze.getNumberBranchesFound( symbolSetName ) == 0 ) ||
|
||||||
( BranchInfoAvailable == false )
|
( BranchInfoAvailable == false )
|
||||||
) {
|
) {
|
||||||
report << "No branch information available" << std::endl;
|
report << "No branch information available" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
report << "Total conditional branches found : "
|
report << "Total conditional branches found : "
|
||||||
<< SymbolsToAnalyze->getNumberBranchesFound( symbolSetName )
|
<< symbolsToAnalyze.getNumberBranchesFound( symbolSetName )
|
||||||
<< std::endl << "Total branch paths found : "
|
<< std::endl << "Total branch paths found : "
|
||||||
<< SymbolsToAnalyze->getNumberBranchesFound( symbolSetName ) * 2
|
<< symbolsToAnalyze.getNumberBranchesFound( symbolSetName ) * 2
|
||||||
<< std::endl << "Uncovered branch paths found : "
|
<< std::endl << "Uncovered branch paths found : "
|
||||||
<< SymbolsToAnalyze->getNumberBranchesAlwaysTaken( symbolSetName ) +
|
<< symbolsToAnalyze.getNumberBranchesAlwaysTaken( symbolSetName ) +
|
||||||
SymbolsToAnalyze->getNumberBranchesNeverTaken( symbolSetName ) +
|
symbolsToAnalyze.getNumberBranchesNeverTaken( symbolSetName ) +
|
||||||
( SymbolsToAnalyze->getNumberBranchesNotExecuted( symbolSetName ) * 2 )
|
( symbolsToAnalyze.getNumberBranchesNotExecuted( symbolSetName ) * 2 )
|
||||||
<< std::endl << " "
|
<< std::endl << " "
|
||||||
<< SymbolsToAnalyze->getNumberBranchesAlwaysTaken( symbolSetName )
|
<< symbolsToAnalyze.getNumberBranchesAlwaysTaken( symbolSetName )
|
||||||
<< " branches always taken" << std::endl << " "
|
<< " branches always taken" << std::endl << " "
|
||||||
<< SymbolsToAnalyze->getNumberBranchesNeverTaken( symbolSetName )
|
<< symbolsToAnalyze.getNumberBranchesNeverTaken( symbolSetName )
|
||||||
<< " branches never taken" << std::endl << " "
|
<< " branches never taken" << std::endl << " "
|
||||||
<< SymbolsToAnalyze->getNumberBranchesNotExecuted( symbolSetName ) * 2
|
<< symbolsToAnalyze.getNumberBranchesNotExecuted( symbolSetName ) * 2
|
||||||
<< " branch paths not executed" << std::endl
|
<< " branch paths not executed" << std::endl
|
||||||
<< "Percentage branch paths covered : "
|
<< "Percentage branch paths covered : "
|
||||||
<< std::fixed << std::setprecision( 2 ) << std::setw( 4 )
|
<< std::fixed << std::setprecision( 2 ) << std::setw( 4 )
|
||||||
@ -569,11 +575,12 @@ void ReportsBase::WriteSummaryReport(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GenerateReports(
|
void GenerateReports(
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
bool verbose,
|
bool verbose,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
typedef std::list<ReportsBase *> reportList_t;
|
typedef std::list<ReportsBase *> reportList_t;
|
||||||
@ -591,7 +598,8 @@ void GenerateReports(
|
|||||||
symbolSetName,
|
symbolSetName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory
|
outputDirectory,
|
||||||
|
symbolsToAnalyze
|
||||||
);
|
);
|
||||||
reportList.push_back( reports );
|
reportList.push_back( reports );
|
||||||
reports = new ReportsHtml(
|
reports = new ReportsHtml(
|
||||||
@ -599,7 +607,8 @@ void GenerateReports(
|
|||||||
symbolSetName,
|
symbolSetName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory
|
outputDirectory,
|
||||||
|
symbolsToAnalyze
|
||||||
);
|
);
|
||||||
reportList.push_back( reports );
|
reportList.push_back( reports );
|
||||||
|
|
||||||
@ -640,7 +649,7 @@ void GenerateReports(
|
|||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
std::cerr << "Generate " << reportName << std::endl;
|
std::cerr << "Generate " << reportName << std::endl;
|
||||||
}
|
}
|
||||||
reports->WriteSymbolSummaryReport( reportName );
|
reports->WriteSymbolSummaryReport( reportName, symbolsToAnalyze );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
|
for ( ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
|
||||||
@ -651,7 +660,8 @@ void GenerateReports(
|
|||||||
ReportsBase::WriteSummaryReport(
|
ReportsBase::WriteSummaryReport(
|
||||||
"summary.txt",
|
"summary.txt",
|
||||||
symbolSetName,
|
symbolSetName,
|
||||||
outputDirectory
|
outputDirectory,
|
||||||
|
symbolsToAnalyze
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@ class ReportsBase {
|
|||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const DesiredSymbols& symbolsToAnalyze
|
||||||
);
|
);
|
||||||
virtual ~ReportsBase();
|
virtual ~ReportsBase();
|
||||||
|
|
||||||
@ -80,16 +81,21 @@ class ReportsBase {
|
|||||||
* each symbol which did not achieve 100% coverage
|
* each symbol which did not achieve 100% coverage
|
||||||
*
|
*
|
||||||
* @param[in] fileName identifies the report file name
|
* @param[in] fileName identifies the report file name
|
||||||
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
*/
|
*/
|
||||||
void WriteSymbolSummaryReport( const std::string& fileName );
|
void WriteSymbolSummaryReport(
|
||||||
|
const std::string& fileName,
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This method produces a sumary report for the overall test run.
|
* This method produces a sumary report for the overall test run.
|
||||||
*/
|
*/
|
||||||
static void WriteSummaryReport(
|
static void WriteSummaryReport(
|
||||||
const std::string& fileName,
|
const std::string& fileName,
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
);
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -142,6 +148,11 @@ class ReportsBase {
|
|||||||
*/
|
*/
|
||||||
std::string outputDirectory_m = "";
|
std::string outputDirectory_m = "";
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This member variable contains the symbols to be analyzed.
|
||||||
|
*/
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze_m;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This method Opens a report file and verifies that it opened
|
* This method Opens a report file and verifies that it opened
|
||||||
* correctly. Upon failure NULL is returned.
|
* correctly. Upon failure NULL is returned.
|
||||||
@ -418,13 +429,15 @@ class ReportsBase {
|
|||||||
* @param[in] verbose specifies whether to be verbose with output
|
* @param[in] verbose specifies whether to be verbose with output
|
||||||
* @param[in] projectName specifies the name of the project
|
* @param[in] projectName specifies the name of the project
|
||||||
* @param[in] outputDirectory specifies the directory for the output
|
* @param[in] outputDirectory specifies the directory for the output
|
||||||
|
* @param[in] symbolsToAnalyze the symbols to be analyzed
|
||||||
*/
|
*/
|
||||||
void GenerateReports(
|
void GenerateReports(
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
bool verbose,
|
bool verbose,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,17 +38,19 @@ typedef rtems::utils::ostream_guard ostream_guard;
|
|||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
|
|
||||||
ReportsHtml::ReportsHtml(
|
ReportsHtml::ReportsHtml(
|
||||||
time_t timestamp,
|
time_t timestamp,
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
): ReportsBase(
|
): ReportsBase(
|
||||||
timestamp,
|
timestamp,
|
||||||
symbolSetName,
|
symbolSetName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory
|
outputDirectory,
|
||||||
|
symbolsToAnalyze
|
||||||
),
|
),
|
||||||
lastState_m( A_SOURCE )
|
lastState_m( A_SOURCE )
|
||||||
{
|
{
|
||||||
@ -441,7 +443,7 @@ namespace Coverage {
|
|||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
BranchInfoAvailable &&
|
BranchInfoAvailable &&
|
||||||
SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) != 0
|
symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0
|
||||||
) {
|
) {
|
||||||
report << "All branch paths taken." << std::endl;
|
report << "All branch paths taken." << std::endl;
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,11 +26,12 @@ class ReportsHtml: public ReportsBase {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ReportsHtml(
|
ReportsHtml(
|
||||||
time_t timestamp,
|
time_t timestamp,
|
||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const Coverage::DesiredSymbols& symbolsToAnalyze
|
||||||
);
|
);
|
||||||
~ReportsHtml();
|
~ReportsHtml();
|
||||||
|
|
||||||
|
@ -21,13 +21,15 @@ ReportsText::ReportsText(
|
|||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const DesiredSymbols& symbolsToAnalyze
|
||||||
): ReportsBase(
|
): ReportsBase(
|
||||||
timestamp,
|
timestamp,
|
||||||
symbolSetName,
|
symbolSetName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory
|
outputDirectory,
|
||||||
|
symbolsToAnalyze
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
reportExtension_m = ".txt";
|
reportExtension_m = ".txt";
|
||||||
@ -61,7 +63,7 @@ bool ReportsText::PutNoBranchInfo( std::ofstream& report )
|
|||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
BranchInfoAvailable &&
|
BranchInfoAvailable &&
|
||||||
SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) != 0
|
symbolsToAnalyze_m.getNumberBranchesFound( symbolSetName_m ) != 0
|
||||||
) {
|
) {
|
||||||
report << "All branch paths taken." << std::endl;
|
report << "All branch paths taken." << std::endl;
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,7 +26,8 @@ class ReportsText: public ReportsBase {
|
|||||||
const std::string& symbolSetName,
|
const std::string& symbolSetName,
|
||||||
Coverage::Explanations& allExplanations,
|
Coverage::Explanations& allExplanations,
|
||||||
const std::string& projectName,
|
const std::string& projectName,
|
||||||
const std::string& outputDirectory
|
const std::string& outputDirectory,
|
||||||
|
const DesiredSymbols& symbolsToAnalyze
|
||||||
);
|
);
|
||||||
virtual ~ReportsText();
|
virtual ~ReportsText();
|
||||||
|
|
||||||
|
@ -89,9 +89,10 @@ int main(
|
|||||||
Coverage::ExecutableInfo* executableInfo;
|
Coverage::ExecutableInfo* executableInfo;
|
||||||
rld::process::tempfile objdumpFile( ".dmp" );
|
rld::process::tempfile objdumpFile( ".dmp" );
|
||||||
rld::process::tempfile err( ".err" );
|
rld::process::tempfile err( ".err" );
|
||||||
Coverage::ObjdumpProcessor objdumpProcessor;
|
Coverage::DesiredSymbols symbolsToAnalyze;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
std::string dynamicLibrary;
|
std::string dynamicLibrary;
|
||||||
|
Coverage::ObjdumpProcessor objdumpProcessor( symbolsToAnalyze );
|
||||||
|
|
||||||
setup_signals();
|
setup_signals();
|
||||||
|
|
||||||
@ -132,9 +133,19 @@ int main(
|
|||||||
TargetInfo = Target::TargetFactory( cpuname );
|
TargetInfo = Target::TargetFactory( cpuname );
|
||||||
|
|
||||||
if ( !dynamicLibrary.empty() )
|
if ( !dynamicLibrary.empty() )
|
||||||
executableInfo = new Coverage::ExecutableInfo( executable, dynamicLibrary );
|
executableInfo = new Coverage::ExecutableInfo(
|
||||||
|
executable,
|
||||||
|
dynamicLibrary,
|
||||||
|
false,
|
||||||
|
symbolsToAnalyze
|
||||||
|
);
|
||||||
else
|
else
|
||||||
executableInfo = new Coverage::ExecutableInfo( executable );
|
executableInfo = new Coverage::ExecutableInfo(
|
||||||
|
executable,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
symbolsToAnalyze
|
||||||
|
);
|
||||||
|
|
||||||
// If a dynamic library was specified, determine the load address.
|
// If a dynamic library was specified, determine the load address.
|
||||||
if ( !dynamicLibrary.empty() )
|
if ( !dynamicLibrary.empty() )
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables for the program
|
* Global variables for the program
|
||||||
*/
|
*/
|
||||||
Coverage::DesiredSymbols* SymbolsToAnalyze = NULL;
|
|
||||||
bool BranchInfoAvailable = false;
|
bool BranchInfoAvailable = false;
|
||||||
Target::TargetBase* TargetInfo = NULL;
|
Target::TargetBase* TargetInfo = NULL;
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "Explanations.h"
|
#include "Explanations.h"
|
||||||
#include "TargetBase.h"
|
#include "TargetBase.h"
|
||||||
|
|
||||||
extern Coverage::DesiredSymbols* SymbolsToAnalyze;
|
|
||||||
extern bool BranchInfoAvailable;
|
extern bool BranchInfoAvailable;
|
||||||
extern Target::TargetBase* TargetInfo;
|
extern Target::TargetBase* TargetInfo;
|
||||||
|
|
||||||
|
@ -178,11 +178,12 @@ int covoar(
|
|||||||
int opt;
|
int opt;
|
||||||
char inputBuffer[MAX_LINE_LENGTH];
|
char inputBuffer[MAX_LINE_LENGTH];
|
||||||
Coverage::Explanations allExplanations;
|
Coverage::Explanations allExplanations;
|
||||||
Coverage::ObjdumpProcessor objdumpProcessor;
|
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
std::string dynamicLibrary;
|
std::string dynamicLibrary;
|
||||||
std::string projectName;
|
std::string projectName;
|
||||||
std::string outputDirectory = ".";
|
std::string outputDirectory = ".";
|
||||||
|
Coverage::DesiredSymbols symbolsToAnalyze;
|
||||||
|
Coverage::ObjdumpProcessor objdumpProcessor( symbolsToAnalyze );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process command line options.
|
// Process command line options.
|
||||||
@ -278,13 +279,10 @@ int covoar(
|
|||||||
// Create data based on target.
|
// Create data based on target.
|
||||||
TargetInfo = Target::TargetFactory( buildTarget );
|
TargetInfo = Target::TargetFactory( buildTarget );
|
||||||
|
|
||||||
// Create the set of desired symbols.
|
|
||||||
SymbolsToAnalyze = new Coverage::DesiredSymbols();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read symbol configuration file and load needed symbols.
|
// Read symbol configuration file and load needed symbols.
|
||||||
//
|
//
|
||||||
SymbolsToAnalyze->load( symbolSet, buildTarget, buildBSP, verbose );
|
symbolsToAnalyze.load( symbolSet, buildTarget, buildBSP, verbose );
|
||||||
|
|
||||||
// If a single executable was specified, process the remaining
|
// If a single executable was specified, process the remaining
|
||||||
// arguments as coverage file names.
|
// arguments as coverage file names.
|
||||||
@ -311,11 +309,17 @@ int covoar(
|
|||||||
if (!coverageFileNames.empty()) {
|
if (!coverageFileNames.empty()) {
|
||||||
if ( !dynamicLibrary.empty() ) {
|
if ( !dynamicLibrary.empty() ) {
|
||||||
executableInfo = new Coverage::ExecutableInfo(
|
executableInfo = new Coverage::ExecutableInfo(
|
||||||
singleExecutable, dynamicLibrary, verbose
|
singleExecutable,
|
||||||
|
dynamicLibrary,
|
||||||
|
verbose,
|
||||||
|
symbolsToAnalyze
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
executableInfo = new Coverage::ExecutableInfo(
|
executableInfo = new Coverage::ExecutableInfo(
|
||||||
singleExecutable, "", verbose
|
singleExecutable,
|
||||||
|
"",
|
||||||
|
verbose,
|
||||||
|
symbolsToAnalyze
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +343,10 @@ int covoar(
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
} else {
|
} else {
|
||||||
executableInfo = new Coverage::ExecutableInfo(
|
executableInfo = new Coverage::ExecutableInfo(
|
||||||
argv[i], "", verbose
|
argv[i],
|
||||||
|
"",
|
||||||
|
verbose,
|
||||||
|
symbolsToAnalyze
|
||||||
);
|
);
|
||||||
executablesToAnalyze.push_back( executableInfo );
|
executablesToAnalyze.push_back( executableInfo );
|
||||||
coverageFileNames.push_back( coverageFileName );
|
coverageFileNames.push_back( coverageFileName );
|
||||||
@ -359,7 +366,7 @@ int covoar(
|
|||||||
throw rld::error( "executables and coverage name size mismatch", "covoar" );
|
throw rld::error( "executables and coverage name size mismatch", "covoar" );
|
||||||
|
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
std::cerr << "Analyzing " << SymbolsToAnalyze->allSymbols().size()
|
std::cerr << "Analyzing " << symbolsToAnalyze.allSymbols().size()
|
||||||
<< " symbols" << std::endl;
|
<< " symbols" << std::endl;
|
||||||
|
|
||||||
// Create explanations.
|
// Create explanations.
|
||||||
@ -418,7 +425,7 @@ int covoar(
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
std::cerr << "Preprocess uncovered ranges and branches" << std::endl;
|
std::cerr << "Preprocess uncovered ranges and branches" << std::endl;
|
||||||
|
|
||||||
SymbolsToAnalyze->preprocess();
|
symbolsToAnalyze.preprocess( symbolsToAnalyze );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generate Gcov reports
|
// Generate Gcov reports
|
||||||
@ -433,7 +440,7 @@ int covoar(
|
|||||||
std::cerr << "Unable to open " << gcnosFileName << std::endl;
|
std::cerr << "Unable to open " << gcnosFileName << std::endl;
|
||||||
else {
|
else {
|
||||||
while ( fscanf( gcnosFile, "%s", inputBuffer ) != EOF) {
|
while ( fscanf( gcnosFile, "%s", inputBuffer ) != EOF) {
|
||||||
gcovFile = new Gcov::GcovData();
|
gcovFile = new Gcov::GcovData( symbolsToAnalyze );
|
||||||
strcpy( gcnoFileName, inputBuffer );
|
strcpy( gcnoFileName, inputBuffer );
|
||||||
|
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
@ -457,20 +464,20 @@ int covoar(
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
std::cerr << "Computing uncovered ranges and branches" << std::endl;
|
std::cerr << "Computing uncovered ranges and branches" << std::endl;
|
||||||
|
|
||||||
SymbolsToAnalyze->computeUncovered( verbose );
|
symbolsToAnalyze.computeUncovered( verbose );
|
||||||
|
|
||||||
// Calculate remainder of statistics.
|
// Calculate remainder of statistics.
|
||||||
if (verbose)
|
if (verbose)
|
||||||
std::cerr << "Calculate statistics" << std::endl;
|
std::cerr << "Calculate statistics" << std::endl;
|
||||||
|
|
||||||
SymbolsToAnalyze->calculateStatistics();
|
symbolsToAnalyze.calculateStatistics();
|
||||||
|
|
||||||
// Look up the source lines for any uncovered ranges and branches.
|
// Look up the source lines for any uncovered ranges and branches.
|
||||||
if (verbose)
|
if (verbose)
|
||||||
std::cerr << "Looking up source lines for uncovered ranges and branches"
|
std::cerr << "Looking up source lines for uncovered ranges and branches"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
SymbolsToAnalyze->findSourceForUncovered( verbose );
|
symbolsToAnalyze.findSourceForUncovered( verbose, symbolsToAnalyze );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Report the coverage data.
|
// Report the coverage data.
|
||||||
@ -478,13 +485,14 @@ int covoar(
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
std::cerr << "Generate Reports" << std::endl;
|
std::cerr << "Generate Reports" << std::endl;
|
||||||
|
|
||||||
for (const auto& setName : SymbolsToAnalyze->getSetNames()) {
|
for (const auto& setName : symbolsToAnalyze.getSetNames()) {
|
||||||
Coverage::GenerateReports(
|
Coverage::GenerateReports(
|
||||||
setName,
|
setName,
|
||||||
allExplanations,
|
allExplanations,
|
||||||
verbose,
|
verbose,
|
||||||
projectName,
|
projectName,
|
||||||
outputDirectory
|
outputDirectory,
|
||||||
|
symbolsToAnalyze
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user