+ if(args.empty() || args=="-")
+ {
+ set_output(stdout, false);
+ printf("Tracing to stdout\n");
+ }
+ else if(args=="on")
+ {
+ if(!out)
+ throw runtime_error("Output is not set");
+ enabled = true;
+ printf("Tracing enabled\n");
+ }
+ else if(args=="off")
+ {
+ enabled = false;
+ printf("Tracing disabled\n");
+ }
+ else if(args=="end")
+ {
+ set_output(0, true);
+ printf("Tracing terminated\n");
+ }
+ else
+ {
+ FILE *f = fopen(args.c_str(), "w");
+ if(!f)
+ throw runtime_error("Could not open trace file");