qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Lluís <xscript@gmx.net>
Cc: qemu-devel@nongnu.org, chouteau@adacore.com
Subject: Re: [Qemu-devel] [PATCH v5 02/10] trace: avoid conditional code compilation during option parsing
Date: Fri, 15 Jul 2011 10:41:11 +0100	[thread overview]
Message-ID: <20110715094111.GC6856@stefanha-thinkpad.localdomain> (raw)
In-Reply-To: <20110628165308.23482.66207.stgit@ginnungagap.bsc.es>

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

  reply	other threads:[~2011-07-15  9:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-28 16:52 [Qemu-devel] [PATCH v5 00/10] trace-state: make the behaviour of "disable" consistent across all backends Lluís
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 01/10] trace: move backend-specific code into the trace/ directory Lluís
2011-07-15  9:40   ` Stefan Hajnoczi
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 02/10] trace: avoid conditional code compilation during option parsing Lluís
2011-07-15  9:41   ` Stefan Hajnoczi [this message]
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 03/10] trace: generalize the "property" concept in the trace-events file Lluís
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 04/10] trace-state: separate trace event control and query routines from the simple backend Lluís
2011-07-15  9:41   ` Stefan Hajnoczi
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 05/10] trace-state: always compile support for controlling and querying trace event states Lluís
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 06/10] trace-state: add "-trace events" argument to control initial state Lluís
2011-07-15  9:40   ` Stefan Hajnoczi
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 07/10] trace-state: always use the "nop" backend on events with the "disable" keyword Lluís
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 08/10] trace-state: [simple] disable all trace points by default Lluís
2011-06-28 16:53 ` [Qemu-devel] [PATCH v5 09/10] trace-state: [stderr] add support for dynamically enabling/disabling events Lluís
2011-06-28 16:54 ` [Qemu-devel] [PATCH v5 10/10] trace: enable all events Lluís
2011-07-12 18:04 ` [Qemu-devel] [PATCH v5 00/10] trace-state: make the behaviour of "disable" consistent across all backends Stefan Hajnoczi
2011-07-15  9:47 ` Stefan Hajnoczi
2011-07-20 19:19   ` Lluís

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110715094111.GC6856@stefanha-thinkpad.localdomain \
    --to=stefanha@gmail.com \
    --cc=chouteau@adacore.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xscript@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).