source: rtems-testing/rtems-coverage/TraceConverter.cc @ 25879a4

4.11
Last change on this file since 25879a4 was 25879a4, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 22, 2010 at 7:26:03 PM

2010-04-22 Joel Sherrill <joel.sherrill@…>

  • Property mode set to 100644
File size: 1.8 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 "TraceList.h"
21#include "ObjdumpProcessor.h"
22#include "Toolnames.h"
23#include "app_common.h"
24
25char *progname;
26
27void usage()
28{
29  fprintf(
30    stderr,
31    "Usage: %s [-v] -c CPU -e executable [-E logfile]\n",
32    progname
33  );
34  exit(1);
35}
36
37int main(
38  int    argc,
39  char** argv
40)
41{
42  int                          opt;
43  Trace::TraceReaderLogQEMU    log;
44  const char                  *cpuname = NULL;
45  const char                  *executable = NULL;
46  const char                  *tracefile = NULL;
47  const char                  *logname = "/tmp/qemu.log";
48   
49  //
50  // Process command line options.
51  //
52  progname = argv[0];
53
54  while ((opt = getopt(argc, argv, "c:e:l:v")) != -1) {
55    switch (opt) {
56      case 'c': cpuname = optarg;    break;
57      case 'e': executable = optarg; break;
58      case 'l': logname = optarg;    break;
59      case 't': tracefile = optarg;  break;
60      case 'v': Verbose = true;      break;
61      default:  usage();
62    }
63  }
64
65  // Make sure we have all the required parameters
66  if ( !cpuname ) {
67    fprintf( stderr, "cpuname not specified\n" );
68    usage();
69  }
70
71  if ( !executable ) {
72    fprintf( stderr, "executable not specified\n" );
73    usage();
74  }
75
76  if ( !tracefile ) {
77    fprintf( stderr, "output trace file not specified\n" );
78    usage();
79  }
80
81  // Create toolnames.
82  Tools = new Coverage::Toolnames( cpuname );
83
84  objdumpProcessor = new Coverage::ObjdumpProcessor();
85 
86  objdumpProcessor->loadAddressTable( executable );
87
88  log.processFile( logname );
89
90  log.Trace.ShowList();
91}
Note: See TracBrowser for help on using the repository browser.