From patchwork Fri Jun 17 13:48:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 9184205 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 5DCD86075D for ; Fri, 17 Jun 2016 14:49:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F65F280DE for ; Fri, 17 Jun 2016 14:49:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 548C6283A9; Fri, 17 Jun 2016 14:49:21 +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 CA6B1280DE for ; Fri, 17 Jun 2016 14:49:20 +0000 (UTC) Received: from localhost ([::1]:58085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDv5D-0003xJ-Nj for patchwork-qemu-devel@patchwork.kernel.org; Fri, 17 Jun 2016 10:49:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDu8z-0001c5-BF for qemu-devel@nongnu.org; Fri, 17 Jun 2016 09:49:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDu8w-00020v-51 for qemu-devel@nongnu.org; Fri, 17 Jun 2016 09:49:07 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:32137 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDu8f-0001uP-PM; Fri, 17 Jun 2016 09:48:50 -0400 Received: from irbis.sw.ru ([10.30.2.139]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u5HDmWbS015635; Fri, 17 Jun 2016 16:48:41 +0300 (MSK) From: "Denis V. Lunev" To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Fri, 17 Jun 2016 16:48:29 +0300 Message-Id: <1466171312-23195-5-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1466171312-23195-1-git-send-email-den@openvz.org> References: <1466171312-23195-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 4/7] trace: enable tracing in qemu-io 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: Kevin Wolf , den@openvz.org, Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Moving trace_init_backends() into trace_opt_parse() is not possible. This should be called after daemonize() in vl.c. Signed-off-by: Denis V. Lunev Reviewed-by: Eric Blake CC: Paolo Bonzini CC: Stefan Hajnoczi CC: Kevin Wolf --- qemu-io.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index d977a6e..0ef28b0 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -18,6 +18,7 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/readline.h" +#include "qemu/log.h" #include "qapi/qmp/qstring.h" #include "qom/object_interfaces.h" #include "sysemu/block-backend.h" @@ -253,7 +254,9 @@ static void usage(const char *name) " -k, --native-aio use kernel AIO implementation (on Linux only)\n" " -t, --cache=MODE use the given cache mode for the image\n" " -d, --discard=MODE use the given discard mode for the image\n" -" -T, --trace FILE enable trace events listed in the given file\n" +" -T, --trace [[enable=]][,events=][,file=]\n" +" specify tracing options\n" +" see qemu-img(1) man page for full description\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n" "\n" @@ -458,6 +461,7 @@ int main(int argc, char **argv) Error *local_error = NULL; QDict *opts = NULL; const char *format = NULL; + char *trace_file = NULL; #ifdef CONFIG_POSIX signal(SIGPIPE, SIG_IGN); @@ -470,6 +474,7 @@ int main(int argc, char **argv) module_call_init(MODULE_INIT_QOM); qemu_add_opts(&qemu_object_opts); + qemu_add_opts(&qemu_trace_opts); bdrv_init(); while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) { @@ -509,9 +514,7 @@ int main(int argc, char **argv) } break; case 'T': - if (!trace_init_backends()) { - exit(1); /* error message will have been printed */ - } + trace_file = trace_opt_parse(optarg, trace_file); break; case 'V': printf("%s version %s\n", progname, QEMU_VERSION); @@ -557,6 +560,12 @@ int main(int argc, char **argv) exit(1); } + if (!trace_init_backends()) { + exit(1); + } + trace_init_file(trace_file); + qemu_set_log(LOG_TRACE); + /* initialize commands */ qemuio_add_command(&quit_cmd); qemuio_add_command(&open_cmd);