qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 2/2] trace: [bsd-user] Commandline arguments to c


From: Lluís Vilanova
Subject: [Qemu-devel] [PATCH v3 2/2] trace: [bsd-user] Commandline arguments to control tracing
Date: Fri, 15 Jul 2016 19:08:43 +0200
User-agent: StGit/0.17.1-dirty

Signed-off-by: Lluís Vilanova <address@hidden>
---
 bsd-user/main.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 4819b9e..3bef796 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -21,6 +21,7 @@
 
 #include "qapi/error.h"
 #include "qemu.h"
+#include "qemu/config-file.h"
 #include "qemu/path.h"
 #include "qemu/help_option.h"
 /* For tb_lock */
@@ -30,6 +31,8 @@
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
 #include "exec/log.h"
+#include "trace/control.h"
+#include "glib-compat.h"
 
 int singlestep;
 unsigned long mmap_min_addr;
@@ -687,6 +690,8 @@ static void usage(void)
            "-p pagesize       set the host page size to 'pagesize'\n"
            "-singlestep       always run in singlestep mode\n"
            "-strace           log system calls\n"
+           "-trace            
[[enable=]<pattern>][,events=<file>][,file=<file>]\n"
+           "                  specify tracing options\n"
            "\n"
            "Environment variables:\n"
            "QEMU_STRACE       Print system calls and arguments similar to 
the\n"
@@ -735,6 +740,7 @@ int main(int argc, char **argv)
     int gdbstub_port = 0;
     char **target_environ, **wrk;
     envlist_t *envlist = NULL;
+    const char *trace_file = NULL;
     bsd_type = target_openbsd;
 
     if (argc <= 1)
@@ -754,6 +760,8 @@ int main(int argc, char **argv)
 
     cpu_model = NULL;
 
+    qemu_add_opts(&qemu_trace_opts);
+
     optind = 1;
     for(;;) {
         if (optind >= argc)
@@ -840,6 +848,9 @@ int main(int argc, char **argv)
             singlestep = 1;
         } else if (!strcmp(r, "strace")) {
             do_strace = 1;
+        } else if (!strcmp(r, "trace")) {
+            g_free(trace_file);
+            trace_file = trace_opt_parse(optarg);
         } else
         {
             usage();
@@ -865,6 +876,11 @@ int main(int argc, char **argv)
     }
     filename = argv[optind];
 
+    if (!trace_init_backends()) {
+        exit(1);
+    }
+    trace_init_file(trace_file);
+
     /* Zero out regs */
     memset(regs, 0, sizeof(struct target_pt_regs));
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]