From 366807c4a99f6f2af5115e08a70713734fdf61f3 Mon Sep 17 00:00:00 2001 From: Ryan Long Date: Fri, 22 Oct 2021 15:10:26 -0400 Subject: SymbolTable.cc: Fix formatting --- tester/covoar/SymbolTable.cc | 70 ++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 32 deletions(-) (limited to 'tester/covoar') diff --git a/tester/covoar/SymbolTable.cc b/tester/covoar/SymbolTable.cc index cfbd7a3..a33a348 100644 --- a/tester/covoar/SymbolTable.cc +++ b/tester/covoar/SymbolTable.cc @@ -30,9 +30,9 @@ namespace Coverage { const uint32_t length ) { - uint32_t end = 0; - symbol_entry_t entry; - symbolInfo_t symbolData; + uint32_t end = 0; + symbol_entry_t entry; + symbolInfo_t symbolData; // Add an entry to the address map. end = start + length - 1; @@ -45,14 +45,14 @@ namespace Coverage { symbolData.startingAddress = start; symbolData.length = length; - for (auto& symData : info[ symbol ]) { + for ( auto& symData : info[ symbol ] ) { // The starting address could differ since we strip any suffixes beginning // with a '.' - if (symData.startingAddress != start) { + if ( symData.startingAddress != start ) { continue; } - if (symData.length != length) { + if ( symData.length != length ) { std::ostringstream what; what << "Different lengths for the symbol " << symbol @@ -66,39 +66,36 @@ namespace Coverage { info[ symbol ].push_back( symbolData ); } - SymbolTable::symbolInfo* SymbolTable::getInfo( - const std::string& symbol - ) + SymbolTable::symbolInfo* SymbolTable::getInfo( const std::string& symbol ) { info_t::iterator it = info.find( symbol ); - if (it == info.end()) + if ( it == info.end() ) { return NULL; - else - return (&(it->second)); + } else { + return ( &(it->second) ); + } } - uint32_t SymbolTable::getLength( - const std::string& symbol - ) + uint32_t SymbolTable::getLength( const std::string& symbol ) { info_t::iterator it = info.find( symbol ); - if (it == info.end()) + if ( it == info.end() ) { return 0; - else - return ((*it).second.front().length); + } else { + return ( (*it).second.front().length ); + } } - std::string SymbolTable::getSymbol( - uint32_t address - ) + std::string SymbolTable::getSymbol( uint32_t address ) { contents_t::iterator it; // Ensure that the symbol table is not empty. - if ( contents.size() == 0 ) + if ( contents.size() == 0 ) { return ""; + } // Find the first entry whose end address is greater // than the specified address. @@ -106,23 +103,32 @@ namespace Coverage { // If an entry was found and its low address is less than or // equal to the specified address, then return the symbol. - if ((it != contents.end()) && ((it->second).low <= address )) + if ( ( it != contents.end() ) && ( ( it->second ).low <= address ) ) { return (it->second).symbol; + } return ""; } void SymbolTable::dumpSymbolTable( void ) { - symbolInfo symbolTable; - symbolInfoIterator_t symbolIterator; - infoIterator_t infoIterator; - - for (infoIterator = info.begin() ; infoIterator != info.end(); infoIterator++) - { - for (symbolIterator = infoIterator->second.begin() ; symbolIterator != infoIterator->second.end(); symbolIterator++) - { - fprintf( stdout, "%s:\tStarting address = %#x\tLength = %u\n", infoIterator->first.c_str(), symbolIterator->startingAddress, symbolIterator->length ); + symbolInfo symbolTable; + symbolInfoIterator_t symbolIterator; + infoIterator_t infoIterator; + + for ( + infoIterator = info.begin(); + infoIterator != info.end(); + infoIterator++ + ) { + for ( + symbolIterator = infoIterator->second.begin(); + symbolIterator != infoIterator->second.end(); + symbolIterator++ + ) { + std::cerr << infoIterator->first << ":\tStarting address = 0x" + << std::hex << symbolIterator->startingAddress << std::dec + << "\tLength = " << symbolIterator->length << std::endl; } } } -- cgit v1.2.3