From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53244 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnIN2-0007H4-0W for qemu-devel@nongnu.org; Sun, 22 Aug 2010 17:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnILj-0007hA-2q for qemu-devel@nongnu.org; Sun, 22 Aug 2010 17:45:08 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:35113) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnILi-0007h4-VW for qemu-devel@nongnu.org; Sun, 22 Aug 2010 17:45:07 -0400 Received: by gwb11 with SMTP id 11so2063421gwb.4 for ; Sun, 22 Aug 2010 14:45:06 -0700 (PDT) Message-ID: <4C719A60.3050709@codemonkey.ws> Date: Sun, 22 Aug 2010 16:45:04 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 12/14] trace: Add trace file name command-line option References: <1281609395-17621-1-git-send-email-stefanha@linux.vnet.ibm.com> <1281609395-17621-13-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1281609395-17621-13-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Julien Desfossez , qemu-devel@nongnu.org, Prerna Saxena On 08/12/2010 05:36 AM, Stefan Hajnoczi wrote: > From: Prerna Saxena > > This patch adds an optional command line switch '-trace' to specify the > filename to write traces to, when qemu starts. > Eg, If compiled with the 'simple' trace backend, > [temp@system]$ qemu -trace FILENAME IMAGE > Allows the binary traces to be written to FILENAME instead of the option > set at config-time. > > Signed-off-by: Prerna Saxena > Signed-off-by: Stefan Hajnoczi > --- > qemu-options.hx | 11 +++++++++++ > vl.c | 18 ++++++++++++++++++ > 2 files changed, 29 insertions(+), 0 deletions(-) > > diff --git a/qemu-options.hx b/qemu-options.hx > index db86feb..a0c091f 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -2234,6 +2234,17 @@ Normally QEMU loads a configuration file from @var{sysconfdir}/qemu.conf and > @var{sysconfdir}/target-@var{ARCH}.conf on startup. The @code{-nodefconfig} > option will prevent QEMU from loading these configuration files at startup. > ETEXI > +#ifdef CONFIG_SIMPLE_TRACE > +DEF("trace", HAS_ARG, QEMU_OPTION_trace, > + "-trace\n" > + " Specify a trace file to log traces to\n", > + QEMU_ARCH_ALL) > +STEXI > +@item -trace > +@findex -trace > +Specify a trace file to log output traces to. > +ETEXI > +#endif > > HXCOMM This is the last statement. Insert new options before this line! > STEXI > diff --git a/vl.c b/vl.c > index b3e3676..99664e9 100644 > --- a/vl.c > +++ b/vl.c > @@ -47,6 +47,10 @@ > #include > #include > #include > +#ifdef CONFIG_SIMPLE_TRACE > +#include "trace.h" > +#endif > + > #ifdef CONFIG_BSD > #include > #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) > @@ -1821,6 +1825,9 @@ int main(int argc, char **argv, char **envp) > int show_vnc_port = 0; > int defconfig = 1; > > +#ifdef CONFIG_SIMPLE_TRACE > + const char *trace_file = NULL; > +#endif > atexit(qemu_run_exit_notifiers); > error_set_progname(argv[0]); > > @@ -2590,6 +2597,11 @@ int main(int argc, char **argv, char **envp) > } > xen_mode = XEN_ATTACH; > break; > +#ifdef CONFIG_SIMPLE_TRACE > + case QEMU_OPTION_trace: > + trace_file = optarg; > + break; > +#endif > You'll save yourself some future headaches by using a QemuOptsList to start out with. Regards, Anthony Liguori > case QEMU_OPTION_readconfig: > { > int ret = qemu_read_config_file(optarg); > @@ -2633,6 +2645,12 @@ int main(int argc, char **argv, char **envp) > data_dir = CONFIG_QEMU_DATADIR; > } > > +#ifdef CONFIG_SIMPLE_TRACE > + /* > + * Set the trace file name, if specified. > + */ > + st_set_trace_file(trace_file); > +#endif > /* > * Default to max_cpus = smp_cpus, in case the user doesn't > * specify a max_cpus value. >