Changeset e0aaa1c in rtems-testing


Ignore:
Timestamp:
May 11, 2010, 8:09:19 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 8895273c193787f84c4585a10f6d6aceb3b25dc4
Children:
af4279e
Parents:
313e8a3
Message:

2010-05-11 Joel Sherrill <joel.sherrilL@…>

Location:
rtems-coverage
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • rtems-coverage/ChangeLog

    r313e8a3 re0aaa1c  
     12010-05-11      Joel Sherrill <joel.sherrilL@OARcorp.com>
     2
     3        * CoverageReaderQEMU.cc, ObjdumpProcessor.cc, ObjdumpProcessor.h,
     4        TargetBase.cc, TargetBase.h, TraceConverter.cc, TraceWriterQEMU.cc,
     5        app_common.cc, app_common.h, covoar.cc, qemu-traces.h: Allow each
     6        Qemu target architecture to define its own taken and not taken bits.
     7
    182010-05-11      Joel Sherrill <joel.sherrilL@OARcorp.com>
    29
  • rtems-coverage/CoverageReaderQEMU.cc

    r313e8a3 re0aaa1c  
    1818#include "CoverageMap.h"
    1919#include "ExecutableInfo.h"
    20 
    21 /* XXX really not always right */
    22 typedef uint32_t target_ulong;
    2320
    2421#include "qemu-traces.h"
     
    5451    int                 status;
    5552    FILE*               traceFile;
     53    uint8_t             taken;
     54    uint8_t             notTaken;
     55    uint8_t             branchInfo;
     56
     57    taken    = TargetInfo->qemuTakenBit();
     58    notTaken = TargetInfo->qemuNotTakenBit();
     59    branchInfo = taken | notTaken;
    5660
    5761    //
     
    146150
    147151        // Determine if additional branch information is available.
    148        if ( (entry->op & (TRACE_OP_TAKEN|TRACE_OP_NOT_TAKEN)) != 0 ) {
     152       if ( (entry->op & branchInfo) != 0 ) {
    149153          unsigned int a = entry->pc + entry->size - 1;
    150154          while (!aCoverageMap->isStartOfInstruction(a))
    151155            a--;
    152           if (entry->op & TRACE_OP_TAKEN) {
     156          if (entry->op & taken) {
    153157            aCoverageMap->setWasTaken( a );
    154           } else if (entry->op & TRACE_OP_NOT_TAKEN) {
     158          } else if (entry->op & notTaken) {
    155159            aCoverageMap->setWasNotTaken( a );
    156160          }
  • rtems-coverage/ObjdumpProcessor.cc

    r313e8a3 re0aaa1c  
    1818#include <algorithm>
    1919
     20#include "app_common.h"
    2021#include "ObjdumpProcessor.h"
    21 #include "app_common.h"
    2222#include "CoverageMap.h"
    2323#include "ExecutableInfo.h"
     
    7777  ObjdumpProcessor::ObjdumpProcessor()
    7878  {
    79     target_m = Target::TargetFactory(Tools->getTarget());
    8079  }
    8180
     
    8887  )
    8988  {
    90     if (!target_m) {
     89    if ( !TargetInfo ) {
    9190      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
    9291      assert(0);
     
    9493    }
    9594
    96     return target_m->isBranch( instruction );
     95    return TargetInfo->isBranch( instruction );
    9796  }
    9897
     
    101100  )
    102101  {
    103     if (!target_m) {
     102    if ( !TargetInfo ) {
    104103      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
    105104      assert(0);
     
    107106    }
    108107
    109     return  target_m->isBranchLine( line );
     108    return  TargetInfo->isBranchLine( line );
    110109  }
    111110
     
    116115  {
    117116
    118     if (!target_m){
     117    if ( !TargetInfo ){
    119118      fprintf( stderr, "ERROR!!! unknown architecture!!!\n");
    120119      fprintf( stderr, "HOW LARGE IS NOP ON THIS ARCHITECTURE? -- fix me\n" );
     
    123122    }
    124123
    125     return target_m->isNopLine( line, size );
     124    return TargetInfo->isNopLine( line, size );
    126125  }
    127126
  • rtems-coverage/ObjdumpProcessor.h

    r313e8a3 re0aaa1c  
    135135
    136136    objdumpFile_t       objdumpList;
    137     Target::TargetBase* target_m;
    138137
    139138    /*!
  • rtems-coverage/TargetBase.cc

    r313e8a3 re0aaa1c  
    99 *  functions supporting target unique functionallity.
    1010 */
     11
    1112#include "TargetBase.h"
     13#include "qemu-traces.h"
     14
    1215#include <algorithm>
    1316#include <stdio.h>
     
    2528  {
    2629  }
    27 
    2830
    2931  bool TargetBase::isBranch(
     
    9193    return isBranch( instruction );
    9294  }
     95
     96  uint8_t TargetBase::qemuTakenBit(void)
     97  {
     98    return TRACE_OP_BR0;
     99  }
     100
     101  uint8_t TargetBase::qemuNotTakenBit(void)
     102  {
     103    return TRACE_OP_BR1;
     104  }
     105
    93106}
  • rtems-coverage/TargetBase.h

    r313e8a3 re0aaa1c  
    1414#include <list>
    1515#include <string>
    16 
     16#include <stdint.h>
    1717
    1818namespace Target {
     
    2121   *
    2222   *  This class is the base class for all Target classes.  Each
    23    *  target class contains routines that are specific to the target in question.
    24    *
     23   *  target class contains routines that are specific to the target
     24   *  in question.
    2525   */
    2626  class TargetBase {
     
    7575    );
    7676
     77    /*!
     78     *  This method returns the bit set by Qemu in the trace record
     79     *  when a branch is taken.
     80     */
     81    virtual uint8_t qemuTakenBit(void);
     82
     83    /*!
     84     *  This method returns the bit set by Qemu in the trace record
     85     *  when a branch is taken.
     86     */
     87    virtual uint8_t qemuNotTakenBit(void);
     88
    7789  protected:
    7890
  • rtems-coverage/TraceConverter.cc

    r313e8a3 re0aaa1c  
    2323#include "Toolnames.h"
    2424#include "app_common.h"
     25#include "TargetFactory.h"
    2526
    2627char *progname;
     
    8384  // Create toolnames.
    8485  Tools = new Coverage::Toolnames( cpuname );
     86  TargetInfo = Target::TargetFactory( cpuname );
    8587
    8688  objdumpProcessor = new Coverage::ObjdumpProcessor();
  • rtems-coverage/TraceWriterQEMU.cc

    r313e8a3 re0aaa1c  
    5252    int                 status;
    5353    FILE*               traceFile;
     54    uint8_t             taken;
     55    uint8_t             notTaken;
     56
     57    taken    = TargetInfo->qemuTakenBit();
     58    notTaken = TargetInfo->qemuNotTakenBit();
    5459
    5560    //
     
    115120      switch (itr->exitReason) {
    116121        case TraceList::EXIT_REASON_BRANCH_TAKEN:
    117           entry.op |= TRACE_OP_TAKEN;
     122          entry.op |= taken;
    118123          break;
    119124        case TraceList::EXIT_REASON_BRANCH_NOT_TAKEN:
    120           entry.op |= TRACE_OP_NOT_TAKEN;
     125          entry.op |= notTaken;
    121126          break;
    122127        case TraceList::EXIT_REASON_OTHER:
     
    128133       }
    129134       
    130       if (Verbose )
     135      if ( Verbose )
    131136        fprintf(stderr, "%x %x %x\n", entry.pc, entry.size, entry.op);
    132137
  • rtems-coverage/app_common.cc

    r313e8a3 re0aaa1c  
    2525const char*                 outputDirectory     = ".";
    2626bool                        BranchInfoAvailable = false;
     27Target::TargetBase*         TargetInfo          = NULL;
    2728
    2829bool FileIsNewer( const char *f1, const char *f2 ) {
  • rtems-coverage/app_common.h

    r313e8a3 re0aaa1c  
    1111#include "Explanations.h"
    1212#include "Toolnames.h"
     13#include "TargetBase.h"
    1314
    1415extern Coverage::Explanations*      AllExplanations;
     
    1920extern const char*                  outputDirectory;
    2021extern bool                         BranchInfoAvailable;
     22extern Target::TargetBase*          TargetInfo;
    2123
    2224bool FileIsNewer( const char *f1, const char *f2 );
  • rtems-coverage/covoar.cc

    r313e8a3 re0aaa1c  
    2525#include "ObjdumpProcessor.h"
    2626#include "ReportsBase.h"
     27#include "TargetFactory.h"
    2728
    2829/*
     
    272273
    273274  // Create toolnames based on target.
    274   Tools = new Coverage::Toolnames( target );
     275  Tools      = new Coverage::Toolnames( target );
     276  TargetInfo = Target::TargetFactory( target );
    275277
    276278  // Create the set of desired symbols.
  • rtems-coverage/qemu-traces.h

    r313e8a3 re0aaa1c  
    3131#ifndef QEMU_TRACE_H
    3232#define QEMU_TRACE_H
     33
     34/* XXX really not always right */
     35/* XXX Added for covoar so this compiles */
     36typedef uint32_t target_ulong;
    3337
    3438/* File header definition.  */
     
    99103#define TRACE_OP_BR3 0x08
    100104
    101 #define TRACE_OP_TAKEN     TRACE_OP_BR0 /* Branch not taken at pc.  */
    102 #define TRACE_OP_NOT_TAKEN TRACE_OP_BR1 /* Branch taken at pc. */
    103 
    104105/*
    105106 * Decision map operations
Note: See TracChangeset for help on using the changeset viewer.