Changeset 4967baa in rtems-testing


Ignore:
Timestamp:
May 18, 2010, 3:30:37 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 8895273c193787f84c4585a10f6d6aceb3b25dc4
Children:
7e2f6d0
Parents:
b75e720
Message:

2010-05-18 Joel Sherrill <joel.sherrill@…>

Location:
rtems-coverage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtems-coverage/ChangeLog

    rb75e720 r4967baa  
     12010-05-18      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * ObjdumpProcessor.cc: Now read dlinfo from file.
     4
    152010-05-18      Glenn Humphrey
    26
  • rtems-coverage/ObjdumpProcessor.cc

    rb75e720 r4967baa  
    1717#include <string.h>
    1818#include <algorithm>
     19#include <string>
    1920
    2021#include "app_common.h"
     
    130131  )
    131132  {
    132 #if 0
     133    #define METHOD "ERROR: ObjdumpProcessor::determineLoadAddress - "
     134    FILE*        loadAddressFile = NULL;
    133135    char         buffer[ 512 ];
    134136    char*        cStatus;
     137    uint32_t     offset;
     138
     139    // This method should only be call for a dynamic library.
     140    if (!theExecutable->hasDynamicLibrary())
     141      return 0;
     142
     143#if 0
    135144    static FILE* gdbCommands = NULL;
    136145    int          items;
    137146    uint32_t     loadAddress;
    138     FILE*        loadAddressFile = NULL;
    139147    FILE*        objdumpFile = NULL;
    140     uint32_t     offset;
    141148    int          status;
    142149    char         terminator;
    143150
    144     // This method should only be call for a dynamic library.
    145     if (!theExecutable->hasDynamicLibrary())
    146       return 0;
    147151
    148152    //
     
    254258    return (loadAddress - offset);
    255259# endif
    256     return 0x42084000;
     260#if 1
     261    std::string dlinfoName = theExecutable->getFileName();
     262    uint32_t address;
     263    char inLibName[128];
     264    std::string Library = theExecutable->getLibraryName();
     265
     266    dlinfoName += ".dlinfo";
     267    // Read load address.
     268    loadAddressFile = fopen( dlinfoName.c_str(), "r" );
     269    if (!loadAddressFile) {
     270      fprintf( stderr, METHOD "unable to open %s\n", dlinfoName.c_str() );
     271      exit( -1 );
     272    }
     273
     274    // Process the dlinfo file.
     275    while ( 1 ) {
     276
     277      // Get a line.
     278      cStatus = fgets( buffer, 512, loadAddressFile );
     279      if (cStatus == NULL) {
     280        fprintf(
     281          stderr,
     282          METHOD "library %s not found in %s\n",
     283          Library.c_str(),
     284          dlinfoName.c_str()
     285        );
     286        fclose( loadAddressFile );
     287        exit( -1 );
     288      }
     289      sscanf( buffer, "%s %x", inLibName, &offset );
     290      std::string tmp = inLibName;
     291      if ( tmp.find( Library ) != tmp.npos ) {
     292        // fprintf( stderr, "%s - 0x%08x\n", inLibName, offset );
     293        address = offset;
     294        break;
     295      }
     296    }
     297
     298    fclose( loadAddressFile );
     299    return address;
     300#endif
     301    #undef METHOD
    257302  }
    258303
Note: See TracChangeset for help on using the changeset viewer.