diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-01-17 22:19:16 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-01-17 22:19:16 +0000 |
commit | 8d8ac524aba61457814f076d4bf343129ba0be0b (patch) | |
tree | c60ef349a2cf31eb7da97b50de4076cbea4fe796 /covoar | |
parent | 2011-01-17 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff) | |
download | rtems-testing-8d8ac524aba61457814f076d4bf343129ba0be0b.tar.bz2 |
2011-01-17 Joel Sherrill <joel.sherrilL@OARcorp.com>
* CoverageMapBase.cc, CoverageMapBase.h, DesiredSymbols.cc: Improve NOP
detection and processing.
Diffstat (limited to 'covoar')
-rw-r--r-- | covoar/ChangeLog | 5 | ||||
-rw-r--r-- | covoar/CoverageMapBase.cc | 16 | ||||
-rw-r--r-- | covoar/CoverageMapBase.h | 23 | ||||
-rw-r--r-- | covoar/DesiredSymbols.cc | 31 |
4 files changed, 73 insertions, 2 deletions
diff --git a/covoar/ChangeLog b/covoar/ChangeLog index 62fe9f8..87e35bf 100644 --- a/covoar/ChangeLog +++ b/covoar/ChangeLog @@ -1,3 +1,8 @@ +2011-01-17 Joel Sherrill <joel.sherrilL@OARcorp.com> + + * CoverageMapBase.cc, CoverageMapBase.h, DesiredSymbols.cc: Improve NOP + detection and processing. + 2010-10-04 Joel Sherrill <joel.sherrill@oarcorp.com> * qemu-dump-trace.c: Fix issues identified by clang-analyzer. diff --git a/covoar/CoverageMapBase.cc b/covoar/CoverageMapBase.cc index 007d330..225cd34 100644 --- a/covoar/CoverageMapBase.cc +++ b/covoar/CoverageMapBase.cc @@ -149,6 +149,22 @@ namespace Coverage { Info[ address - lowAddress ].isBranch = true; } + bool CoverageMapBase::isNop( uint32_t address ) const + { + if ((address < lowAddress) || (address > highAddress)) + return false; + return Info[ address - lowAddress ].isNop; + } + + void CoverageMapBase::setIsNop( + uint32_t address + ) + { + if ((address < lowAddress) || (address > highAddress)) + return; + Info[ address - lowAddress ].isNop = true; + } + bool CoverageMapBase::isBranch( uint32_t address ) const { if ((address < lowAddress) || (address > highAddress)) diff --git a/covoar/CoverageMapBase.h b/covoar/CoverageMapBase.h index 998fb73..40f3d6c 100644 --- a/covoar/CoverageMapBase.h +++ b/covoar/CoverageMapBase.h @@ -125,6 +125,25 @@ namespace Coverage { /*! * This method returns a boolean which indicates if the specified + * address is the starting address of a NOP instruction. + * + * @param[in] address specifies the address to check + * + * @return Returns TRUE if a NOP instruction is at the + * specified address and FALSE otherwise. + */ + bool isNop( uint32_t address ) const; + + /*! + * This method sets the boolean which indicates if the specified + * address is the starting address of a NOP instruction. + * + * @param[in] address specifies the address of the NOP instruction + */ + void setIsNop( uint32_t address ); + + /*! + * This method returns a boolean which indicates if the specified * address is the starting address of a branch instruction. * * @param[in] address specifies the address to check @@ -215,6 +234,10 @@ namespace Coverage { */ bool isBranch; /*! + * This member indicates that the address is a NOP instruction. + */ + bool isNop; + /*! * When isBranch is TRUE, this member indicates that the branch * instruction at the address was taken. */ diff --git a/covoar/DesiredSymbols.cc b/covoar/DesiredSymbols.cc index 6c09cf6..b4ca2c2 100644 --- a/covoar/DesiredSymbols.cc +++ b/covoar/DesiredSymbols.cc @@ -102,6 +102,7 @@ namespace Coverage { void DesiredSymbols::preprocess( void ) { ObjdumpProcessor::objdumpLines_t::iterator fitr; + ObjdumpProcessor::objdumpLines_t::iterator n, p; DesiredSymbols::symbolSet_t::iterator sitr; CoverageMapBase* theCoverageMap; @@ -116,7 +117,7 @@ namespace Coverage { if (!theCoverageMap) continue; - // Mark any branch instructions. + // Mark any branch and NOP instructions. for (fitr = sitr->second.instructions.begin(); fitr != sitr->second.instructions.end(); fitr++) { @@ -125,7 +126,13 @@ namespace Coverage { fitr->address - sitr->second.baseAddress ); } + if (fitr->isNop) { + theCoverageMap->setIsNop( + fitr->address - sitr->second.baseAddress + ); + } } + } } @@ -176,7 +183,6 @@ namespace Coverage { } } - if (!theCoverageMap->wasExecuted( a )) { stats.uncoveredBytes++; @@ -216,6 +222,27 @@ namespace Coverage { theBranches = new CoverageRanges(); sitr->second.uncoveredBranches = theBranches; + // Mark NOPs as executed + endAddress = sitr->second.stats.sizeInBytes - 1; + a = 0; + while (a < endAddress) { + if (!theCoverageMap->wasExecuted( a )) { + a++; + continue; + } + + for (ha=a+1; + ha<=endAddress && !theCoverageMap->isStartOfInstruction( ha ); + ha++) + ; + if ( ha >= endAddress ) + break; + + if (theCoverageMap->isNop( ha )) + theCoverageMap->setWasExecuted( ha ); + a = ha; + } + // Now scan through the coverage map of this symbol. endAddress = sitr->second.stats.sizeInBytes - 1; a = 0; |