8 Tracer::Tracer(GlDbg &dbg):
9 glprint(new GlPrint(0, 16384)),
14 dbg.get_command_interpreter().register_command("trace", this, &Tracer::cmd_trace)
15 .set_help("Traces GL function calls",
17 " Send trace output to stdout.\n\n"
19 " Send trace output to FILE (- for stdout).\n\n"
21 " Temporarily suspend or resume trace without closing the file.\n\n"
23 " Terminate trace, closing the file.\n");
33 void Tracer::set_output(FILE *o, bool d)
41 void Tracer::decode(const char *data, unsigned len)
46 int ret = glprint->decode(data, len);
49 const char *buf = glprint->get_buffer();
51 fprintf(out, "%s\n", buf);
55 void Tracer::cmd_trace(const string &args)
57 if(args.empty() || args=="-")
59 set_output(stdout, false);
60 printf("Tracing to stdout\n");
65 throw runtime_error("Output is not set");
67 printf("Tracing enabled\n");
72 printf("Tracing disabled\n");
77 printf("Tracing terminated\n");
81 FILE *f = fopen(args.c_str(), "w");
83 throw runtime_error("Could not open trace file");
86 printf("Tracing to %s\n", args.c_str());