Changeset c356a9b in rtems-testing


Ignore:
Timestamp:
May 11, 2010, 9:08:58 PM (9 years ago)
Author:
Glenn Humphrey <glenn.humphrey@…>
Branches:
4.11, 8895273c193787f84c4585a10f6d6aceb3b25dc4
Children:
89c4b1d
Parents:
af4279e
Message:

2010-05-11 Glenn Humphrey

Location:
rtems-coverage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rtems-coverage/ChangeLog

    raf4279e rc356a9b  
     12010-05-11      Glenn Humphrey
     2
     3        * DesiredSymbols.cc, ObjdumpProcessor.cc: Due to differences in nops
     4        used for alignment, had to move the trimming of trailing nops to the
     5        objdump processing.
     6
    172010-05-11      Joel Sherrill <joel.sherrilL@OARcorp.com>
    28
  • rtems-coverage/DesiredSymbols.cc

    raf4279e rc356a9b  
    109109  void DesiredSymbols::preprocess( void )
    110110  {
    111     ObjdumpProcessor::objdumpLines_t::iterator         fitr;
    112     ObjdumpProcessor::objdumpLines_t::reverse_iterator itr;
    113     DesiredSymbols::symbolSet_t::iterator              sitr;
    114     CoverageMapBase*                                   theCoverageMap;
     111    ObjdumpProcessor::objdumpLines_t::iterator fitr;
     112    DesiredSymbols::symbolSet_t::iterator      sitr;
     113    CoverageMapBase*                           theCoverageMap;
    115114
    116115    // Look at each symbol.
     
    124123      if (!theCoverageMap)
    125124        continue;
    126 
    127       // Mark any trailing nops as executed.  Some targets use nops to
    128       // force alignment of the next method but still include the nops
    129       // in the symbol size.
    130       //
    131       // Mark all branches as isBranch.
    132       //
    133       // NOTE: If nop's are used for alignment inside a method, this
    134       //       will not mark them!!!
    135       for (itr = sitr->second.instructions.rbegin(), itr++;
    136            itr != sitr->second.instructions.rend();
    137            itr++) {
    138         if (itr->isNop) {
    139           for ( int a=0; a < itr->nopSize ; a++ ) {
    140             theCoverageMap->setWasExecuted(
    141               itr->address - sitr->second.baseAddress + a
    142             );
    143           }
    144         } else
    145           break;
    146       }
    147125
    148126      // Mark any branch instructions.
     
    161139  void DesiredSymbols::computeUncovered( void )
    162140  {
    163     uint32_t                                           a, la, ha;
    164     uint32_t                                           endAddress;
    165     ObjdumpProcessor::objdumpLines_t::reverse_iterator itr;
    166     DesiredSymbols::symbolSet_t::iterator              sitr;
    167     CoverageRanges*                                    theBranches;
    168     CoverageMapBase*                                   theCoverageMap;
    169     CoverageRanges*                                    theRanges;
     141    uint32_t                              a, la, ha;
     142    uint32_t                              endAddress;
     143    DesiredSymbols::symbolSet_t::iterator sitr;
     144    CoverageRanges*                       theBranches;
     145    CoverageMapBase*                      theCoverageMap;
     146    CoverageRanges*                       theRanges;
    170147
    171148    // Look at each symbol.
  • rtems-coverage/ObjdumpProcessor.cc

    raf4279e rc356a9b  
    3636  ) {
    3737
    38     CoverageMapBase*                           aCoverageMap = NULL;
    39     ObjdumpProcessor::objdumpLines_t::iterator itr;
    40     SymbolTable*                               theSymbolTable;
     38    CoverageMapBase*                                   aCoverageMap = NULL;
     39    uint32_t                                           endAddress = highAddress;
     40    ObjdumpProcessor::objdumpLines_t::iterator         itr, fnop, lnop;
     41    ObjdumpProcessor::objdumpLines_t::reverse_iterator ritr;
     42    SymbolTable*                                       theSymbolTable;
     43
     44    //
     45    // Remove trailing nop instructions.
     46    //
     47
     48    // First find the last instruction.
     49    for (ritr = instructions.rbegin();
     50         ritr != instructions.rend();
     51         ritr++) {
     52      if (ritr->isInstruction)
     53        break;
     54    }
     55
     56    // If an instruction was found and it is a nop, ...
     57    if ((ritr != instructions.rend()) && (ritr->isNop)) {
     58
     59      // save it as the last nop.  Note that we must account for
     60      // the difference between a forward and a reverse iterator.
     61      lnop = ritr.base();
     62      lnop--;
     63      endAddress -= lnop->nopSize;
     64
     65      // Now look for the first nop in the sequence of trailing nops.
     66      fnop = lnop;
     67      ritr++;
     68      for (; ritr != instructions.rend(); ritr++) {
     69        if (ritr->isNop) {
     70          fnop = ritr.base();
     71          fnop--;
     72          endAddress -= fnop->nopSize;
     73        }
     74        else
     75          break;
     76      }
     77
     78      // Erase trailing nops.  The erase operation wants the first
     79      // parameter to point to the first item to erase and the second
     80      // parameter to point to the item beyond the last item to erase.
     81      instructions.erase( fnop, ++lnop );
     82    }
    4183
    4284    // If there are NOT already saved instructions, save them.
     
    5092    theSymbolTable = executableInfo->getSymbolTable();
    5193    theSymbolTable->addSymbol(
    52       symbolName, lowAddress, highAddress - lowAddress + 1
     94      symbolName, lowAddress, endAddress - lowAddress + 1
    5395    );
    5496
    5597    // Create a coverage map for the symbol.
    5698    aCoverageMap = executableInfo->createCoverageMap(
    57       symbolName, lowAddress, highAddress
     99      symbolName, lowAddress, endAddress
    58100    );
    59101
     
    70112      // Create a unified coverage map for the symbol.
    71113      SymbolsToAnalyze->createCoverageMap(
    72         symbolName, highAddress - lowAddress + 1
     114        symbolName, endAddress - lowAddress + 1
    73115      );
    74116    }
     
    241283    char               symbol[ 100 ];
    242284    SymbolInformation* symbolInformation = NULL;
    243     char               terminator;
     285    char               terminator1;
     286    char               terminator2;
    244287    objdumpLines_t     theInstructions;
    245288
     
    260303            currentSymbol,
    261304            baseAddress,
    262             address,  // XXX fix to determine corrent end address
     305            address,  // XXX fix to determine correct end address
    263306            theInstructions,
    264307            symbolInformation
     
    290333        buffer,
    291334        "%x <%[^>]>%c",
    292         &address, symbol, &terminator
     335        &address, symbol, &terminator1
    293336      );
    294337
    295338      // If all items found, we are at the beginning of a symbol's objdump.
    296       if ((items == 3) && (terminator == ':')) {
     339      if ((items == 3) && (terminator1 == ':')) {
    297340
    298341        // If we are currently processing a symbol, finalize it.
     
    330373        items = sscanf(
    331374          buffer,
    332           "%x%c",
    333           &instructionAddress, &terminator
     375          "%x%c\t%*[^\t]%c",
     376          &instructionAddress, &terminator1, &terminator2
    334377        );
    335378
    336379        // If it looks like an instruction ...
    337         if ((items == 2) && (terminator == ':')) {
     380        if ((items == 3) && (terminator1 == ':') && (terminator2 == '\t')) {
    338381
    339382          // update the line's information, save it and ...
Note: See TracChangeset for help on using the changeset viewer.