1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <inttypes.h> 4 #include "trace_reader_base.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, recnum, bb_num, bb_start_time; 18 uint32_t pc, target_pc; 19 int num_insns; 20 21 if (trace->ReadExc(&time, &pc, &recnum, &target_pc, &bb_num, 22 &bb_start_time, &num_insns)) 23 break; 24 printf("time: %lld rec: %llu pc: %08x target: %08x bb: %llu bb_start: %llu insns: %d\n", 25 time, recnum, pc, target_pc, bb_num, bb_start_time, num_insns); 26 } 27 return 0; 28 } 29