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

rtems-vc at rtems.org rtems-vc at rtems.org
Tue May 25 20:10:02 UTC 2010


 *jennifer*:
2010-05-25	Jennifer Averett <Jennifer.Averett at OARcorp.com>

	* DesiredSymbols.cc, Explanations.cc, ObjdumpProcessor.cc,
	TraceReaderLogQEMU.cc, app_common.cc, app_common.h: Added a
	inputBuffer to app_common and modified all fgets calls to use this
	buffer. This will allow for a size increase if necessary.

M    1.6  covoar/ChangeLog
M    1.2  covoar/DesiredSymbols.cc
M    1.2  covoar/Explanations.cc
M    1.3  covoar/ObjdumpProcessor.cc
M    1.2  covoar/TraceReaderLogQEMU.cc
M    1.2  covoar/app_common.h
M    1.2  covoar/app_common.cc

diff -u gcc-testing/covoar/ChangeLog:1.5 gcc-testing/covoar/ChangeLog:1.6
--- gcc-testing/covoar/ChangeLog:1.5	Tue May 25 13:16:47 2010
+++ gcc-testing/covoar/ChangeLog	Tue May 25 14:14:48 2010
@@ -1,3 +1,10 @@
+2010-05-25	Jennifer Averett <Jennifer.Averett at OARcorp.com>
+
+	* DesiredSymbols.cc, Explanations.cc, ObjdumpProcessor.cc,
+	TraceReaderLogQEMU.cc, app_common.cc, app_common.h: Added a
+	inputBuffer to app_common and modified all fgets calls to use this
+	buffer. This will allow for a size increase if necessary.
+
 2010-05-25	Jennifer.Averett <Jennifer.Averett at OARcorp.com>
 
 	* ObjdumpProcessor.cc, TargetBase.cc, TargetBase.h: Removed nm and

diff -u gcc-testing/covoar/DesiredSymbols.cc:1.1 gcc-testing/covoar/DesiredSymbols.cc:1.2
--- gcc-testing/covoar/DesiredSymbols.cc:1.1	Mon May 24 15:07:08 2010
+++ gcc-testing/covoar/DesiredSymbols.cc	Tue May 25 14:14:48 2010
@@ -34,8 +34,6 @@
     const char* const symbolsFile
   )
   {
-    #define MAX_LINE_LENGTH 512
-    char                    buffer[MAX_LINE_LENGTH];
     char*                   cStatus;
     bool                    done = false;
     FILE*                   sFile;
@@ -70,36 +68,35 @@
 
       // Skip blank lines between symbols
       do { 
-        buffer[0] = '\0';
-        cStatus = fgets( buffer, MAX_LINE_LENGTH, sFile );
+        inputBuffer[0] = '\0';
+        cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, sFile );
         if ( cStatus == NULL ) {
           done = true;
         }
         else {
-          buffer[ strlen(buffer) - 1] = '\0';
+          inputBuffer[ strlen(inputBuffer) - 1] = '\0';
           line++;
         }
-      } while ( !done && (buffer[0] == '\0') );
+      } while ( !done && (inputBuffer[0] == '\0') );
 
       // Have we already seen this one?
       if ( !done ) {
-        if (set.find( buffer ) != set.end()) {
+        if (set.find( inputBuffer ) != set.end()) {
           fprintf(
             stderr,
             "File: %s, Line %d: Duplicate symbol: %s\n",
             symbolsFile,
             line,
-            buffer
+            inputBuffer
           );
         }
 
         // Add this to the set of symbols.
         else {
-          set[ buffer ] = *symInfo;
+          set[ inputBuffer ] = *symInfo;
         }
       }
     }
-    #undef MAX_LINE_LENGTH
   }
 
   void DesiredSymbols::preprocess( void )
@@ -380,7 +377,6 @@
   )
   {
     char*                              base;
-    char                               buffer[512];
     char*                              cStatus;
     char                               command[512];
     std::string                        fileName;
@@ -455,7 +451,7 @@
          ritr != theRanges->set.end();
          ritr++ ) {
 
-      cStatus = fgets( buffer, 512, tmpfile );
+      cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, tmpfile );
       if ( cStatus == NULL ) {
         fprintf(
           stderr,
@@ -464,15 +460,15 @@
         );
         exit( -1 );
       }
-      buffer[ strlen(buffer) - 1] = '\0';
+      inputBuffer[ strlen(inputBuffer) - 1] = '\0';
 
       // Use only the base filename without directory path.
-      realpath( buffer, rpath );
+      realpath( inputBuffer, rpath );
       base = basename( rpath );
 
       ritr->lowSourceLine = std::string( base );
 
-      cStatus = fgets( buffer, 512, tmpfile );
+      cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, tmpfile );
       if ( cStatus == NULL ) {
         fprintf(
           stderr,
@@ -481,10 +477,10 @@
         );
         exit( -1 );
       }
-      buffer[ strlen(buffer) - 1] = '\0';
+      inputBuffer[ strlen(inputBuffer) - 1] = '\0';
 
       // Use only the base filename without directory path.
-      realpath( buffer, rpath );
+      realpath( inputBuffer, rpath );
       base = basename( rpath );
 
       ritr->highSourceLine = std::string( base );

diff -u gcc-testing/covoar/Explanations.cc:1.1 gcc-testing/covoar/Explanations.cc:1.2
--- gcc-testing/covoar/Explanations.cc:1.1	Mon May 24 15:07:08 2010
+++ gcc-testing/covoar/Explanations.cc	Tue May 25 14:14:48 2010
@@ -15,6 +15,7 @@
 #include <unistd.h>
 
 #include "Explanations.h"
+#include "app_common.h"
 
 namespace Coverage {
 
@@ -32,7 +33,6 @@
   {
     #define MAX_LINE_LENGTH 512
     FILE       *explain;
-    char        buffer[MAX_LINE_LENGTH];
     char        *cStatus;
     Explanation *e;
     int          line = 1;
@@ -55,33 +55,33 @@
       // Read the starting line of this explanation and
       // skip blank lines between
       do {
-        buffer[0] = '\0';
-        cStatus = fgets( buffer, MAX_LINE_LENGTH, explain );
+        inputBuffer[0] = '\0';
+        cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, explain );
         if (cStatus == NULL) {
           goto done;
         }
-        buffer[ strlen(buffer) - 1] = '\0';
+        inputBuffer[ strlen(inputBuffer) - 1] = '\0';
         line++;
-      } while ( buffer[0] == '\0' );
+      } while ( inputBuffer[0] == '\0' );
 
       // Have we already seen this one?
-      if (set.find( buffer ) != set.end()) {
+      if (set.find( inputBuffer ) != set.end()) {
         fprintf(
           stderr,
           "ERROR: Explanations::load - line %d "
           "contains a duplicate explanation (%s)\n",
           line,
-          buffer
+          inputBuffer
         );
         exit( -1 );
       }
 
       // Add the starting line and file
-      e->startingPoint = std::string(buffer);
+      e->startingPoint = std::string(inputBuffer);
       e->found = false;
 
       // Get the classification 
-      cStatus = fgets( buffer, MAX_LINE_LENGTH, explain );
+      cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, explain );
       if (cStatus == NULL) {
         fprintf(
           stderr,
@@ -91,14 +91,14 @@
         );
         exit( -1 );
       }
-      buffer[ strlen(buffer) - 1] = '\0';
-      e->classification = buffer;
+      inputBuffer[ strlen(inputBuffer) - 1] = '\0';
+      e->classification = inputBuffer;
       line++;
 
       // Get the explanation 
       while (1) {
-        cStatus = fgets( buffer, MAX_LINE_LENGTH, explain );
-        // fprintf( stderr, "%d - %s\n", line, buffer );
+        cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, explain );
+        // fprintf( stderr, "%d - %s\n", line, inputBuffer );
         if (cStatus == NULL) {
           fprintf(
             stderr,
@@ -108,15 +108,15 @@
           );
           exit( -1 );
         }
-        buffer[ strlen(buffer) - 1] = '\0';
+        inputBuffer[ strlen(inputBuffer) - 1] = '\0';
         line++;
 
         const char delimiter[4] = "+++";
-        if (!strncmp( buffer, delimiter, 3 )) {
+        if (!strncmp( inputBuffer, delimiter, 3 )) {
           break;
         }
         // XXX only taking last line.  Needs to be a vector
-        e->explanation.push_back( buffer );
+        e->explanation.push_back( inputBuffer );
       }
 
       // Add this to the set of Explanations

diff -u gcc-testing/covoar/ObjdumpProcessor.cc:1.2 gcc-testing/covoar/ObjdumpProcessor.cc:1.3
--- gcc-testing/covoar/ObjdumpProcessor.cc:1.2	Tue May 25 13:16:47 2010
+++ gcc-testing/covoar/ObjdumpProcessor.cc	Tue May 25 14:14:48 2010
@@ -132,7 +132,6 @@
   {
     #define METHOD "ERROR: ObjdumpProcessor::determineLoadAddress - "
     FILE*        loadAddressFile = NULL;
-    char         buffer[ 512 ];
     char*        cStatus;
     uint32_t     offset;
 
@@ -140,124 +139,6 @@
     if (!theExecutable->hasDynamicLibrary())
       return 0;
 
-#if 0
-    static FILE* gdbCommands = NULL;
-    int          items;
-    uint32_t     loadAddress;
-    FILE*        objdumpFile = NULL;
-    int          status;
-    char         terminator;
-
-
-    //
-    // 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
-#if 1
     std::string dlinfoName = theExecutable->getFileName();
     uint32_t address;
     char inLibName[128];
@@ -275,7 +156,7 @@
     while ( 1 ) {
 
       // Get a line.
-      cStatus = fgets( buffer, 512, loadAddressFile );
+      cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, loadAddressFile );
       if (cStatus == NULL) {
         fprintf(
           stderr,
@@ -286,7 +167,7 @@
         fclose( loadAddressFile );
         exit( -1 );
       }
-      sscanf( buffer, "%s %x", inLibName, &offset );
+      sscanf( inputBuffer, "%s %x", inLibName, &offset );
       std::string tmp = inLibName;
       if ( tmp.find( Library ) != tmp.npos ) {
         // fprintf( stderr, "%s - 0x%08x\n", inLibName, offset );
@@ -297,7 +178,7 @@
 
     fclose( loadAddressFile );
     return address;
-#endif
+
     #undef METHOD
   }
 
@@ -417,7 +298,6 @@
     ExecutableInfo* const executableInformation
   )
   {
-    char               buffer[ 512 ];
     char*              cStatus;
     int                items;
     FILE*              objdumpFile;
@@ -434,15 +314,15 @@
     while ( 1 ) {
 
       // Get the line.
-      cStatus = fgets( buffer, 512, objdumpFile );
+      cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, objdumpFile );
       if (cStatus == NULL) {
         break;
       }
-      buffer[ strlen(buffer) - 1] = '\0';
+      inputBuffer[ strlen(inputBuffer) - 1] = '\0';
 
       // See if it is the dump of an instruction.
       items = sscanf(
-        buffer,
+        inputBuffer,
         "%x%c",
         &offset, &terminator
       );
@@ -460,7 +340,6 @@
     ExecutableInfo* const executableInformation
   )
   {
-    char               buffer[ 512 ];
     char*              cStatus;
     std::string        currentSymbol = "";
     uint32_t           endAddress;
@@ -486,7 +365,7 @@
     while ( 1 ) {
 
       // Get the line.
-      cStatus = fgets( buffer, 512, objdumpFile );
+      cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, objdumpFile );
       if (cStatus == NULL) {
 
         // If we are currently processing a symbol, finalize it.
@@ -511,9 +390,9 @@
         break;
       }
 
-      buffer[ strlen(buffer) - 1] = '\0';
+      inputBuffer[ strlen(inputBuffer) - 1] = '\0';
 
-      lineInfo.line          = buffer;
+      lineInfo.line          = inputBuffer;
       lineInfo.address       = 0xffffffff;
       lineInfo.isInstruction = false;
       lineInfo.isNop         = false;
@@ -523,7 +402,7 @@
       // Look for the start of a symbol's objdump and extract
       // offset and symbol (i.e. offset <symbolname>:).
       items = sscanf(
-        buffer,
+        inputBuffer,
         "%x <%[^>]>%c",
         &offset, symbol, &terminator1
       );
@@ -563,7 +442,7 @@
 
         // See if it is the dump of an instruction.
         items = sscanf(
-          buffer,
+          inputBuffer,
           "%x%c\t%*[^\t]%c",
           &instructionOffset, &terminator1, &terminator2
         );
@@ -575,8 +454,8 @@
           lineInfo.address =
            executableInformation->getLoadAddress() + instructionOffset;
           lineInfo.isInstruction = true;
-          lineInfo.isNop         = isNop( buffer, lineInfo.nopSize );
-          lineInfo.isBranch      = isBranchLine( buffer );
+          lineInfo.isNop         = isNop( inputBuffer, lineInfo.nopSize );
+          lineInfo.isBranch      = isBranchLine( inputBuffer );
         }
 
         // Always save the line.

diff -u gcc-testing/covoar/TraceReaderLogQEMU.cc:1.1 gcc-testing/covoar/TraceReaderLogQEMU.cc:1.2
--- gcc-testing/covoar/TraceReaderLogQEMU.cc:1.1	Mon May 24 15:07:08 2010
+++ gcc-testing/covoar/TraceReaderLogQEMU.cc	Tue May 25 14:14:48 2010
@@ -59,7 +59,6 @@
     int                 status;
     FILE*               logFile;
     int                 result;
-    char                buffer[120];
 
     //
     // Verify that the log file has a non-zero size.
@@ -105,9 +104,9 @@
     //
     //  Read First Start Address
     //
-    fgets(buffer, 120, logFile );
+    fgets(inputBuffer, MAX_LINE_LENGTH, logFile );
     result = sscanf( 
-      buffer, 
+      inputBuffer, 
       "0x%08lx: %s %s\n", 
       &first.address, 
       first.instruction, 
@@ -125,9 +124,9 @@
    
       // Read until we get to the last instruction in the block.
       do {
-        fgets(buffer, 120, logFile );
+        fgets(inputBuffer, MAX_LINE_LENGTH, logFile );
         result = sscanf( 
-          buffer, 
+          inputBuffer, 
           "0x%08lx: %s %s\n", 
           &last.address, 
           last.instruction, 
@@ -141,9 +140,9 @@
         done = true;
         nextExecuted = last;
       } else {
-        fgets(buffer, 120, logFile );
+        fgets(inputBuffer, MAX_LINE_LENGTH, logFile );
         result = sscanf( 
-          buffer, 
+          inputBuffer, 
           "0x%08lx: %s %s\n", 
           &nextExecuted.address, 
           nextExecuted.instruction, 

diff -u gcc-testing/covoar/app_common.h:1.1 gcc-testing/covoar/app_common.h:1.2
--- gcc-testing/covoar/app_common.h:1.1	Mon May 24 15:07:08 2010
+++ gcc-testing/covoar/app_common.h	Tue May 25 14:14:48 2010
@@ -21,6 +21,9 @@
 extern const char*                  dynamicLibrary;
 extern const char*                  projectName;
 
+#define MAX_LINE_LENGTH             512
+extern char                         inputBuffer[MAX_LINE_LENGTH];
+
 
 bool FileIsNewer( const char *f1, const char *f2 ); 
 bool FileIsReadable( const char *f1 ); 

diff -u gcc-testing/covoar/app_common.cc:1.1 gcc-testing/covoar/app_common.cc:1.2
--- gcc-testing/covoar/app_common.cc:1.1	Mon May 24 15:07:08 2010
+++ gcc-testing/covoar/app_common.cc	Tue May 25 14:14:48 2010
@@ -34,6 +34,7 @@
 Target::TargetBase*         TargetInfo          = NULL;
 const char*                 dynamicLibrary      = NULL;
 const char*                 projectName         = NULL;
+char                        inputBuffer[MAX_LINE_LENGTH];
 
 
 bool FileIsNewer(



--

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/20100525/aa89c76d/attachment.html>


More information about the vc mailing list