From patchwork Fri Jul 15 17:08:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 9232331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CAB3F6075D for ; Fri, 15 Jul 2016 17:10:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBA4E27F94 for ; Fri, 15 Jul 2016 17:10:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B04E227FB6; Fri, 15 Jul 2016 17:10:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 57EC227F94 for ; Fri, 15 Jul 2016 17:10:37 +0000 (UTC) Received: from localhost ([::1]:33923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO6dI-00009D-D8 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jul 2016 13:10:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO6bY-0007Vc-U9 for qemu-devel@nongnu.org; Fri, 15 Jul 2016 13:08:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bO6bU-0004yo-Lo for qemu-devel@nongnu.org; Fri, 15 Jul 2016 13:08:47 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:36866 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO6bU-0004yb-9Q for qemu-devel@nongnu.org; Fri, 15 Jul 2016 13:08:44 -0400 Received: from gw-3.ac.upc.es (gw-3.ac.upc.es [147.83.30.9]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u6FH8hN1020068; Fri, 15 Jul 2016 19:08:43 +0200 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id 7CDF41F5; Fri, 15 Jul 2016 19:08:43 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Fri, 15 Jul 2016 19:08:43 +0200 Message-Id: <146860252322.30668.18276041739086338328.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 2.8.1 In-Reply-To: <146860251243.30668.5165413432802957512.stgit@fimbulvetr.bsc.es> References: <146860251243.30668.5165413432802957512.stgit@fimbulvetr.bsc.es> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id u6FH8hN1020068 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH v3 2/2] trace: [bsd-user] Commandline arguments to control tracing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: LluĂ­s Vilanova --- 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=]][,events=][,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));