Patchwork [Tracing,v2] Process -trace using QemuOptsList

login
register
mail settings
Submitter Prerna Saxena
Date Aug. 27, 2010, 11:23 a.m.
Message ID <20100827165315.4cd2a0c9@zephyr>
Download mbox | patch
Permalink /patch/62848/
State New
Headers show

Comments

Prerna Saxena - Aug. 27, 2010, 11:23 a.m.
[PATCH] Add -trace file FILENAME switch to qemu startup command.
 This processes the argument using QemuOptsList


Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
---
 qemu-config.c |   18 ++++++++++++++++++
 qemu-config.h |    3 +++
 vl.c          |    5 ++++-
 3 files changed, 25 insertions(+), 1 deletions(-)
Stefan Hajnoczi - Aug. 27, 2010, 2:10 p.m.
On Fri, Aug 27, 2010 at 04:53:15PM +0530, Prerna Saxena wrote:
> [PATCH] Add -trace file FILENAME switch to qemu startup command.
>  This processes the argument using QemuOptsList
> 
> 
> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>

Thanks, I will merge this for tracing v2.

Stefan

Patch

diff --git a/qemu-config.c b/qemu-config.c
index 95abe61..9106511 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -294,6 +294,21 @@  QemuOptsList qemu_mon_opts = {
     },
 };
 
+#ifdef CONFIG_SIMPLE_TRACE
+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
+
 QemuOptsList qemu_cpudef_opts = {
     .name = "cpudef",
     .head = QTAILQ_HEAD_INITIALIZER(qemu_cpudef_opts.head),
@@ -352,6 +367,9 @@  static QemuOptsList *vm_config_groups[] = {
     &qemu_global_opts,
     &qemu_mon_opts,
     &qemu_cpudef_opts,
+#ifdef CONFIG_SIMPLE_TRACE
+    &qemu_trace_opts,
+#endif
     NULL,
 };
 
diff --git a/qemu-config.h b/qemu-config.h
index dca69d4..4db2fb5 100644
--- a/qemu-config.h
+++ b/qemu-config.h
@@ -14,6 +14,9 @@  extern QemuOptsList qemu_rtc_opts;
 extern QemuOptsList qemu_global_opts;
 extern QemuOptsList qemu_mon_opts;
 extern QemuOptsList qemu_cpudef_opts;
+#ifdef CONFIG_SIMPLE_TRACE
+extern QemuOptsList qemu_trace_opts;
+#endif
 
 QemuOptsList *qemu_find_opts(const char *group);
 int qemu_set_option(const char *str);
diff --git a/vl.c b/vl.c
index 99664e9..0ff04e9 100644
--- a/vl.c
+++ b/vl.c
@@ -2599,7 +2599,10 @@  int main(int argc, char **argv, char **envp)
                 break;
 #ifdef CONFIG_SIMPLE_TRACE
             case QEMU_OPTION_trace:
-                trace_file = optarg;
+                opts = qemu_opts_parse(&qemu_trace_opts, optarg, 0);
+                if (opts) {
+                    trace_file = qemu_opt_get(opts, "file");
+                }
                 break;
 #endif
             case QEMU_OPTION_readconfig: