Home | History | Annotate | Download | only in qtools
      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <inttypes.h>
      4 #include "trace_reader.h"
      5 
      6 int main(int argc, char **argv) {
      7   if (argc != 2) {
      8     fprintf(stderr, "Usage: %s trace_file\n", argv[0]);
      9     exit(1);
     10   }
     11 
     12   char *trace_filename = argv[1];
     13   TraceReaderBase *trace = new TraceReaderBase;
     14   trace->Open(trace_filename);
     15 
     16   while (1) {
     17     uint64_t time;
     18     uint32_t addr;
     19     int flags;
     20 
     21     if (trace->ReadAddr(&time, &addr, &flags))
     22       break;
     23     const char *op = "ld";
     24     if (flags == 1)
     25         op = "st";
     26     printf("%lld 0x%08x %s\n", time, addr, op);
     27   }
     28   return 0;
     29 }
     30