blob: e48edadc34f86d2ef013e2b9e3ee3dc06cb550f9 [file] [log] [blame]
The Android Open Source Project5c118522008-10-21 07:00:00 -07001#include <stdio.h>
2#include <unistd.h>
3#include <stdlib.h>
4#include <inttypes.h>
5#include "trace_reader.h"
6#include "parse_options.h"
7
8typedef TraceReader<> TraceReaderType;
9
10#include "parse_options-inl.h"
11
12void Usage(const char *program)
13{
14 fprintf(stderr, "Usage: %s [options] trace_name elf_file\n",
15 program);
16 OptionsUsage();
17}
18
19int main(int argc, char **argv) {
20 ParseOptions(argc, argv);
21 if (argc - optind != 2) {
22 Usage(argv[0]);
23 exit(1);
24 }
25
26 char *qemu_trace_file = argv[optind++];
27 char *elf_file = argv[optind++];
28 TraceReaderType *trace = new TraceReaderType;
29 trace->Open(qemu_trace_file);
30 trace->ReadKernelSymbols(elf_file);
31 trace->SetRoot(root);
32
33 while (1) {
34 MethodRec method_record;
35 symbol_type *sym;
36 TraceReaderType::ProcessState *proc;
37
38 if (trace->ReadMethodSymbol(&method_record, &sym, &proc))
39 break;
40 if (sym != NULL) {
41 printf("%lld p %d 0x%x %d %s\n",
42 method_record.time, proc->pid, method_record.addr,
43 method_record.flags, sym->name);
44 } else {
45 printf("%lld p %d 0x%x %d\n",
46 method_record.time, proc->pid, method_record.addr,
47 method_record.flags);
48 }
49 proc->DumpStack();
50 }
51 return 0;
52}