On Tue, Jun 28, 2011 at 06:53:08PM +0200, Lluís wrote: > diff --git a/vl.c b/vl.c > index b2f41fd..b766dc7 100644 > --- a/vl.c > +++ b/vl.c > @@ -2861,14 +2861,23 @@ int main(int argc, char **argv, char **envp) > } > xen_mode = XEN_ATTACH; > break; > -#ifdef CONFIG_SIMPLE_TRACE > case QEMU_OPTION_trace: > opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0); > - if (opts) { > - trace_file = qemu_opt_get(opts, "file"); > + if (!opts) { > + exit(1); > } > - break; > +#if defined(CONFIG_TRACE_NOP) > + fprintf(stderr, "qemu: option \"-%s\" is not supported by > this tracing backend\n", popt->name); > + exit(1); > #endif > + trace_file = qemu_opt_get(opts, "file"); > +#if !defined(CONFIG_SIMPLE_TRACE) > + if (trace_file) { > + fprintf(stderr, "qemu: suboption \"-%s file\" is not > supported by this tracing backend\n", popt->name); > + exit(1); > + } > +#endif
This doesn't account for other trace backends. For example with dtrace or ust the option would be compiled in and not rejected at runtime. Instead of checking all possible trace backend CONFIG_* we could always compile the -trace option in. Specific backends can validate their options (if used). This approach will not reject unused options but it's simple and doesn't use #ifdefs. Stefan