Changeset 99c90b3 in rtems-tools for tester/covoar/ExecutableInfo.cc


Ignore:
Timestamp:
Aug 5, 2018, 11:41:08 PM (17 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
317d85d
Parents:
f450227
git-author:
Chris Johns <chrisj@…> (08/05/18 23:41:08)
git-committer:
Chris Johns <chrisj@…> (08/06/18 23:11:29)
Message:

tester/covoar: Integrate DWARF function data.

Use DAWRF function data to create the executable coverage
maps. Integrate the existing objdump processing with this
data.

  • Refactor CoverageMapBase? to have the address ranges and address info as separate objects. Move the to address info into a vector. Add support for multiple address ranges.
  • DesiredSymbols? is only interested in function symbols.
  • ExecutableInfo? creates coverage maps from DWARF function data.
  • Add warning flags to the covoar build.
  • Varous C++11 refactoring.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester/covoar/ExecutableInfo.cc

    rf450227 r99c90b3  
    2020  ExecutableInfo::ExecutableInfo(
    2121    const char* const theExecutableName,
    22     const char* const theLibraryName
     22    const char* const theLibraryName,
     23    bool              verbose
    2324    ) : executable(theExecutableName),
    2425        loadAddress(0)
    2526  {
    26     if (theLibraryName)
     27    if (theLibraryName != nullptr)
    2728      libraryName = theLibraryName;
     29
     30    if (verbose) {
     31      std::cerr << "Loading executable " << theExecutableName;
     32      if (theLibraryName != nullptr)
     33        std::cerr << " (" << theLibraryName << ')';
     34      std::cerr << std::endl;
     35    }
    2836
    2937    executable.open();
     
    3341    debug.load_debug();
    3442    debug.load_functions();
     43
     44    for (auto& cu : debug.get_cus()) {
     45      for (auto& func : cu.get_functions()) {
     46        if (func.has_machine_code() && (!func.is_inlined() || func.is_external())) {
     47          createCoverageMap (cu.name(), func.name(),
     48                             func.pc_low(), func.pc_high());
     49        }
     50      }
     51    }
    3552  }
    3653
     
    96113  }
    97114
    98   CoverageMapBase* ExecutableInfo::createCoverageMap (
     115  CoverageMapBase& ExecutableInfo::findCoverageMap(
     116    const std::string& symbolName
     117  )
     118  {
     119    CoverageMaps::iterator cmi = coverageMaps.find( symbolName );
     120    if ( cmi == coverageMaps.end() )
     121      throw rld::error (symbolName, "ExecutableInfo::findCoverageMap");
     122    return *(cmi->second);
     123  }
     124
     125  void ExecutableInfo::createCoverageMap (
    99126    const std::string& fileName,
    100127    const std::string& symbolName,
     
    114141      theMap->Add( lowAddress, highAddress );
    115142    }
    116     return theMap;
    117143  }
    118144
     
    136162
    137163  void ExecutableInfo::mergeCoverage( void ) {
    138     ExecutableInfo::CoverageMaps::iterator  itr;
    139 
    140     for (itr = coverageMaps.begin(); itr != coverageMaps.end(); itr++) {
    141       SymbolsToAnalyze->mergeCoverageMap( (*itr).first, (*itr).second );
     164    for (auto& cm : coverageMaps) {
     165      if (SymbolsToAnalyze->isDesired( cm.first ))
     166        SymbolsToAnalyze->mergeCoverageMap( cm.first, cm.second );
    142167    }
    143168  }
Note: See TracChangeset for help on using the changeset viewer.