From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47976 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OsdPX-00057Q-Cw for qemu-devel@nongnu.org; Mon, 06 Sep 2010 11:15:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OsdPN-0003yr-VH for qemu-devel@nongnu.org; Mon, 06 Sep 2010 11:15:07 -0400 Received: from mtagate5.de.ibm.com ([195.212.17.165]:55762) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OsdPN-0003xk-HB for qemu-devel@nongnu.org; Mon, 06 Sep 2010 11:14:57 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate5.de.ibm.com (8.13.1/8.13.1) with ESMTP id o86FEt6q005337 for ; Mon, 6 Sep 2010 15:14:55 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o86FErnF3891446 for ; Mon, 6 Sep 2010 17:14:55 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o86FErZ5018108 for ; Mon, 6 Sep 2010 17:14:53 +0200 From: Stefan Hajnoczi Date: Mon, 6 Sep 2010 16:14:04 +0100 Message-Id: <1283786051-29530-8-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1283786051-29530-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1283786051-29530-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 07/14] trace: Add trace file name command-line option List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , Anthony Liguori , "Michael S. Tsirkin" , Stefan Hajnoczi , Prerna Saxena 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-config.c | 18 ++++++++++++++++++ qemu-options.hx | 11 +++++++++++ vl.c | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+), 0 deletions(-) diff --git a/qemu-config.c b/qemu-config.c index 3abe655..394ac2d 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -288,6 +288,21 @@ static QemuOptsList qemu_mon_opts = { }, }; +#ifdef CONFIG_SIMPLE_TRACE +static QemuOptsList qemu_trace_opts = { + .name = "trace", + .implied_opt_name = "trace", + .head = QTAILQ_HEAD_INITIALIZER(qemu_trace_opts.head), + .desc = { + { + .name = "file", + .type = QEMU_OPT_STRING, + }, + { /* end if list */ } + }, +}; +#endif + static QemuOptsList qemu_cpudef_opts = { .name = "cpudef", .head = QTAILQ_HEAD_INITIALIZER(qemu_cpudef_opts.head), @@ -346,6 +361,9 @@ static QemuOptsList *vm_config_groups[32] = { &qemu_global_opts, &qemu_mon_opts, &qemu_cpudef_opts, +#ifdef CONFIG_SIMPLE_TRACE + &qemu_trace_opts, +#endif NULL, }; diff --git a/qemu-options.hx b/qemu-options.hx index 453f129..0589906 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2230,6 +2230,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 bd05e39..8df784a 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__) @@ -1823,6 +1827,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]); @@ -2595,6 +2602,14 @@ 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"); + } + break; +#endif case QEMU_OPTION_readconfig: { int ret = qemu_read_config_file(optarg); @@ -2638,6 +2653,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. -- 1.7.1