source: rtems-testing/rtems-coverage/TraceConverter.cc @ 2a95fde

4.11
Last change on this file since 2a95fde was 2a95fde, checked in by Jennifer Averett <Jennifer.Averett@…>, on Apr 23, 2010 at 6:57:18 PM

2010-04-23 Jennifer Averett <Jennifer.Averett@…

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  $Id$
3 */
4
5/*! @file TraceReaderLogQEMU.cc
6 *  @brief TraceReaderLogQEMU Implementation
7 *
8 *  This file contains the implementation of the functions supporting
9 *  reading the QEMU coverage data files.
10 */
11
12#include <stdio.h>
13#include <stdlib.h>
14#include <sys/stat.h>
15#include <string.h>
16
17#include "qemu-log.h"
18
19#include "TraceReaderLogQEMU.h"
20#include "TraceWriterQEMU.h"
21#include "TraceList.h"
22#include "ObjdumpProcessor.h"
23#include "Toolnames.h"
24#include "app_common.h"
25
26char *progname;
27
28void usage()
29{
30  fprintf(
31    stderr,
32    "Usage: %s [-v] -c CPU -e executable -t tracefile [-E logfile]\n",
33    progname
34  );
35  exit(1);
36}
37
38int main(
39  int    argc,
40  char** argv
41)
42{
43  int                          opt;
44  Trace::TraceReaderLogQEMU    log;
45  Trace::TraceWriterQEMU       trace;
46  const char                  *cpuname    = NULL;
47  const char                  *executable = NULL;
48  const char                  *tracefile  =  NULL;
49  const char                  *logname = "/tmp/qemu.log";
50   
51  //
52  // Process command line options.
53  //
54  progname = argv[0];
55
56  while ((opt = getopt(argc, argv, "c:e:l:t:v")) != -1) {
57    switch (opt) {
58      case 'c': cpuname = optarg;    break;
59      case 'e': executable = optarg; break;
60      case 'l': logname = optarg;    break;
61      case 't': tracefile = optarg;  break;
62      case 'v': Verbose = true;      break;
63      default:  usage();
64    }
65  }
66
67  // Make sure we have all the required parameters
68  if ( !cpuname ) {
69    fprintf( stderr, "cpuname not specified\n" );
70    usage();
71  }
72
73  if ( !executable ) {
74    fprintf( stderr, "executable not specified\n" );
75    usage();
76  }
77
78  if ( !tracefile ) {
79    fprintf( stderr, "output trace file not specified\n" );
80    usage();
81  }
82
83  // Create toolnames.
84  Tools = new Coverage::Toolnames( cpuname );
85
86  objdumpProcessor = new Coverage::ObjdumpProcessor();
87 
88  objdumpProcessor->loadAddressTable( executable );
89
90  log.processFile( logname );
91
92  trace.writeFile( tracefile, &log );
93
94}
Note: See TracBrowser for help on using the repository browser.