mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-19 01:49:03 +08:00
covoar: Add information to improve diagnostics.
This commit is contained in:

committed by
Chris Johns

parent
b857151112
commit
cb018bcdff
@@ -10,9 +10,10 @@
|
|||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
|
|
||||||
CoverageMap::CoverageMap(
|
CoverageMap::CoverageMap(
|
||||||
|
const std::string& exefileName,
|
||||||
uint32_t low,
|
uint32_t low,
|
||||||
uint32_t high
|
uint32_t high
|
||||||
) : CoverageMapBase(low, high)
|
) : CoverageMapBase(exefileName, low, high)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ namespace Coverage {
|
|||||||
* @param[in] high specifies the highest address of the coverage map.
|
* @param[in] high specifies the highest address of the coverage map.
|
||||||
*/
|
*/
|
||||||
CoverageMap(
|
CoverageMap(
|
||||||
|
const std::string& exefileName,
|
||||||
uint32_t low,
|
uint32_t low,
|
||||||
uint32_t high
|
uint32_t high
|
||||||
);
|
);
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
namespace Coverage {
|
namespace Coverage {
|
||||||
|
|
||||||
CoverageMapBase::CoverageMapBase(
|
CoverageMapBase::CoverageMapBase(
|
||||||
|
const std::string& exefileName,
|
||||||
uint32_t low,
|
uint32_t low,
|
||||||
uint32_t high
|
uint32_t high
|
||||||
)
|
)
|
||||||
@@ -23,6 +24,7 @@ namespace Coverage {
|
|||||||
uint32_t a;
|
uint32_t a;
|
||||||
AddressRange_t range;
|
AddressRange_t range;
|
||||||
|
|
||||||
|
range.fileName = exefileName;
|
||||||
range.lowAddress = low;
|
range.lowAddress = low;
|
||||||
range.highAddress = high;
|
range.highAddress = high;
|
||||||
RangeList.push_back( range );
|
RangeList.push_back( range );
|
||||||
|
@@ -27,6 +27,11 @@ namespace Coverage {
|
|||||||
* range per symbol.
|
* range per symbol.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/*!
|
||||||
|
* This is the file from which this originated.
|
||||||
|
*/
|
||||||
|
std::string fileName;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This is the low address of the address map range.
|
* This is the low address of the address map range.
|
||||||
*/
|
*/
|
||||||
@@ -48,10 +53,12 @@ namespace Coverage {
|
|||||||
/*!
|
/*!
|
||||||
* This method constructs a CoverageMapBase instance.
|
* 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] low specifies the lowest address of the coverage map
|
||||||
* @param[in] high specifies the highest address of the coverage map
|
* @param[in] high specifies the highest address of the coverage map
|
||||||
*/
|
*/
|
||||||
CoverageMapBase(
|
CoverageMapBase(
|
||||||
|
const std::string& exefileName,
|
||||||
uint32_t low,
|
uint32_t low,
|
||||||
uint32_t high
|
uint32_t high
|
||||||
);
|
);
|
||||||
|
@@ -335,6 +335,7 @@ namespace Coverage {
|
|||||||
|
|
||||||
|
|
||||||
void DesiredSymbols::createCoverageMap(
|
void DesiredSymbols::createCoverageMap(
|
||||||
|
const std::string& exefileName,
|
||||||
const std::string& symbolName,
|
const std::string& symbolName,
|
||||||
uint32_t size
|
uint32_t size
|
||||||
)
|
)
|
||||||
@@ -363,19 +364,27 @@ namespace Coverage {
|
|||||||
// ensure that the specified size matches the existing size.
|
// ensure that the specified size matches the existing size.
|
||||||
if (itr->second.stats.sizeInBytes != 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(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
"ERROR: DesiredSymbols::createCoverageMap - Attempt to create "
|
"INFO: DesiredSymbols::createCoverageMap - Attempt to create "
|
||||||
"unified coverage maps for %s with different sizes (%d != %d)\n",
|
"unified coverage maps for %s with different sizes (%s/%d != %s/%d)\n",
|
||||||
|
|
||||||
symbolName.c_str(),
|
symbolName.c_str(),
|
||||||
|
exefileName.c_str(),
|
||||||
itr->second.stats.sizeInBytes,
|
itr->second.stats.sizeInBytes,
|
||||||
|
itr->second.sourceFile->getFileName().c_str(),
|
||||||
size
|
size
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( itr->second.stats.sizeInBytes < size )
|
if ( itr->second.stats.sizeInBytes < size )
|
||||||
itr->second.stats.sizeInBytes = size;
|
itr->second.stats.sizeInBytes = size;
|
||||||
else
|
else
|
||||||
size = itr->second.stats.sizeInBytes;
|
size = itr->second.stats.sizeInBytes;
|
||||||
// exit( -1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,13 +393,14 @@ namespace Coverage {
|
|||||||
|
|
||||||
highAddress = size - 1;
|
highAddress = size - 1;
|
||||||
|
|
||||||
aCoverageMap = new CoverageMap( 0, highAddress );
|
aCoverageMap = new CoverageMap( exefileName, 0, highAddress );
|
||||||
if (!aCoverageMap) {
|
if (!aCoverageMap) {
|
||||||
|
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
"ERROR: DesiredSymbols::createCoverageMap - Unable to allocate "
|
"ERROR: DesiredSymbols::createCoverageMap - Unable to allocate "
|
||||||
"coverage map for %s\n",
|
"coverage map for %s:%s\n",
|
||||||
|
exefileName.c_str(),
|
||||||
symbolName.c_str()
|
symbolName.c_str()
|
||||||
);
|
);
|
||||||
exit( -1 );
|
exit( -1 );
|
||||||
@@ -653,6 +663,8 @@ namespace Coverage {
|
|||||||
|
|
||||||
// Ensure that the source and destination coverage maps
|
// Ensure that the source and destination coverage maps
|
||||||
// are the same size.
|
// 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;
|
dMapSize = itr->second.stats.sizeInBytes;
|
||||||
sBaseAddress = sourceCoverageMap->getFirstLowAddress();
|
sBaseAddress = sourceCoverageMap->getFirstLowAddress();
|
||||||
sMapSize = sourceCoverageMap->getSize();
|
sMapSize = sourceCoverageMap->getSize();
|
||||||
@@ -660,12 +672,11 @@ namespace Coverage {
|
|||||||
|
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
"ERROR: DesiredSymbols::mergeCoverageMap - Unable to merge "
|
"INFO: DesiredSymbols::mergeCoverageMap - Unable to merge "
|
||||||
"coverage map for %s because the sizes are different\n",
|
"coverage map for %s because the sizes are different\n",
|
||||||
symbolName.c_str()
|
symbolName.c_str()
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// exit( -1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge the data for each address.
|
// Merge the data for each address.
|
||||||
|
@@ -218,11 +218,14 @@ namespace Coverage {
|
|||||||
* This method creates a coverage map for the specified symbol
|
* This method creates a coverage map for the specified symbol
|
||||||
* using the specified size.
|
* 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
|
* @param[in] symbolName specifies the symbol for which to create
|
||||||
* a coverage map
|
* a coverage map
|
||||||
* @param[in] size specifies the size of the coverage map to create
|
* @param[in] size specifies the size of the coverage map to create
|
||||||
*/
|
*/
|
||||||
void createCoverageMap(
|
void createCoverageMap(
|
||||||
|
const std::string& exefileName,
|
||||||
const std::string& symbolName,
|
const std::string& symbolName,
|
||||||
uint32_t size
|
uint32_t size
|
||||||
);
|
);
|
||||||
|
@@ -89,6 +89,7 @@ namespace Coverage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoverageMapBase* ExecutableInfo::createCoverageMap (
|
CoverageMapBase* ExecutableInfo::createCoverageMap (
|
||||||
|
const std::string& fileName,
|
||||||
const std::string& symbolName,
|
const std::string& symbolName,
|
||||||
uint32_t lowAddress,
|
uint32_t lowAddress,
|
||||||
uint32_t highAddress
|
uint32_t highAddress
|
||||||
@@ -99,7 +100,7 @@ namespace Coverage {
|
|||||||
|
|
||||||
itr = coverageMaps.find( symbolName );
|
itr = coverageMaps.find( symbolName );
|
||||||
if ( itr == coverageMaps.end() ) {
|
if ( itr == coverageMaps.end() ) {
|
||||||
theMap = new CoverageMap( lowAddress, highAddress );
|
theMap = new CoverageMap( fileName, lowAddress, highAddress );
|
||||||
coverageMaps[ symbolName ] = theMap;
|
coverageMaps[ symbolName ] = theMap;
|
||||||
} else {
|
} else {
|
||||||
theMap = itr->second;
|
theMap = itr->second;
|
||||||
|
@@ -93,6 +93,7 @@ namespace Coverage {
|
|||||||
/*!
|
/*!
|
||||||
* This method creates a coverage map for the specified symbol.
|
* 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] symbolName specifies the name of the symbol
|
||||||
* @param[in] lowAddress specifies the low address of the coverage map
|
* @param[in] lowAddress specifies the low address of the coverage map
|
||||||
* @param[in] highAddress specifies the high 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
|
* @return Returns a pointer to the coverage map
|
||||||
*/
|
*/
|
||||||
CoverageMapBase* createCoverageMap (
|
CoverageMapBase* createCoverageMap (
|
||||||
|
const std::string& exefileName,
|
||||||
const std::string& symbolName,
|
const std::string& symbolName,
|
||||||
uint32_t lowAddress,
|
uint32_t lowAddress,
|
||||||
uint32_t highAddress
|
uint32_t highAddress
|
||||||
|
@@ -97,7 +97,7 @@ namespace Coverage {
|
|||||||
|
|
||||||
// Create a coverage map for the symbol.
|
// Create a coverage map for the symbol.
|
||||||
aCoverageMap = executableInfo->createCoverageMap(
|
aCoverageMap = executableInfo->createCoverageMap(
|
||||||
symbolName, lowAddress, endAddress
|
executableInfo->getFileName().c_str(), symbolName, lowAddress, endAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
if (aCoverageMap) {
|
if (aCoverageMap) {
|
||||||
@@ -112,7 +112,8 @@ namespace Coverage {
|
|||||||
|
|
||||||
// Create a unified coverage map for the symbol.
|
// Create a unified coverage map for the symbol.
|
||||||
SymbolsToAnalyze->createCoverageMap(
|
SymbolsToAnalyze->createCoverageMap(
|
||||||
symbolName, endAddress - lowAddress + 1
|
executableInfo->getFileName().c_str(), symbolName,
|
||||||
|
endAddress - lowAddress + 1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user