change log for gcc-testing (2010-05-18)

rtems-vc at rtems.org rtems-vc at rtems.org
Tue May 18 15:10:03 UTC 2010


 *humph*:
2010-05-18	Glenn Humphrey

	* DesiredSymbols.cc, DesiredSymbols.h, ExecutableInfo.cc,
	ExecutableInfo.h, ObjdumpProcessor.cc, ObjdumpProcessor.h,
	TraceConverter.cc, covoar.cc: Added support for analysis of a dynamic
	library. The library load address is currently hard-coded and needs
	to be read from a file.

M  1.260  rtems-coverage/ChangeLog
M    1.7  rtems-coverage/DesiredSymbols.h
M   1.13  rtems-coverage/DesiredSymbols.cc
M    1.3  rtems-coverage/ExecutableInfo.h
M    1.4  rtems-coverage/ExecutableInfo.cc
M   1.11  rtems-coverage/ObjdumpProcessor.h
M   1.35  rtems-coverage/ObjdumpProcessor.cc
M    1.8  rtems-coverage/TraceConverter.cc
M   1.27  rtems-coverage/covoar.cc

diff -u gcc-testing/rtems-coverage/ChangeLog:1.259 gcc-testing/rtems-coverage/ChangeLog:1.260
--- gcc-testing/rtems-coverage/ChangeLog:1.259	Tue May 18 09:02:12 2010
+++ gcc-testing/rtems-coverage/ChangeLog	Tue May 18 09:21:13 2010
@@ -1,3 +1,11 @@
+2010-05-18	Glenn Humphrey
+
+	* DesiredSymbols.cc, DesiredSymbols.h, ExecutableInfo.cc,
+	ExecutableInfo.h, ObjdumpProcessor.cc, ObjdumpProcessor.h,
+	TraceConverter.cc, covoar.cc: Added support for analysis of a dynamic
+	library. The library load address is currently hard-coded and needs
+	to be read from a file.
+
 2010-05-18	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	* app_common.cc: Style.

diff -u gcc-testing/rtems-coverage/DesiredSymbols.h:1.6 gcc-testing/rtems-coverage/DesiredSymbols.h:1.7
--- gcc-testing/rtems-coverage/DesiredSymbols.h:1.6	Fri May 14 12:26:35 2010
+++ gcc-testing/rtems-coverage/DesiredSymbols.h	Tue May 18 09:21:13 2010
@@ -18,6 +18,7 @@
 
 #include "CoverageMapBase.h"
 #include "CoverageRanges.h"
+#include "ExecutableInfo.h"
 #include "ObjdumpProcessor.h"
 
 namespace Coverage {
@@ -133,10 +134,10 @@
     std::list<ObjdumpProcessor::objdumpLine_t> instructions;
 
     /*!
-     *  This member contains the name of the file that was used to
+     *  This member contains the executable that was used to
      *  generate the disassembled instructions.
      */
-    std::string sourceFile;
+    ExecutableInfo* sourceFile;
 
     /*!
      *  This member contains the statistics kept on each symbol.
@@ -325,7 +326,7 @@
      */
     void determineSourceLines(
       CoverageRanges* const theRanges,
-      const std::string&    executableFileName
+      ExecutableInfo* const theExecutable
     );
 
   };

diff -u gcc-testing/rtems-coverage/DesiredSymbols.cc:1.12 gcc-testing/rtems-coverage/DesiredSymbols.cc:1.13
--- gcc-testing/rtems-coverage/DesiredSymbols.cc:1.12	Fri May 14 12:26:35 2010
+++ gcc-testing/rtems-coverage/DesiredSymbols.cc	Tue May 18 09:21:13 2010
@@ -375,13 +375,15 @@
 
   void DesiredSymbols::determineSourceLines(
     CoverageRanges* const theRanges,
-    const std::string&    executableFileName
+    ExecutableInfo* const theExecutable
+
   )
   {
     char*                              base;
     char                               buffer[512];
     char*                              cStatus;
     char                               command[512];
+    std::string                        fileName;
     CoverageRanges::ranges_t::iterator ritr;
     char                               rpath[PATH_MAX];
     FILE*                              tmpfile;
@@ -405,19 +407,24 @@
       fprintf(
         tmpfile,
         "0x%08x\n0x%08x\n",
-        ritr->lowAddress,
-        ritr->highAddress
+        ritr->lowAddress - theExecutable->getLoadAddress(),
+        ritr->highAddress - theExecutable->getLoadAddress()
       );
     }
 
     fclose( tmpfile );
 
     // Invoke addr2line to generate the source lines for each address.
+    if (theExecutable->hasDynamicLibrary())
+      fileName = theExecutable->getLibraryName();
+    else
+      fileName = theExecutable->getFileName();
+
     sprintf(
       command,
       "%s -e %s <%s | dos2unix >%s",
       TargetInfo->getAddr2line(),
-      executableFileName.c_str(),
+      fileName.c_str(),
       "ranges1.tmp",
       "ranges2.tmp"
     );

diff -u gcc-testing/rtems-coverage/ExecutableInfo.h:1.2 gcc-testing/rtems-coverage/ExecutableInfo.h:1.3
--- gcc-testing/rtems-coverage/ExecutableInfo.h:1.2	Fri May  7 13:53:58 2010
+++ gcc-testing/rtems-coverage/ExecutableInfo.h	Tue May 18 09:21:13 2010
@@ -32,9 +32,13 @@
     /*!
      *  This method constructs an ExecutableInfo instance.
      *
-     *  @param[in] executableName specifies the filename of the executable
+     *  @param[in] theExecutableName specifies the name of the executable
+     *  @param[in] theLibraryName specifies the name of the executable
      */
-    ExecutableInfo( const char* const executableName );
+    ExecutableInfo(
+      const char* const theExecutableName,
+      const char* const theLibraryName = NULL
+    );
 
     /*!
      *  This method destructs an ExecutableInfo instance.
@@ -65,16 +69,25 @@
     std::string getFileName( void ) const;
 
     /*!
-     *  This method returns a pointer to the executable's symbol table.
+     *  This method returns the library name associated with the executable.
      *
-     *  @return Returns a pointer to the symbol table.
+     *  @return Returns the executable's library name
      */
-    SymbolTable* getSymbolTable( void ) const;
+    std::string getLibraryName( void ) const;
 
     /*!
-     *  This method initializes the ExecutableInfo instance.
+     *  This method returns the load address of the dynamic library
+     *
+     *  @return Returns the load address of the dynamic library
      */
-    void initialize( void );
+    uint32_t getLoadAddress( void ) const;
+
+    /*!
+     *  This method returns a pointer to the executable's symbol table.
+     *
+     *  @return Returns a pointer to the symbol table.
+     */
+    SymbolTable* getSymbolTable( void ) const;
 
     /*!
      *  This method creates a coverage map for the specified symbol.
@@ -92,11 +105,27 @@
     );
 
     /*!
+     *  This method indicates whether a dynamic library has been
+     *  associated with the executable.
+     *
+     *  @return Returns TRUE if 
+     */
+    bool hasDynamicLibrary( void );
+
+    /*!
      *  This method merges the coverage maps for this executable into
      *  the unified coverage map.
      */
     void mergeCoverage( void );
 
+    /*!
+     *  This method sets the load address of the dynamic library
+     *
+     *  @param[in] address specifies the load address of the dynamic
+     *             library
+     */
+    void setLoadAddress( uint32_t address );
+
   private:
 
     /*!
@@ -106,13 +135,25 @@
     coverageMaps_t coverageMaps;
 
     /*!
-     *  This member variable contains the filename of the executable.
+     *  This member variable contains the name of the executable.
+     */
+    std::string executableName;
+
+    /*!
+     *  This member variable contains the name of a dynamic library
+     *  associated with the executable.
+     */
+    std::string libraryName;
+
+    /*!
+     *  This member variable contains the load address of a dynamic library
+     *  if one has been specified for the executable.
      */
-    std::string fileName;
+    uint32_t loadAddress;
 
     /*!
      *  This member variable contains a pointer to the symbol table
-     *  of the executable.
+     *  of the executable or library.
      */
     SymbolTable* theSymbolTable;
 

diff -u gcc-testing/rtems-coverage/ExecutableInfo.cc:1.3 gcc-testing/rtems-coverage/ExecutableInfo.cc:1.4
--- gcc-testing/rtems-coverage/ExecutableInfo.cc:1.3	Fri May  7 13:53:58 2010
+++ gcc-testing/rtems-coverage/ExecutableInfo.cc	Tue May 18 09:21:13 2010
@@ -19,10 +19,17 @@
 
 namespace Coverage {
 
-  ExecutableInfo::ExecutableInfo( const char* const executableName )
+  ExecutableInfo::ExecutableInfo(
+    const char* const theExecutableName,
+    const char* const theLibraryName
+  )
   {
-    fileName = executableName;
-    theSymbolTable = NULL;
+    executableName = theExecutableName;
+    loadAddress = 0;
+    libraryName = "";
+    if (theLibraryName)
+      libraryName = theLibraryName;
+    theSymbolTable = new SymbolTable();
   }
 
   ExecutableInfo::~ExecutableInfo()
@@ -58,18 +65,23 @@
 
   std::string ExecutableInfo::getFileName ( void ) const
   {
-    return fileName;
+    return executableName;
   }
 
-  SymbolTable* ExecutableInfo::getSymbolTable ( void ) const
+  std::string ExecutableInfo::getLibraryName( void ) const
   {
-    return theSymbolTable;
+    return libraryName;
   }
 
-  void ExecutableInfo::initialize( void )
+  uint32_t ExecutableInfo::getLoadAddress( void ) const
   {
-    // Create the symbol table.
-    theSymbolTable = new SymbolTable();
+    return loadAddress;
+  }
+
+
+  SymbolTable* ExecutableInfo::getSymbolTable ( void ) const
+  {
+    return theSymbolTable;
   }
 
   CoverageMapBase* ExecutableInfo::createCoverageMap (
@@ -94,6 +106,11 @@
     return theMap;
   }
 
+  bool ExecutableInfo::hasDynamicLibrary( void )
+  {
+     return (libraryName != "");
+  }
+
   void ExecutableInfo::mergeCoverage( void ) {
     ExecutableInfo::coverageMaps_t::iterator  itr;
 
@@ -102,4 +119,9 @@
     }
   }
 
+  void ExecutableInfo::setLoadAddress( uint32_t address )
+  {
+    loadAddress = address;
+  }
+
 }

diff -u gcc-testing/rtems-coverage/ObjdumpProcessor.h:1.10 gcc-testing/rtems-coverage/ObjdumpProcessor.h:1.11
--- gcc-testing/rtems-coverage/ObjdumpProcessor.h:1.10	Tue May 11 15:09:19 2010
+++ gcc-testing/rtems-coverage/ObjdumpProcessor.h	Tue May 18 09:21:13 2010
@@ -86,20 +86,22 @@
      */
     virtual ~ObjdumpProcessor();
 
+    uint32_t determineLoadAddress(
+      ExecutableInfo* theExecutable
+    );
+
     /*!
      *  This method returns a file pointer to the objdump file
-     *  for the given executable file name.  
+     *  for the given file name.  
      */
-    FILE* getFile( 
-      std::string exeFileName 
-    ); 
+    FILE* getFile( std::string fileName ); 
 
     /*!
      *  This method fills the objdumpList list with all the 
      *  instruction addresses in the object dump file.
      */
     void loadAddressTable (
-      std::string executableFileName
+      ExecutableInfo* const executableInformation
     );
 
     /*!

diff -u gcc-testing/rtems-coverage/ObjdumpProcessor.cc:1.34 gcc-testing/rtems-coverage/ObjdumpProcessor.cc:1.35
--- gcc-testing/rtems-coverage/ObjdumpProcessor.cc:1.34	Wed May 12 13:02:21 2010
+++ gcc-testing/rtems-coverage/ObjdumpProcessor.cc	Tue May 18 09:21:13 2010
@@ -84,7 +84,7 @@
     // If there are NOT already saved instructions, save them.
     symbolInfo = SymbolsToAnalyze->find( symbolName );
     if (symbolInfo->instructions.empty()) {
-      symbolInfo->sourceFile = executableInfo->getFileName();
+      symbolInfo->sourceFile = executableInfo;
       symbolInfo->baseAddress = lowAddress;
       symbolInfo->instructions = instructions;
     }
@@ -125,12 +125,146 @@
   {
   }
 
+  uint32_t ObjdumpProcessor::determineLoadAddress(
+    ExecutableInfo* theExecutable
+  )
+  {
+#if 0
+    char         buffer[ 512 ];
+    char*        cStatus;
+    static FILE* gdbCommands = NULL;
+    int          items;
+    uint32_t     loadAddress;
+    FILE*        loadAddressFile = NULL;
+    FILE*        objdumpFile = NULL;
+    uint32_t     offset;
+    int          status;
+    char         terminator;
+
+    // This method should only be call for a dynamic library.
+    if (!theExecutable->hasDynamicLibrary())
+      return 0;
+
+    //
+    // Invoke gdb to determine the physical load address
+    // of the .text section.
+    //
+
+    // Create a gdb input commands file.
+    if (!gdbCommands) {
+
+      gdbCommands = fopen( "gdbCommands", "w" );
+      if (!gdbCommands) {
+        fprintf(
+          stderr,
+          "ERROR: ObjdumpProcessor::determineLoadAddress - "
+          "unable to create gdbCommands\n"
+        );
+        exit( -1 );
+      }
+
+      fprintf(
+        gdbCommands,
+        "set pagination off\n"
+        "b main\n"
+        "r\n"
+        "info sharedlibrary\n"
+        "quit\n"
+      );
+
+      fclose( gdbCommands );
+    }
+
+    // Invoke gdb.
+    sprintf(
+      buffer,
+      "gdb -x gdbCommands %s | grep %s | cut -d ' ' -f1 > %s",
+      (theExecutable->getFileName()).c_str(),
+      (theExecutable->getLibraryName()).c_str(),
+      "library_addr.tmp"
+    );
+
+    status = system( buffer );
+    if (status) {
+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::determineLoadAddress - "
+        "command (%s) failed with %d\n",
+        buffer,
+        status
+      );
+      exit( -1 );
+    }
+
+    // Read load address.
+    loadAddressFile = fopen( "library_addr.tmp", "r" );
+    if (!loadAddressFile) {
+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::determineLoadAddress - "
+        "unable to open library_addr.tmp\n"
+      );
+      exit( -1 );
+    }
+
+    cStatus = fgets( buffer, 512, loadAddressFile );
+    items = sscanf(
+      buffer, "%x", &loadAddress
+    );
+
+    fclose( loadAddressFile );
+    unlink( "library_addr.tmp" );
+
+    //
+    // Partially process an objdump of the library to determine the first
+    // symbol's offset from the physical load address of the library.
+    //
+
+    // Obtain the objdump file.
+    objdumpFile = getFile( theExecutable->getLibraryName() );
+
+    // Process the objdump file.
+    while ( 1 ) {
+
+      // Get a line.
+      cStatus = fgets( buffer, 512, objdumpFile );
+      if (cStatus == NULL) {
+        fprintf(
+          stderr,
+          "ERROR: ObjdumpProcessor::determineLoadAddress - "
+          "no symbol found in objdump file\n"
+        );
+        exit( -1 );
+      }
+
+      // Look for the start of a symbol's objdump and extract
+      // address and symbol (i.e. address <symbolname>:).
+      items = sscanf(
+        buffer,
+        "%x <%*[^>]>%c",
+        &offset, &terminator
+      );
+
+      // If all items found, we have found the first symbol's objdump.
+      if ((items == 2) && (terminator == ':')) {
+        break;
+      }
+    }
+
+    return (loadAddress - offset);
+# endif
+    return 0x42084000;
+  }
+
   bool ObjdumpProcessor::IsBranch(
     const char *instruction 
   )
   { 
     if ( !TargetInfo ) {
-      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::IsBranch - unknown architecture\n"
+      );
       assert(0);
       return false;
     }
@@ -143,7 +277,10 @@
   )
   {
     if ( !TargetInfo ) {
-      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::isBranchLine - unknown architecture\n"
+      );
       assert(0);
       return false;
     }
@@ -156,10 +293,11 @@
     int&              size
   )
   {
-
     if ( !TargetInfo ){
-      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
-      fprintf( stderr, "HOW LARGE IS NOP ON THIS ARCHITECTURE? -- fix me\n" );
+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::isNop - unknown architecture\n"
+      );
       assert(0);
       return false;
     }
@@ -167,24 +305,22 @@
     return TargetInfo->isNopLine( line, size );
   }
 
-  FILE* ObjdumpProcessor::getFile( 
-    std::string exeFileName 
-  ) 
+  FILE* ObjdumpProcessor::getFile( std::string fileName ) 
   {
     char               dumpFile[128];
     FILE*              objdumpFile;
     char               buffer[ 512 ];
     int                status;
 
-    sprintf(dumpFile,"%s.dmp", exeFileName.c_str() );
+    sprintf( dumpFile, "%s.dmp", fileName.c_str() );
       
     // Generate the objdump.
-    if ( FileIsNewer( exeFileName.c_str(), dumpFile )) {
+    if (FileIsNewer( fileName.c_str(), dumpFile )) {
       sprintf(
         buffer,
         "%s -da --section=.text --source %s | sed -e \'s/ *$//\' >%s",
         TargetInfo->getObjdump(),
-         exeFileName.c_str(),
+        fileName.c_str(),
         dumpFile
       );
 
@@ -232,16 +368,22 @@
 
   }
 
-  void ObjdumpProcessor::loadAddressTable (std::string executableFileName )
+  void ObjdumpProcessor::loadAddressTable (
+    ExecutableInfo* const executableInformation
+  )
   {
     char               buffer[ 512 ];
     char*              cStatus;
-    uint32_t           instructionAddress;
     int                items;
     FILE*              objdumpFile;
+    uint32_t           offset;
     char               terminator;
 
-    objdumpFile = getFile( executableFileName );
+    // Obtain the objdump file.
+    if (!executableInformation->hasDynamicLibrary())
+      objdumpFile = getFile( executableInformation->getFileName() );
+    else
+      objdumpFile = getFile( executableInformation->getLibraryName() );
 
     // Process all lines from the objdump file.
     while ( 1 ) {
@@ -257,12 +399,14 @@
       items = sscanf(
         buffer,
         "%x%c",
-        &instructionAddress, &terminator
+        &offset, &terminator
       );
 
       // If it looks like an instruction ...
       if ((items == 2) && (terminator == ':')){
-        objdumpList.push_back(instructionAddress);
+        objdumpList.push_back(
+          executableInformation->getLoadAddress() + offset
+        );
       }
     }
   }
@@ -271,23 +415,27 @@
     ExecutableInfo* const executableInformation
   )
   {
-    uint32_t           address;
-    uint32_t           baseAddress = 0;
     char               buffer[ 512 ];
     char*              cStatus;
     std::string        currentSymbol = "";
-    uint32_t           instructionAddress;
+    uint32_t           endAddress;
+    uint32_t           instructionOffset;
     int                items;
     objdumpLine_t      lineInfo;
     FILE*              objdumpFile;
+    uint32_t           offset;
     bool               processSymbol = false;
+    uint32_t           startAddress = 0;
     char               symbol[ 100 ];
     char               terminator1;
     char               terminator2;
     objdumpLines_t     theInstructions;
 
     // Obtain the objdump file.
-    objdumpFile = getFile( executableInformation->getFileName() );
+    if (!executableInformation->hasDynamicLibrary())
+      objdumpFile = getFile( executableInformation->getFileName() );
+    else
+      objdumpFile = getFile( executableInformation->getLibraryName() );
 
     // Process all lines from the objdump file.
     while ( 1 ) {
@@ -301,8 +449,8 @@
           finalizeSymbol(
             executableInformation,
             currentSymbol,
-            baseAddress,
-            address,  // XXX fix to determine correct end address
+            startAddress,
+            executableInformation->getLoadAddress() + offset,
             theInstructions
           );
           fprintf(
@@ -310,7 +458,7 @@
             "WARNING: ObjdumpProcessor::load - analysis of symbol %s \n"
             "         may be incorrect.  It was the last symbol in %s\n"
             "         and the length of its last instruction is assumed "
-		"to be one.\n",
+            "         to be one.\n",
             currentSymbol.c_str(),
             executableInformation->getFileName().c_str()
           );
@@ -328,36 +476,38 @@
       lineInfo.isBranch      = false;
 
       // Look for the start of a symbol's objdump and extract
-      // address and symbol (i.e. address <symbolname>:).
+      // offset and symbol (i.e. offset <symbolname>:).
       items = sscanf(
         buffer,
         "%x <%[^>]>%c",
-        &address, symbol, &terminator1
+        &offset, symbol, &terminator1
       );
 
       // If all items found, we are at the beginning of a symbol's objdump.
       if ((items == 3) && (terminator1 == ':')) {
 
+        endAddress = executableInformation->getLoadAddress() + offset - 1;
+
         // If we are currently processing a symbol, finalize it.
         if (processSymbol) {
           finalizeSymbol(
             executableInformation,
             currentSymbol,
-            baseAddress,
-            address - 1,
+            startAddress,
+            endAddress,
             theInstructions
           );
         }
 
         // Start processing of a new symbol.
-        baseAddress = 0;
+        startAddress = 0;
         currentSymbol = "";
         processSymbol = false;
         theInstructions.clear();
 
         // See if the new symbol is one that we care about.
         if (SymbolsToAnalyze->isDesired( symbol )) {
-          baseAddress = address;
+          startAddress = executableInformation->getLoadAddress() + offset;
           currentSymbol = symbol;
           processSymbol = true;
           theInstructions.push_back( lineInfo );
@@ -370,14 +520,15 @@
         items = sscanf(
           buffer,
           "%x%c\t%*[^\t]%c",
-          &instructionAddress, &terminator1, &terminator2
+          &instructionOffset, &terminator1, &terminator2
         );
 
         // If it looks like an instruction ...
         if ((items == 3) && (terminator1 == ':') && (terminator2 == '\t')) {
 
           // update the line's information, save it and ...
-          lineInfo.address       = instructionAddress;
+          lineInfo.address =
+           executableInformation->getLoadAddress() + instructionOffset;
           lineInfo.isInstruction = true;
           lineInfo.isNop         = isNop( buffer, lineInfo.nopSize );
           lineInfo.isBranch      = isBranchLine( buffer );

diff -u gcc-testing/rtems-coverage/TraceConverter.cc:1.7 gcc-testing/rtems-coverage/TraceConverter.cc:1.8
--- gcc-testing/rtems-coverage/TraceConverter.cc:1.7	Tue May 11 15:18:32 2010
+++ gcc-testing/rtems-coverage/TraceConverter.cc	Tue May 18 09:21:13 2010
@@ -23,7 +23,9 @@
 #include "app_common.h"
 #include "TargetFactory.h"
 
-char *progname;
+//const char* dynamicLibrary = "libfuncs.so";
+const char* dynamicLibrary = NULL;
+char*       progname;
 
 void usage()
 {
@@ -47,6 +49,7 @@
   const char                  *executable = "";
   const char                  *tracefile  =  "";
   const char                  *logname = "/tmp/qemu.log";
+  Coverage::ExecutableInfo*    executableInfo;
    
   //
   // Process command line options.
@@ -83,9 +86,22 @@
   // Create toolnames.
   TargetInfo = Target::TargetFactory( cpuname );
 
+  if (dynamicLibrary)
+    executableInfo = new Coverage::ExecutableInfo(
+      executable, dynamicLibrary
+    );
+  else
+    executableInfo = new Coverage::ExecutableInfo( executable );
+
   objdumpProcessor = new Coverage::ObjdumpProcessor();
  
-  objdumpProcessor->loadAddressTable( executable );
+  // If a dynamic library was specified, determine the load address.
+  if (dynamicLibrary)
+    executableInfo->setLoadAddress(
+      objdumpProcessor->determineLoadAddress( executableInfo )
+    );
+
+  objdumpProcessor->loadAddressTable( executableInfo );
 
   log.processFile( logname );
 

diff -u gcc-testing/rtems-coverage/covoar.cc:1.26 gcc-testing/rtems-coverage/covoar.cc:1.27
--- gcc-testing/rtems-coverage/covoar.cc:1.26	Mon May 17 16:47:07 2010
+++ gcc-testing/rtems-coverage/covoar.cc	Tue May 18 09:21:13 2010
@@ -34,6 +34,7 @@
 int                                  coverageExtensionLength = 0;
 Coverage::CoverageFormats_t          coverageFormat;
 Coverage::CoverageReaderBase*        coverageReader = NULL;
+const char*                          dynamicLibrary = NULL;
 char*                                executable = NULL;
 char*                                executableExtension = NULL;
 int                                  executableExtensionLength = 0;
@@ -153,10 +154,11 @@
   //
   progname = argv[0];
 
-  while ((opt = getopt(argc, argv, "C:1:e:c:E:f:s:T:O:v")) != -1) {
+  while ((opt = getopt(argc, argv, "C:1:L:e:c:E:f:s:T:O:v")) != -1) {
     switch (opt) {
       case 'C': CoverageConfiguration->processFile( optarg ); break;
       case '1': singleExecutable      = optarg; break;
+      case 'L': dynamicLibrary        = optarg; break;
       case 'e': executableExtension   = optarg; break;
       case 'c': coverageFileExtension = optarg; break;
       case 'E': explanations          = optarg; break;
@@ -209,7 +211,13 @@
       // If there was at least one coverage file, create the
       // executable information.
       if (!coverageFileNames.empty()) {
-        executableInfo = new Coverage::ExecutableInfo( singleExecutable );
+        if (dynamicLibrary)
+          executableInfo = new Coverage::ExecutableInfo(
+            singleExecutable, dynamicLibrary
+          );
+        else
+          executableInfo = new Coverage::ExecutableInfo( singleExecutable );
+
         executablesToAnalyze.push_back( executableInfo );
       }
     }
@@ -351,7 +359,7 @@
   // Create the objdump processor.
   objdumpProcessor = new Coverage::ObjdumpProcessor();
 
-  // Process each executable to analyze.
+  // Prepare each executable for analysis.
   for (eitr = executablesToAnalyze.begin();
        eitr != executablesToAnalyze.end();
        eitr++) {
@@ -363,8 +371,11 @@
         ((*eitr)->getFileName()).c_str()
       );
 
-    // Create the executable information.
-    (*eitr)->initialize();
+    // If a dynamic library was specified, determine the load address.
+    if (dynamicLibrary)
+      (*eitr)->setLoadAddress(
+        objdumpProcessor->determineLoadAddress( *eitr )
+      );
 
     // Load the objdump for the symbols in this executable.
     objdumpProcessor->load( *eitr );


 *humph*:
2010-05-18	Glenn Humphrey

	* TraceConverter.cc: Removed initialization of the dynamicLibrary
	variable.

M  1.262  rtems-coverage/ChangeLog
M   1.10  rtems-coverage/TraceConverter.cc

diff -u gcc-testing/rtems-coverage/ChangeLog:1.261 gcc-testing/rtems-coverage/ChangeLog:1.262
--- gcc-testing/rtems-coverage/ChangeLog:1.261	Tue May 18 09:31:45 2010
+++ gcc-testing/rtems-coverage/ChangeLog	Tue May 18 09:44:01 2010
@@ -1,3 +1,8 @@
+2010-05-18	Glenn Humphrey
+
+	* TraceConverter.cc: Removed initialization of the dynamicLibrary
+	variable.
+
 2010-05-18	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	* TraceConverter.cc: Add -L option.

diff -u gcc-testing/rtems-coverage/TraceConverter.cc:1.9 gcc-testing/rtems-coverage/TraceConverter.cc:1.10
--- gcc-testing/rtems-coverage/TraceConverter.cc:1.9	Tue May 18 09:31:45 2010
+++ gcc-testing/rtems-coverage/TraceConverter.cc	Tue May 18 09:44:01 2010
@@ -23,7 +23,6 @@
 #include "app_common.h"
 #include "TargetFactory.h"
 
-//const char* dynamicLibrary = "libfuncs.so";
 const char* dynamicLibrary = NULL;
 char*       progname;
 


 *joel*:
2010-05-18	Joel Sherrill <joel.sherrilL at OARcorp.com>

	* TraceConverter.cc: Add -L option.

M  1.261  rtems-coverage/ChangeLog
M    1.9  rtems-coverage/TraceConverter.cc

diff -u gcc-testing/rtems-coverage/ChangeLog:1.260 gcc-testing/rtems-coverage/ChangeLog:1.261
--- gcc-testing/rtems-coverage/ChangeLog:1.260	Tue May 18 09:21:13 2010
+++ gcc-testing/rtems-coverage/ChangeLog	Tue May 18 09:31:45 2010
@@ -1,3 +1,7 @@
+2010-05-18	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	* TraceConverter.cc: Add -L option.
+
 2010-05-18	Glenn Humphrey
 
 	* DesiredSymbols.cc, DesiredSymbols.h, ExecutableInfo.cc,

diff -u gcc-testing/rtems-coverage/TraceConverter.cc:1.8 gcc-testing/rtems-coverage/TraceConverter.cc:1.9
--- gcc-testing/rtems-coverage/TraceConverter.cc:1.8	Tue May 18 09:21:13 2010
+++ gcc-testing/rtems-coverage/TraceConverter.cc	Tue May 18 09:31:45 2010
@@ -56,13 +56,14 @@
   //
   progname = argv[0];
 
-  while ((opt = getopt(argc, argv, "c:e:l:t:v")) != -1) {
+  while ((opt = getopt(argc, argv, "c:e:l:L:t:v")) != -1) {
     switch (opt) {
-      case 'c': cpuname = optarg;    break;
-      case 'e': executable = optarg; break;
-      case 'l': logname = optarg;    break;
-      case 't': tracefile = optarg;  break;
-      case 'v': Verbose = true;      break;
+      case 'c': cpuname = optarg;        break;
+      case 'e': executable = optarg;     break;
+      case 'l': logname = optarg;        break;
+      case 'L': dynamicLibrary = optarg; break;
+      case 't': tracefile = optarg;      break;
+      case 'v': Verbose = true;          break;
       default:  usage();
     }
   }
@@ -87,9 +88,7 @@
   TargetInfo = Target::TargetFactory( cpuname );
 
   if (dynamicLibrary)
-    executableInfo = new Coverage::ExecutableInfo(
-      executable, dynamicLibrary
-    );
+    executableInfo = new Coverage::ExecutableInfo( executable, dynamicLibrary );
   else
     executableInfo = new Coverage::ExecutableInfo( executable );
 



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100518/247b6b61/attachment.html>


More information about the vc mailing list