change log for rtems-testing (2011-01-25)
rtems-vc at rtems.org
rtems-vc at rtems.org
Tue Jan 25 22:10:03 UTC 2011
*jennifer*:
2011-01-25 Jennifer Averett <Jennifer.Averett at OARcorp.com>
* CoverageMapBase.cc, CoverageMapBase.h, CoverageReaderQEMU.cc,
DesiredSymbols.cc, ExecutableInfo.cc, SymbolTable.cc, SymbolTable.h:
Modifications to track multiple address ranges for the same symbol.
M 1.19 covoar/ChangeLog
M 1.3 covoar/CoverageMapBase.h
M 1.3 covoar/CoverageMapBase.cc
M 1.4 covoar/CoverageReaderQEMU.cc
M 1.6 covoar/DesiredSymbols.cc
M 1.3 covoar/ExecutableInfo.cc
M 1.2 covoar/SymbolTable.h
M 1.2 covoar/SymbolTable.cc
diff -u rtems-testing/covoar/ChangeLog:1.18 rtems-testing/covoar/ChangeLog:1.19
--- rtems-testing/covoar/ChangeLog:1.18 Tue Jan 25 14:48:36 2011
+++ rtems-testing/covoar/ChangeLog Tue Jan 25 15:26:00 2011
@@ -1,3 +1,9 @@
+2011-01-25 Jennifer Averett <Jennifer.Averett at OARcorp.com>
+
+ * CoverageMapBase.cc, CoverageMapBase.h, CoverageReaderQEMU.cc,
+ DesiredSymbols.cc, ExecutableInfo.cc, SymbolTable.cc, SymbolTable.h:
+ Modifications to track multiple address ranges for the same symbol.
+
2011-01-25 Joel Sherrill <joel.sherrill at oarcorp.com>
* ExecutableInfo.cc: Hack a shot at seeing if symbol is already known.
diff -u rtems-testing/covoar/CoverageMapBase.h:1.2 rtems-testing/covoar/CoverageMapBase.h:1.3
--- rtems-testing/covoar/CoverageMapBase.h:1.2 Mon Jan 17 16:19:16 2011
+++ rtems-testing/covoar/CoverageMapBase.h Tue Jan 25 15:26:00 2011
@@ -13,6 +13,7 @@
#include <stdint.h>
#include <string>
+#include <list>
namespace Coverage {
@@ -24,6 +25,29 @@
public:
+ /*!
+ * This structure identifies the low and high addresses
+ * of one range. Note:: There may be more than one address
+ * range per symbol.
+ */
+ typedef struct {
+ /*!
+ * This is the low address of the address map range.
+ */
+ uint32_t lowAddress;
+
+ /*!
+ * This is the high address of the address map range.
+ */
+ uint32_t highAddress;
+
+ } AddressRange_t;
+
+ /*
+ * This type identifies a list of ranges.
+ */
+ typedef std::list< AddressRange_t > AddressRange;
+
/*!
* This method constructs a CoverageMapBase instance.
*
@@ -41,11 +65,65 @@
virtual ~CoverageMapBase();
/*!
+ * This method adds a address range to the RangeList.
+ *
+ * @param[in] Low specifies the lowAddress
+ * @param[in] High specifies the highAddress
+ *
+ */
+ void Add( uint32_t low, uint32_t high );
+
+ /*!
+ * This method returns true and sets the offset if
+ * the address falls with the bounds of an address range
+ * in the RangeList.
+ *
+ * @param[in] address specifies the address to find
+ * @param[out] offset contains the offset from the low
+ * address of the address range.
+ *
+ * @return Returns TRUE if the address range can be found
+ * and FALSE if it was not.
+ */
+ bool determineOffset( uint32_t address, uint32_t *offset ) const;
+
+ /*!
* This method prints the contents of the coverage map to stdout.
*/
void dump( void ) const;
/*!
+ * This method will return the low address of the first range in
+ * the RangeList.
+ *
+ * @return Returns the low address of the first range in
+ * the RangeList.
+ */
+ int32_t getFirstLowAddress() const;
+
+ /*!
+ * This method returns true and sets the address range if
+ * the address falls with the bounds of an address range
+ * in the RangeList.
+ *
+ * @param[in] address specifies the address to find
+ * @param[out] range contains the high and low addresse for
+ * the range
+ *
+ * @return Returns TRUE if the address range can be found
+ * and FALSE if it was not.
+ */
+ bool getRange( uint32_t address, AddressRange_t *range ) const;
+
+ /*!
+ * This method returns the size of the address range.
+ *
+ * @return Returns Size of the address range.
+ */
+ uint32_t getSize() const;
+
+
+ /*!
* This method returns the address of the beginning of the
* instruction that contains the specified address.
*
@@ -65,15 +143,15 @@
* This method returns the high address of the coverage map.
*
* @return Returns the high address of the coverage map.
- */
uint32_t getHighAddress( void ) const;
+ */
/*!
* This method returns the low address of the coverage map.
*
* @return Returns the low address of the coverage map.
- */
uint32_t getLowAddress( void ) const;
+ */
/*!
* This method sets the boolean which indicates if this
@@ -250,21 +328,22 @@
} perAddressInfo_t;
/*!
- * This is a dynamically allocated array of data that is
- * kept for each address.
+ *
+ * This is a list of address ranges for this symbolic address.
*/
- perAddressInfo_t* Info;
+ AddressRange RangeList;
/*!
- * This is the low address of the address map range.
+ *
+ * This variable contains the size of the code block.
*/
- uint32_t lowAddress;
+ uint32_t Size;
/*!
- * This is the high address of the address map range.
+ * This is a dynamically allocated array of data that is
+ * kept for each address.
*/
- uint32_t highAddress;
-
+ perAddressInfo_t* Info;
};
}
diff -u rtems-testing/covoar/CoverageMapBase.cc:1.2 rtems-testing/covoar/CoverageMapBase.cc:1.3
--- rtems-testing/covoar/CoverageMapBase.cc:1.2 Mon Jan 17 16:19:16 2011
+++ rtems-testing/covoar/CoverageMapBase.cc Tue Jan 25 15:26:00 2011
@@ -22,15 +22,22 @@
CoverageMapBase::CoverageMapBase(
uint32_t low,
uint32_t high
- ) : lowAddress(low), highAddress(high)
+ )
{
- uint32_t a;
+ uint32_t a;
+ AddressRange_t range;
+
+ range.lowAddress = low;
+ range.highAddress = high;
+ RangeList.push_back( range );
+
+ Size = high - low + 1;
- Info = new perAddressInfo_t[ high - low + 1 ];
+ Info = new perAddressInfo_t[ Size ];
- for (a=low; a<=high; a++) {
+ for (a=0; a<Size; a++) {
- perAddressInfo_t *i = &Info[ a-low ];
+ perAddressInfo_t *i = &Info[ a ];
i->isStartOfInstruction = false;
i->wasExecuted = false;
@@ -45,6 +52,33 @@
if (Info)
delete Info;
}
+
+ void CoverageMapBase::Add( uint32_t low, uint32_t high )
+ {
+ AddressRange_t range;
+
+ range.lowAddress = low;
+ range.highAddress = high;
+ RangeList.push_back( range );
+ }
+
+ bool CoverageMapBase::determineOffset(
+ uint32_t address,
+ uint32_t *offset
+ )const
+ {
+ AddressRange::const_iterator itr;
+
+ for ( itr = RangeList.begin(); itr != RangeList.end(); itr++ ) {
+ if ((address >= itr->lowAddress) && (address <= itr->highAddress)){
+ *offset = address - itr->lowAddress;
+ return true;
+ }
+ }
+ *offset = 0;
+ return false;
+ }
+
void CoverageMapBase::dump( void ) const {
@@ -53,14 +87,18 @@
fprintf( stderr, "Coverage Map Contents:\n" );
- for (a = lowAddress; a <= highAddress; a++) {
+ /*
+ * XXX - Dump is only marking the first Address Range.
+ */
- entry = &Info[ a - lowAddress ];
+ for (a = 0; a < Size; a++) {
+
+ entry = &Info[ a ];
fprintf(
stderr,
"0x%x - isStartOfInstruction = %s, wasExecuted = %s\n",
- a,
+ a + RangeList.front().lowAddress,
entry->isStartOfInstruction ? "TRUE" : "FALSE",
entry->wasExecuted ? "TRUE" : "FALSE"
);
@@ -79,16 +117,19 @@
uint32_t* beginning
) const
{
- bool status = false;
- uint32_t start;
+ bool status = false;
+ uint32_t start;
+ AddressRange_t range;
+
- if ((address < lowAddress) || (address > highAddress))
+ status = getRange( address, &range );
+ if ( status != true )
return status;
start = address;
- while (start >= lowAddress ) {
- if (Info[ start - lowAddress ].isStartOfInstruction) {
+ while (start >= range.lowAddress ) {
+ if (Info[ start - range.lowAddress ].isStartOfInstruction) {
*beginning = start;
status = true;
break;
@@ -100,119 +141,184 @@
return status;
}
- uint32_t CoverageMapBase::getHighAddress( void ) const
+ int32_t CoverageMapBase::getFirstLowAddress() const
+ {
+ return RangeList.front().lowAddress;
+ }
+
+ bool CoverageMapBase::getRange( uint32_t address, AddressRange_t *range ) const
{
- return highAddress;
+ AddressRange::const_iterator itr;
+
+ for ( itr = RangeList.begin(); itr != RangeList.end(); itr++ ) {
+ if ((address >= itr->lowAddress) && (address <= itr->highAddress)){
+ range->lowAddress = itr->lowAddress;
+ range->highAddress = itr->highAddress;
+ return true;
+ }
+ }
+
+ range->lowAddress = 0;
+ range->highAddress = 0;
+
+ return false;
+
}
- uint32_t CoverageMapBase::getLowAddress( void ) const
+ uint32_t CoverageMapBase::getSize() const
{
- return lowAddress;
+ return Size;
}
void CoverageMapBase::setIsStartOfInstruction(
uint32_t address
)
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return;
- Info[ address - lowAddress ].isStartOfInstruction = true;
+
+ Info[ offset ].isStartOfInstruction = true;
}
bool CoverageMapBase::isStartOfInstruction( uint32_t address ) const
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return false;
- return Info[ address - lowAddress ].isStartOfInstruction;
+
+ return Info[ offset ].isStartOfInstruction;
}
void CoverageMapBase::setWasExecuted( uint32_t address )
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return;
- Info[ address - lowAddress ].wasExecuted = true;
+
+ Info[ offset ].wasExecuted = true;
}
bool CoverageMapBase::wasExecuted( uint32_t address ) const
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return false;
- return Info[ address - lowAddress ].wasExecuted;
+
+ return Info[ offset ].wasExecuted;
}
void CoverageMapBase::setIsBranch(
uint32_t address
)
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return;
- Info[ address - lowAddress ].isBranch = true;
+
+ Info[ offset ].isBranch = true;
}
bool CoverageMapBase::isNop( uint32_t address ) const
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return false;
- return Info[ address - lowAddress ].isNop;
+
+ return Info[ offset ].isNop;
}
void CoverageMapBase::setIsNop(
uint32_t address
)
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return;
- Info[ address - lowAddress ].isNop = true;
+
+ Info[ offset ].isNop = true;
}
bool CoverageMapBase::isBranch( uint32_t address ) const
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return false;
- return Info[ address - lowAddress ].isBranch;
+
+ return Info[ offset ].isBranch;
}
void CoverageMapBase::setWasTaken(
uint32_t address
)
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return;
- Info[ address - lowAddress ].wasTaken = true;
+
+ Info[ offset ].wasTaken = true;
}
void CoverageMapBase::setWasNotTaken(
uint32_t address
)
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return;
- Info[ address - lowAddress ].wasNotTaken = true;
+
+ Info[ offset ].wasNotTaken = true;
}
bool CoverageMapBase::wasAlwaysTaken( uint32_t address ) const
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return false;
- return (Info[ address - lowAddress ].wasTaken &&
- !Info[ address - lowAddress ].wasNotTaken);
+
+ return (Info[ offset ].wasTaken &&
+ !Info[ offset ].wasNotTaken);
}
bool CoverageMapBase::wasNeverTaken( uint32_t address ) const
{
- if ((address < lowAddress) || (address > highAddress))
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
return false;
- return (!Info[ address - lowAddress ].wasTaken &&
- Info[ address - lowAddress ].wasNotTaken);
+
+ return (!Info[ offset ].wasTaken &&
+ Info[ offset ].wasNotTaken);
}
bool CoverageMapBase::wasNotTaken( uint32_t address ) const
{
- return (Info[ address - lowAddress ].wasNotTaken);
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
+ return false;
+
+ return Info[ offset ].wasNotTaken;
}
bool CoverageMapBase::wasTaken( uint32_t address ) const
{
- return (Info[ address - lowAddress ].wasTaken);
+ uint32_t offset;
+
+ if (determineOffset( address, &offset ) != true)
+ return false;
+
+ return Info[ offset ].wasTaken;
}
}
diff -u rtems-testing/covoar/CoverageReaderQEMU.cc:1.3 rtems-testing/covoar/CoverageReaderQEMU.cc:1.4
--- rtems-testing/covoar/CoverageReaderQEMU.cc:1.3 Mon Jan 24 15:11:25 2011
+++ rtems-testing/covoar/CoverageReaderQEMU.cc Tue Jan 25 15:26:00 2011
@@ -141,23 +141,20 @@
// Determine if additional branch information is available.
if ( (entry->op & branchInfo) != 0 ) {
- unsigned int a = entry->pc + entry->size - 1;
- if ( (entry->pc < aCoverageMap->getLowAddress()) ||
- (entry->pc > aCoverageMap->getHighAddress()) ||
- (a < aCoverageMap->getLowAddress()) ||
- (a > aCoverageMap->getHighAddress()) ) {
+ uint32_t offset_e, offset_a;
+ uint32_t a = entry->pc + entry->size - 1;
+ if ((aCoverageMap->determineOffset( a, &offset_a ) != true) ||
+ (aCoverageMap->determineOffset( entry->pc, &offset_e ) != true))
+ {
fprintf(
stderr,
"*** Trace block is inconsistent with coverage map\n"
"*** Trace block (0x%08x - 0x%08x) for %d bytes\n"
- "*** Coverage map (0x%08x - 0x%08x) for %d bytes\n",
+ "*** Coverage map XXX \n",
entry->pc,
a,
- entry->size,
- aCoverageMap->getLowAddress(),
- aCoverageMap->getHighAddress(),
- aCoverageMap->getHighAddress() - aCoverageMap->getLowAddress()
- );
+ entry->size
+ );
} else {
while (!aCoverageMap->isStartOfInstruction(a))
a--;
diff -u rtems-testing/covoar/DesiredSymbols.cc:1.5 rtems-testing/covoar/DesiredSymbols.cc:1.6
--- rtems-testing/covoar/DesiredSymbols.cc:1.5 Mon Jan 17 16:19:16 2011
+++ rtems-testing/covoar/DesiredSymbols.cc Tue Jan 25 15:26:00 2011
@@ -89,6 +89,8 @@
line,
inputBuffer
);
+
+ delete symInfo;
}
// Add this to the set of symbols.
@@ -627,7 +629,7 @@
uint32_t sAddress;
uint32_t sBaseAddress;
uint32_t sMapSize;
-
+
// Ensure that the symbol is a desired symbol.
itr = set.find( symbolName );
@@ -645,8 +647,8 @@
// Ensure that the source and destination coverage maps
// are the same size.
dMapSize = itr->second.stats.sizeInBytes;
- sBaseAddress = sourceCoverageMap->getLowAddress();
- sMapSize = sourceCoverageMap->getHighAddress() - sBaseAddress + 1;
+ sBaseAddress = sourceCoverageMap->getFirstLowAddress();
+ sMapSize = sourceCoverageMap->getSize();
if (dMapSize != sMapSize) {
fprintf(
diff -u rtems-testing/covoar/ExecutableInfo.cc:1.2 rtems-testing/covoar/ExecutableInfo.cc:1.3
--- rtems-testing/covoar/ExecutableInfo.cc:1.2 Tue Jan 25 14:48:36 2011
+++ rtems-testing/covoar/ExecutableInfo.cc Tue Jan 25 15:26:00 2011
@@ -90,13 +90,15 @@
uint32_t highAddress
)
{
- CoverageMapBase* theMap;
+ CoverageMapBase *theMap;
+ ExecutableInfo::coverageMaps_t::iterator itr;
- theMap = coverageMaps.find( symbolName );
- if ( theMap == std::map.end() ) {
+ itr = coverageMaps.find( symbolName );
+ if ( itr == coverageMaps.end() ) {
theMap = new CoverageMap( lowAddress, highAddress );
coverageMaps[ symbolName ] = theMap;
} else {
+ theMap = itr->second;
theMap->Add( lowAddress, highAddress );
}
return theMap;
diff -u rtems-testing/covoar/SymbolTable.h:1.1 rtems-testing/covoar/SymbolTable.h:1.2
--- rtems-testing/covoar/SymbolTable.h:1.1 Mon May 24 15:07:08 2010
+++ rtems-testing/covoar/SymbolTable.h Tue Jan 25 15:26:00 2011
@@ -14,6 +14,7 @@
#include <stdint.h>
#include <string>
#include <map>
+#include <list>
namespace Coverage {
@@ -33,7 +34,11 @@
typedef struct {
uint32_t startingAddress;
uint32_t length;
- } symbolInfo;
+ } symbolInfo_t;
+
+ typedef std::list< symbolInfo_t > symbolInfo;
+
+
/*!
* This method constructs a SymbolTable instance.
diff -u rtems-testing/covoar/SymbolTable.cc:1.1 rtems-testing/covoar/SymbolTable.cc:1.2
--- rtems-testing/covoar/SymbolTable.cc:1.1 Mon May 24 15:07:08 2010
+++ rtems-testing/covoar/SymbolTable.cc Tue Jan 25 15:26:00 2011
@@ -33,9 +33,9 @@
const uint32_t length
)
{
- uint32_t end = 0;
- symbol_entry_t entry;
- symbolInfo symbolData;
+ uint32_t end = 0;
+ symbol_entry_t entry;
+ symbolInfo_t symbolData;
// Add an entry to the address map.
end = start + length - 1;
@@ -47,7 +47,15 @@
// Add an entry to the symbol information map.
symbolData.startingAddress = start;
symbolData.length = length;
- info[ symbol ] = symbolData;
+
+ if ( info[ symbol ].empty() == false ) {
+ if ( info[symbol ].front().length != length ) {
+ fprintf(stderr, "ERROR==> Different lengths for the symbol %s\n", symbol.c_str() );
+ exit( 0 );
+ }
+ }
+
+ info[ symbol ].push_back( symbolData );
}
SymbolTable::symbolInfo* SymbolTable::getInfo(
@@ -71,7 +79,7 @@
if (it == info.end())
return 0;
else
- return ((*it).second.length);
+ return ((*it).second.front().length);
}
std::string SymbolTable::getSymbol(
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110125/69c31beb/attachment-0001.html>
More information about the vc
mailing list