<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for gcc-testing (2010-05-18)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>humph</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>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.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ChangeLog.diff?r1=text&tr1=1.259&r2=text&tr2=1.260&diff_format=h">M</a></td><td width='1%'>1.260</td><td width='100%'>rtems-coverage/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/DesiredSymbols.h.diff?r1=text&tr1=1.6&r2=text&tr2=1.7&diff_format=h">M</a></td><td width='1%'>1.7</td><td width='100%'>rtems-coverage/DesiredSymbols.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/DesiredSymbols.cc.diff?r1=text&tr1=1.12&r2=text&tr2=1.13&diff_format=h">M</a></td><td width='1%'>1.13</td><td width='100%'>rtems-coverage/DesiredSymbols.cc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ExecutableInfo.h.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>rtems-coverage/ExecutableInfo.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ExecutableInfo.cc.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>rtems-coverage/ExecutableInfo.cc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ObjdumpProcessor.h.diff?r1=text&tr1=1.10&r2=text&tr2=1.11&diff_format=h">M</a></td><td width='1%'>1.11</td><td width='100%'>rtems-coverage/ObjdumpProcessor.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ObjdumpProcessor.cc.diff?r1=text&tr1=1.34&r2=text&tr2=1.35&diff_format=h">M</a></td><td width='1%'>1.35</td><td width='100%'>rtems-coverage/ObjdumpProcessor.cc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/TraceConverter.cc.diff?r1=text&tr1=1.7&r2=text&tr2=1.8&diff_format=h">M</a></td><td width='1%'>1.8</td><td width='100%'>rtems-coverage/TraceConverter.cc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/covoar.cc.diff?r1=text&tr1=1.26&r2=text&tr2=1.27&diff_format=h">M</a></td><td width='1%'>1.27</td><td width='100%'>rtems-coverage/covoar.cc</td></tr>
</table>
<pre>
<font color='#006600'>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
</font><font color='#997700'>@@ -1,3 +1,11 @@
</font><font color='#000088'>+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.
+
</font> 2010-05-18        Joel Sherrill <joel.sherrilL@OARcorp.com>
 
        * app_common.cc: Style.

<font color='#006600'>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
</font><font color='#997700'>@@ -18,6 +18,7 @@
</font> 
 #include "CoverageMapBase.h"
 #include "CoverageRanges.h"
<font color='#000088'>+#include "ExecutableInfo.h"
</font> #include "ObjdumpProcessor.h"
 
 namespace Coverage {
<font color='#997700'>@@ -133,10 +134,10 @@
</font>     std::list<ObjdumpProcessor::objdumpLine_t> instructions;
 
     /*!
<font color='#880000'>-     *  This member contains the name of the file that was used to
</font><font color='#000088'>+     *  This member contains the executable that was used to
</font>      *  generate the disassembled instructions.
      */
<font color='#880000'>-    std::string sourceFile;
</font><font color='#000088'>+    ExecutableInfo* sourceFile;
</font> 
     /*!
      *  This member contains the statistics kept on each symbol.
<font color='#997700'>@@ -325,7 +326,7 @@
</font>      */
     void determineSourceLines(
       CoverageRanges* const theRanges,
<font color='#880000'>-      const std::string&    executableFileName
</font><font color='#000088'>+      ExecutableInfo* const theExecutable
</font>     );
 
   };

<font color='#006600'>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
</font><font color='#997700'>@@ -375,13 +375,15 @@
</font> 
   void DesiredSymbols::determineSourceLines(
     CoverageRanges* const theRanges,
<font color='#880000'>-    const std::string&    executableFileName
</font><font color='#000088'>+    ExecutableInfo* const theExecutable
+
</font>   )
   {
     char*                              base;
     char                               buffer[512];
     char*                              cStatus;
     char                               command[512];
<font color='#000088'>+    std::string                        fileName;
</font>     CoverageRanges::ranges_t::iterator ritr;
     char                               rpath[PATH_MAX];
     FILE*                              tmpfile;
<font color='#997700'>@@ -405,19 +407,24 @@
</font>       fprintf(
         tmpfile,
         "0x%08x\n0x%08x\n",
<font color='#880000'>-        ritr->lowAddress,
-        ritr->highAddress
</font><font color='#000088'>+        ritr->lowAddress - theExecutable->getLoadAddress(),
+        ritr->highAddress - theExecutable->getLoadAddress()
</font>       );
     }
 
     fclose( tmpfile );
 
     // Invoke addr2line to generate the source lines for each address.
<font color='#000088'>+    if (theExecutable->hasDynamicLibrary())
+      fileName = theExecutable->getLibraryName();
+    else
+      fileName = theExecutable->getFileName();
+
</font>     sprintf(
       command,
       "%s -e %s <%s | dos2unix >%s",
       TargetInfo->getAddr2line(),
<font color='#880000'>-      executableFileName.c_str(),
</font><font color='#000088'>+      fileName.c_str(),
</font>       "ranges1.tmp",
       "ranges2.tmp"
     );

<font color='#006600'>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
</font><font color='#997700'>@@ -32,9 +32,13 @@
</font>     /*!
      *  This method constructs an ExecutableInfo instance.
      *
<font color='#880000'>-     *  @param[in] executableName specifies the filename of the executable
</font><font color='#000088'>+     *  @param[in] theExecutableName specifies the name of the executable
+     *  @param[in] theLibraryName specifies the name of the executable
</font>      */
<font color='#880000'>-    ExecutableInfo( const char* const executableName );
</font><font color='#000088'>+    ExecutableInfo(
+      const char* const theExecutableName,
+      const char* const theLibraryName = NULL
+    );
</font> 
     /*!
      *  This method destructs an ExecutableInfo instance.
<font color='#997700'>@@ -65,16 +69,25 @@
</font>     std::string getFileName( void ) const;
 
     /*!
<font color='#880000'>-     *  This method returns a pointer to the executable's symbol table.
</font><font color='#000088'>+     *  This method returns the library name associated with the executable.
</font>      *
<font color='#880000'>-     *  @return Returns a pointer to the symbol table.
</font><font color='#000088'>+     *  @return Returns the executable's library name
</font>      */
<font color='#880000'>-    SymbolTable* getSymbolTable( void ) const;
</font><font color='#000088'>+    std::string getLibraryName( void ) const;
</font> 
     /*!
<font color='#880000'>-     *  This method initializes the ExecutableInfo instance.
</font><font color='#000088'>+     *  This method returns the load address of the dynamic library
+     *
+     *  @return Returns the load address of the dynamic library
</font>      */
<font color='#880000'>-    void initialize( void );
</font><font color='#000088'>+    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;
</font> 
     /*!
      *  This method creates a coverage map for the specified symbol.
<font color='#997700'>@@ -92,11 +105,27 @@
</font>     );
 
     /*!
<font color='#000088'>+     *  This method indicates whether a dynamic library has been
+     *  associated with the executable.
+     *
+     *  @return Returns TRUE if<span style="background-color: #FF0000"> </span>
+     */
+    bool hasDynamicLibrary( void );
+
+    /*!
</font>      *  This method merges the coverage maps for this executable into
      *  the unified coverage map.
      */
     void mergeCoverage( void );
 
<font color='#000088'>+    /*!
+     *  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 );
+
</font>   private:
 
     /*!
<font color='#997700'>@@ -106,13 +135,25 @@
</font>     coverageMaps_t coverageMaps;
 
     /*!
<font color='#880000'>-     *  This member variable contains the filename of the executable.
</font><font color='#000088'>+     *  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.
</font>      */
<font color='#880000'>-    std::string fileName;
</font><font color='#000088'>+    uint32_t loadAddress;
</font> 
     /*!
      *  This member variable contains a pointer to the symbol table
<font color='#880000'>-     *  of the executable.
</font><font color='#000088'>+     *  of the executable or library.
</font>      */
     SymbolTable* theSymbolTable;
 

<font color='#006600'>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
</font><font color='#997700'>@@ -19,10 +19,17 @@
</font> 
 namespace Coverage {
 
<font color='#880000'>-  ExecutableInfo::ExecutableInfo( const char* const executableName )
</font><font color='#000088'>+  ExecutableInfo::ExecutableInfo(
+    const char* const theExecutableName,
+    const char* const theLibraryName
+  )
</font>   {
<font color='#880000'>-    fileName = executableName;
-    theSymbolTable = NULL;
</font><font color='#000088'>+    executableName = theExecutableName;
+    loadAddress = 0;
+    libraryName = "";
+    if (theLibraryName)
+      libraryName = theLibraryName;
+    theSymbolTable = new SymbolTable();
</font>   }
 
   ExecutableInfo::~ExecutableInfo()
<font color='#997700'>@@ -58,18 +65,23 @@
</font> 
   std::string ExecutableInfo::getFileName ( void ) const
   {
<font color='#880000'>-    return fileName;
</font><font color='#000088'>+    return executableName;
</font>   }
 
<font color='#880000'>-  SymbolTable* ExecutableInfo::getSymbolTable ( void ) const
</font><font color='#000088'>+  std::string ExecutableInfo::getLibraryName( void ) const
</font>   {
<font color='#880000'>-    return theSymbolTable;
</font><font color='#000088'>+    return libraryName;
</font>   }
 
<font color='#880000'>-  void ExecutableInfo::initialize( void )
</font><font color='#000088'>+  uint32_t ExecutableInfo::getLoadAddress( void ) const
</font>   {
<font color='#880000'>-    // Create the symbol table.
-    theSymbolTable = new SymbolTable();
</font><font color='#000088'>+    return loadAddress;
+  }
+
+
+  SymbolTable* ExecutableInfo::getSymbolTable ( void ) const
+  {
+    return theSymbolTable;
</font>   }
 
   CoverageMapBase* ExecutableInfo::createCoverageMap (
<font color='#997700'>@@ -94,6 +106,11 @@
</font>     return theMap;
   }
 
<font color='#000088'>+  bool ExecutableInfo::hasDynamicLibrary( void )
+  {
+     return (libraryName != "");
+  }
+
</font>   void ExecutableInfo::mergeCoverage( void ) {
     ExecutableInfo::coverageMaps_t::iterator  itr;
 
<font color='#997700'>@@ -102,4 +119,9 @@
</font>     }
   }
 
<font color='#000088'>+  void ExecutableInfo::setLoadAddress( uint32_t address )
+  {
+    loadAddress = address;
+  }
+
</font> }

<font color='#006600'>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
</font><font color='#997700'>@@ -86,20 +86,22 @@
</font>      */
     virtual ~ObjdumpProcessor();
 
<font color='#000088'>+    uint32_t determineLoadAddress(
+      ExecutableInfo* theExecutable
+    );
+
</font>     /*!
      *  This method returns a file pointer to the objdump file
<font color='#880000'>-     *  for the given executable file name.<span style="background-color: #FF0000">  </span>
</font><font color='#000088'>+     *  for the given file name.<span style="background-color: #FF0000">  </span>
</font>      */
<font color='#880000'>-    FILE* getFile(<span style="background-color: #FF0000"> </span>
-      std::string exeFileName<span style="background-color: #FF0000"> </span>
-    );<span style="background-color: #FF0000"> </span>
</font><font color='#000088'>+    FILE* getFile( std::string fileName );<span style="background-color: #FF0000"> </span>
</font> 
     /*!
      *  This method fills the objdumpList list with all the<span style="background-color: #FF0000"> </span>
      *  instruction addresses in the object dump file.
      */
     void loadAddressTable (
<font color='#880000'>-      std::string executableFileName
</font><font color='#000088'>+      ExecutableInfo* const executableInformation
</font>     );
 
     /*!

<font color='#006600'>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
</font><font color='#997700'>@@ -84,7 +84,7 @@
</font>     // If there are NOT already saved instructions, save them.
     symbolInfo = SymbolsToAnalyze->find( symbolName );
     if (symbolInfo->instructions.empty()) {
<font color='#880000'>-      symbolInfo->sourceFile = executableInfo->getFileName();
</font><font color='#000088'>+      symbolInfo->sourceFile = executableInfo;
</font>       symbolInfo->baseAddress = lowAddress;
       symbolInfo->instructions = instructions;
     }
<font color='#997700'>@@ -125,12 +125,146 @@
</font>   {
   }
 
<font color='#000088'>+  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;
+  }
+
</font>   bool ObjdumpProcessor::IsBranch(
     const char *instruction<span style="background-color: #FF0000"> </span>
   )
   {<span style="background-color: #FF0000"> </span>
     if ( !TargetInfo ) {
<font color='#880000'>-      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
</font><font color='#000088'>+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::IsBranch - unknown architecture\n"
+      );
</font>       assert(0);
       return false;
     }
<font color='#997700'>@@ -143,7 +277,10 @@
</font>   )
   {
     if ( !TargetInfo ) {
<font color='#880000'>-      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
</font><font color='#000088'>+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::isBranchLine - unknown architecture\n"
+      );
</font>       assert(0);
       return false;
     }
<font color='#997700'>@@ -156,10 +293,11 @@
</font>     int&              size
   )
   {
<font color='#880000'>-
</font>     if ( !TargetInfo ){
<font color='#880000'>-      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
-      fprintf( stderr, "HOW LARGE IS NOP ON THIS ARCHITECTURE? -- fix me\n" );
</font><font color='#000088'>+      fprintf(
+        stderr,
+        "ERROR: ObjdumpProcessor::isNop - unknown architecture\n"
+      );
</font>       assert(0);
       return false;
     }
<font color='#997700'>@@ -167,24 +305,22 @@
</font>     return TargetInfo->isNopLine( line, size );
   }
 
<font color='#880000'>-  FILE* ObjdumpProcessor::getFile(<span style="background-color: #FF0000"> </span>
-    std::string exeFileName<span style="background-color: #FF0000"> </span>
-  )<span style="background-color: #FF0000"> </span>
</font><font color='#000088'>+  FILE* ObjdumpProcessor::getFile( std::string fileName )<span style="background-color: #FF0000"> </span>
</font>   {
     char               dumpFile[128];
     FILE*              objdumpFile;
     char               buffer[ 512 ];
     int                status;
 
<font color='#880000'>-    sprintf(dumpFile,"%s.dmp", exeFileName.c_str() );
</font><font color='#000088'>+    sprintf( dumpFile, "%s.dmp", fileName.c_str() );
</font>       
     // Generate the objdump.
<font color='#880000'>-    if ( FileIsNewer( exeFileName.c_str(), dumpFile )) {
</font><font color='#000088'>+    if (FileIsNewer( fileName.c_str(), dumpFile )) {
</font>       sprintf(
         buffer,
         "%s -da --section=.text --source %s | sed -e \'s/ *$//\' >%s",
         TargetInfo->getObjdump(),
<font color='#880000'>-         exeFileName.c_str(),
</font><font color='#000088'>+        fileName.c_str(),
</font>         dumpFile
       );
 
<font color='#997700'>@@ -232,16 +368,22 @@
</font> 
   }
 
<font color='#880000'>-  void ObjdumpProcessor::loadAddressTable (std::string executableFileName )
</font><font color='#000088'>+  void ObjdumpProcessor::loadAddressTable (
+    ExecutableInfo* const executableInformation
+  )
</font>   {
     char               buffer[ 512 ];
     char*              cStatus;
<font color='#880000'>-    uint32_t           instructionAddress;
</font>     int                items;
     FILE*              objdumpFile;
<font color='#000088'>+    uint32_t           offset;
</font>     char               terminator;
 
<font color='#880000'>-    objdumpFile = getFile( executableFileName );
</font><font color='#000088'>+    // Obtain the objdump file.
+    if (!executableInformation->hasDynamicLibrary())
+      objdumpFile = getFile( executableInformation->getFileName() );
+    else
+      objdumpFile = getFile( executableInformation->getLibraryName() );
</font> 
     // Process all lines from the objdump file.
     while ( 1 ) {
<font color='#997700'>@@ -257,12 +399,14 @@
</font>       items = sscanf(
         buffer,
         "%x%c",
<font color='#880000'>-        &instructionAddress, &terminator
</font><font color='#000088'>+        &offset, &terminator
</font>       );
 
       // If it looks like an instruction ...
       if ((items == 2) && (terminator == ':')){
<font color='#880000'>-        objdumpList.push_back(instructionAddress);
</font><font color='#000088'>+        objdumpList.push_back(
+          executableInformation->getLoadAddress() + offset
+        );
</font>       }
     }
   }
<font color='#997700'>@@ -271,23 +415,27 @@
</font>     ExecutableInfo* const executableInformation
   )
   {
<font color='#880000'>-    uint32_t           address;
-    uint32_t           baseAddress = 0;
</font>     char               buffer[ 512 ];
     char*              cStatus;
     std::string        currentSymbol = "";
<font color='#880000'>-    uint32_t           instructionAddress;
</font><font color='#000088'>+    uint32_t           endAddress;
+    uint32_t           instructionOffset;
</font>     int                items;
     objdumpLine_t      lineInfo;
     FILE*              objdumpFile;
<font color='#000088'>+    uint32_t           offset;
</font>     bool               processSymbol = false;
<font color='#000088'>+    uint32_t           startAddress = 0;
</font>     char               symbol[ 100 ];
     char               terminator1;
     char               terminator2;
     objdumpLines_t     theInstructions;
 
     // Obtain the objdump file.
<font color='#880000'>-    objdumpFile = getFile( executableInformation->getFileName() );
</font><font color='#000088'>+    if (!executableInformation->hasDynamicLibrary())
+      objdumpFile = getFile( executableInformation->getFileName() );
+    else
+      objdumpFile = getFile( executableInformation->getLibraryName() );
</font> 
     // Process all lines from the objdump file.
     while ( 1 ) {
<font color='#997700'>@@ -301,8 +449,8 @@
</font>           finalizeSymbol(
             executableInformation,
             currentSymbol,
<font color='#880000'>-            baseAddress,
-            address,  // XXX fix to determine correct end address
</font><font color='#000088'>+            startAddress,
+            executableInformation->getLoadAddress() + offset,
</font>             theInstructions
           );
           fprintf(
<font color='#997700'>@@ -310,7 +458,7 @@
</font>             "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 "
<font color='#880000'>-           "to be one.\n",
</font><font color='#000088'>+            "         to be one.\n",
</font>             currentSymbol.c_str(),
             executableInformation->getFileName().c_str()
           );
<font color='#997700'>@@ -328,36 +476,38 @@
</font>       lineInfo.isBranch      = false;
 
       // Look for the start of a symbol's objdump and extract
<font color='#880000'>-      // address and symbol (i.e. address <symbolname>:).
</font><font color='#000088'>+      // offset and symbol (i.e. offset <symbolname>:).
</font>       items = sscanf(
         buffer,
         "%x <%[^>]>%c",
<font color='#880000'>-        &address, symbol, &terminator1
</font><font color='#000088'>+        &offset, symbol, &terminator1
</font>       );
 
       // If all items found, we are at the beginning of a symbol's objdump.
       if ((items == 3) && (terminator1 == ':')) {
 
<font color='#000088'>+        endAddress = executableInformation->getLoadAddress() + offset - 1;
+
</font>         // If we are currently processing a symbol, finalize it.
         if (processSymbol) {
           finalizeSymbol(
             executableInformation,
             currentSymbol,
<font color='#880000'>-            baseAddress,
-            address - 1,
</font><font color='#000088'>+            startAddress,
+            endAddress,
</font>             theInstructions
           );
         }
 
         // Start processing of a new symbol.
<font color='#880000'>-        baseAddress = 0;
</font><font color='#000088'>+        startAddress = 0;
</font>         currentSymbol = "";
         processSymbol = false;
         theInstructions.clear();
 
         // See if the new symbol is one that we care about.
         if (SymbolsToAnalyze->isDesired( symbol )) {
<font color='#880000'>-          baseAddress = address;
</font><font color='#000088'>+          startAddress = executableInformation->getLoadAddress() + offset;
</font>           currentSymbol = symbol;
           processSymbol = true;
           theInstructions.push_back( lineInfo );
<font color='#997700'>@@ -370,14 +520,15 @@
</font>         items = sscanf(
           buffer,
           "%x%c\t%*[^\t]%c",
<font color='#880000'>-          &instructionAddress, &terminator1, &terminator2
</font><font color='#000088'>+          &instructionOffset, &terminator1, &terminator2
</font>         );
 
         // If it looks like an instruction ...
         if ((items == 3) && (terminator1 == ':') && (terminator2 == '\t')) {
 
           // update the line's information, save it and ...
<font color='#880000'>-          lineInfo.address       = instructionAddress;
</font><font color='#000088'>+          lineInfo.address =
+           executableInformation->getLoadAddress() + instructionOffset;
</font>           lineInfo.isInstruction = true;
           lineInfo.isNop         = isNop( buffer, lineInfo.nopSize );
           lineInfo.isBranch      = isBranchLine( buffer );

<font color='#006600'>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
</font><font color='#997700'>@@ -23,7 +23,9 @@
</font> #include "app_common.h"
 #include "TargetFactory.h"
 
<font color='#880000'>-char *progname;
</font><font color='#000088'>+//const char* dynamicLibrary = "libfuncs.so";
+const char* dynamicLibrary = NULL;
+char*       progname;
</font> 
 void usage()
 {
<font color='#997700'>@@ -47,6 +49,7 @@
</font>   const char                  *executable = "";
   const char                  *tracefile  =  "";
   const char                  *logname = "/tmp/qemu.log";
<font color='#000088'>+  Coverage::ExecutableInfo*    executableInfo;
</font>    
   //
   // Process command line options.
<font color='#997700'>@@ -83,9 +86,22 @@
</font>   // Create toolnames.
   TargetInfo = Target::TargetFactory( cpuname );
 
<font color='#000088'>+  if (dynamicLibrary)
+    executableInfo = new Coverage::ExecutableInfo(
+      executable, dynamicLibrary
+    );
+  else
+    executableInfo = new Coverage::ExecutableInfo( executable );
+
</font>   objdumpProcessor = new Coverage::ObjdumpProcessor();
  
<font color='#880000'>-  objdumpProcessor->loadAddressTable( executable );
</font><font color='#000088'>+  // If a dynamic library was specified, determine the load address.
+  if (dynamicLibrary)
+    executableInfo->setLoadAddress(
+      objdumpProcessor->determineLoadAddress( executableInfo )
+    );
+
+  objdumpProcessor->loadAddressTable( executableInfo );
</font> 
   log.processFile( logname );
 

<font color='#006600'>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
</font><font color='#997700'>@@ -34,6 +34,7 @@
</font> int                                  coverageExtensionLength = 0;
 Coverage::CoverageFormats_t          coverageFormat;
 Coverage::CoverageReaderBase*        coverageReader = NULL;
<font color='#000088'>+const char*                          dynamicLibrary = NULL;
</font> char*                                executable = NULL;
 char*                                executableExtension = NULL;
 int                                  executableExtensionLength = 0;
<font color='#997700'>@@ -153,10 +154,11 @@
</font>   //
   progname = argv[0];
 
<font color='#880000'>-  while ((opt = getopt(argc, argv, "C:1:e:c:E:f:s:T:O:v")) != -1) {
</font><font color='#000088'>+  while ((opt = getopt(argc, argv, "C:1:L:e:c:E:f:s:T:O:v")) != -1) {
</font>     switch (opt) {
       case 'C': CoverageConfiguration->processFile( optarg ); break;
       case '1': singleExecutable      = optarg; break;
<font color='#000088'>+      case 'L': dynamicLibrary        = optarg; break;
</font>       case 'e': executableExtension   = optarg; break;
       case 'c': coverageFileExtension = optarg; break;
       case 'E': explanations          = optarg; break;
<font color='#997700'>@@ -209,7 +211,13 @@
</font>       // If there was at least one coverage file, create the
       // executable information.
       if (!coverageFileNames.empty()) {
<font color='#880000'>-        executableInfo = new Coverage::ExecutableInfo( singleExecutable );
</font><font color='#000088'>+        if (dynamicLibrary)
+          executableInfo = new Coverage::ExecutableInfo(
+            singleExecutable, dynamicLibrary
+          );
+        else
+          executableInfo = new Coverage::ExecutableInfo( singleExecutable );
+
</font>         executablesToAnalyze.push_back( executableInfo );
       }
     }
<font color='#997700'>@@ -351,7 +359,7 @@
</font>   // Create the objdump processor.
   objdumpProcessor = new Coverage::ObjdumpProcessor();
 
<font color='#880000'>-  // Process each executable to analyze.
</font><font color='#000088'>+  // Prepare each executable for analysis.
</font>   for (eitr = executablesToAnalyze.begin();
        eitr != executablesToAnalyze.end();
        eitr++) {
<font color='#997700'>@@ -363,8 +371,11 @@
</font>         ((*eitr)->getFileName()).c_str()
       );
 
<font color='#880000'>-    // Create the executable information.
-    (*eitr)->initialize();
</font><font color='#000088'>+    // If a dynamic library was specified, determine the load address.
+    if (dynamicLibrary)
+      (*eitr)->setLoadAddress(
+        objdumpProcessor->determineLoadAddress( *eitr )
+      );
</font> 
     // Load the objdump for the symbols in this executable.
     objdumpProcessor->load( *eitr );
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>humph</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-05-18 Glenn Humphrey

        * TraceConverter.cc: Removed initialization of the dynamicLibrary
        variable.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ChangeLog.diff?r1=text&tr1=1.261&r2=text&tr2=1.262&diff_format=h">M</a></td><td width='1%'>1.262</td><td width='100%'>rtems-coverage/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/TraceConverter.cc.diff?r1=text&tr1=1.9&r2=text&tr2=1.10&diff_format=h">M</a></td><td width='1%'>1.10</td><td width='100%'>rtems-coverage/TraceConverter.cc</td></tr>
</table>
<pre>
<font color='#006600'>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
</font><font color='#997700'>@@ -1,3 +1,8 @@
</font><font color='#000088'>+2010-05-18    Glenn Humphrey
+
+       * TraceConverter.cc: Removed initialization of the dynamicLibrary
+       variable.
+
</font> 2010-05-18        Joel Sherrill <joel.sherrilL@OARcorp.com>
 
        * TraceConverter.cc: Add -L option.

<font color='#006600'>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
</font><font color='#997700'>@@ -23,7 +23,6 @@
</font> #include "app_common.h"
 #include "TargetFactory.h"
 
<font color='#880000'>-//const char* dynamicLibrary = "libfuncs.so";
</font> const char* dynamicLibrary = NULL;
 char*       progname;
 
</pre>
<p> </p>
<a name='cs3'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-05-18 Joel Sherrill <joel.sherrilL@OARcorp.com>

        * TraceConverter.cc: Add -L option.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/ChangeLog.diff?r1=text&tr1=1.260&r2=text&tr2=1.261&diff_format=h">M</a></td><td width='1%'>1.261</td><td width='100%'>rtems-coverage/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//gcc-testing/rtems-coverage/TraceConverter.cc.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>rtems-coverage/TraceConverter.cc</td></tr>
</table>
<pre>
<font color='#006600'>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
</font><font color='#997700'>@@ -1,3 +1,7 @@
</font><font color='#000088'>+2010-05-18    Joel Sherrill <joel.sherrilL@OARcorp.com>
+
+       * TraceConverter.cc: Add -L option.
+
</font> 2010-05-18        Glenn Humphrey
 
        * DesiredSymbols.cc, DesiredSymbols.h, ExecutableInfo.cc,

<font color='#006600'>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
</font><font color='#997700'>@@ -56,13 +56,14 @@
</font>   //
   progname = argv[0];
 
<font color='#880000'>-  while ((opt = getopt(argc, argv, "c:e:l:t:v")) != -1) {
</font><font color='#000088'>+  while ((opt = getopt(argc, argv, "c:e:l:L:t:v")) != -1) {
</font>     switch (opt) {
<font color='#880000'>-      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;
</font><font color='#000088'>+      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;
</font>       default:  usage();
     }
   }
<font color='#997700'>@@ -87,9 +88,7 @@
</font>   TargetInfo = Target::TargetFactory( cpuname );
 
   if (dynamicLibrary)
<font color='#880000'>-    executableInfo = new Coverage::ExecutableInfo(
-      executable, dynamicLibrary
-    );
</font><font color='#000088'>+    executableInfo = new Coverage::ExecutableInfo( executable, dynamicLibrary );
</font>   else
     executableInfo = new Coverage::ExecutableInfo( executable );
 
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>