diff options
author | Chris Johns <chrisj@rtems.org> | 2018-08-06 09:41:08 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2018-08-07 09:11:29 +1000 |
commit | 99c90b3353bf5b638dcfd87803e4aaf02adf3219 (patch) | |
tree | 06261fff19936db1f0db82383d02ba9eb2e75ed8 /tester/covoar/ExecutableInfo.cc | |
parent | linkers/exeinfo: Add an inlines report and DWARF data dump. (diff) | |
download | rtems-tools-99c90b3353bf5b638dcfd87803e4aaf02adf3219.tar.bz2 |
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.
Diffstat (limited to 'tester/covoar/ExecutableInfo.cc')
-rw-r--r-- | tester/covoar/ExecutableInfo.cc | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc index 710b25c..0a629b7 100644 --- a/tester/covoar/ExecutableInfo.cc +++ b/tester/covoar/ExecutableInfo.cc @@ -19,19 +19,36 @@ namespace Coverage { ExecutableInfo::ExecutableInfo( const char* const theExecutableName, - const char* const theLibraryName + const char* const theLibraryName, + bool verbose ) : executable(theExecutableName), loadAddress(0) { - if (theLibraryName) + if (theLibraryName != nullptr) libraryName = theLibraryName; + if (verbose) { + std::cerr << "Loading executable " << theExecutableName; + if (theLibraryName != nullptr) + std::cerr << " (" << theLibraryName << ')'; + std::cerr << std::endl; + } + executable.open(); executable.begin(); executable.load_symbols(symbols); debug.begin(executable.elf()); debug.load_debug(); debug.load_functions(); + + for (auto& cu : debug.get_cus()) { + for (auto& func : cu.get_functions()) { + if (func.has_machine_code() && (!func.is_inlined() || func.is_external())) { + createCoverageMap (cu.name(), func.name(), + func.pc_low(), func.pc_high()); + } + } + } } ExecutableInfo::~ExecutableInfo() @@ -95,7 +112,17 @@ namespace Coverage { return &theSymbolTable; } - CoverageMapBase* ExecutableInfo::createCoverageMap ( + CoverageMapBase& ExecutableInfo::findCoverageMap( + const std::string& symbolName + ) + { + CoverageMaps::iterator cmi = coverageMaps.find( symbolName ); + if ( cmi == coverageMaps.end() ) + throw rld::error (symbolName, "ExecutableInfo::findCoverageMap"); + return *(cmi->second); + } + + void ExecutableInfo::createCoverageMap ( const std::string& fileName, const std::string& symbolName, uint32_t lowAddress, @@ -113,7 +140,6 @@ namespace Coverage { theMap = itr->second; theMap->Add( lowAddress, highAddress ); } - return theMap; } void ExecutableInfo::getSourceAndLine( @@ -135,10 +161,9 @@ namespace Coverage { } void ExecutableInfo::mergeCoverage( void ) { - ExecutableInfo::CoverageMaps::iterator itr; - - for (itr = coverageMaps.begin(); itr != coverageMaps.end(); itr++) { - SymbolsToAnalyze->mergeCoverageMap( (*itr).first, (*itr).second ); + for (auto& cm : coverageMaps) { + if (SymbolsToAnalyze->isDesired( cm.first )) + SymbolsToAnalyze->mergeCoverageMap( cm.first, cm.second ); } } |