From patchwork Mon Jul 24 17:42:48 2017 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: 9859965 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 F37FF60385 for ; Mon, 24 Jul 2017 17:43:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0F3027F85 for ; Mon, 24 Jul 2017 17:43:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4A0228111; Mon, 24 Jul 2017 17:43:43 +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 3BBB227F85 for ; Mon, 24 Jul 2017 17:43:42 +0000 (UTC) Received: from localhost ([::1]:56140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZhOJ-0002E5-C5 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Jul 2017 13:43:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZhNl-0002E0-R5 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 13:43:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZhNi-0002fY-Ke for qemu-devel@nongnu.org; Mon, 24 Jul 2017 13:43:01 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:38522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZhNi-0002eX-89 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 13:42:58 -0400 Received: from correu-2.ac.upc.es (correu-2.ac.upc.es [147.83.30.92]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v6OHgtK5000533; Mon, 24 Jul 2017 19:42:55 +0200 Received: from localhost (unknown [31.210.188.120]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id 72140358; Mon, 24 Jul 2017 19:42:49 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 20:42:48 +0300 Message-Id: <150091816800.30739.7702589627052162702.stgit@frigg.lan> X-Mailer: git-send-email 2.13.2 In-Reply-To: <150091574424.30739.4131793221953168474.stgit@frigg.lan> References: <150091574424.30739.4131793221953168474.stgit@frigg.lan> 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 v6OHgtK5000533 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH 10/13] instrument: [softmmu] Add command line library loader 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: Paolo Bonzini , "Emilio G. Cota" , 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 --- qemu-options.hx | 17 +++++++++++++++++ vl.c | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 9bd6bf0eee..aacd01cee7 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4064,6 +4064,23 @@ HXCOMM HX does not support conditional compilation of text. @findex -trace @include qemu-option-trace.texi ETEXI +DEF("instr", HAS_ARG, QEMU_OPTION_instr, + "-instr [file=][,arg=]\n" + " load an instrumentation library\n", + QEMU_ARCH_ALL) +STEXI +@item -instr file=@var{file}[,arg=@var{string}] +@findex -instr + +Load a dynamic trace instrumentation library. + +@table @option +@item file=@var{file} +Load the given dynamic trace instrumentation library. +@item arg=@var{string} +String argument passed as to the library's @code{qi_init} routine (can be given multiple times). +@end table +ETEXI HXCOMM Internal use DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL) diff --git a/vl.c b/vl.c index fb6b2efafa..1a24b34d47 100644 --- a/vl.c +++ b/vl.c @@ -118,6 +118,7 @@ int main(int argc, char **argv) #include "trace-root.h" #include "trace/control.h" +#include "instrument/cmdline.h" #include "qemu/queue.h" #include "sysemu/arch_init.h" @@ -3031,6 +3032,9 @@ int main(int argc, char **argv, char **envp) } BlockdevOptions_queue; QSIMPLEQ_HEAD(, BlockdevOptions_queue) bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue); + char *instrument_path = NULL; + int instrument_argc = 0; + const char **instrument_argv = NULL; module_call_init(MODULE_INIT_TRACE); @@ -3058,6 +3062,7 @@ int main(int argc, char **argv, char **envp) qemu_add_opts(&qemu_global_opts); qemu_add_opts(&qemu_mon_opts); qemu_add_opts(&qemu_trace_opts); + qemu_add_opts(&qemu_instr_opts); qemu_add_opts(&qemu_option_rom_opts); qemu_add_opts(&qemu_machine_opts); qemu_add_opts(&qemu_accel_opts); @@ -3999,6 +4004,10 @@ int main(int argc, char **argv, char **envp) g_free(trace_file); trace_file = trace_opt_parse(optarg); break; + case QEMU_OPTION_instr: + instr_opt_parse(optarg, &instrument_path, + &instrument_argc, &instrument_argv); + break; case QEMU_OPTION_readconfig: { int ret = qemu_read_config_file(optarg); @@ -4185,6 +4194,8 @@ int main(int argc, char **argv, char **envp) } trace_init_file(trace_file); + instr_init(instrument_path, instrument_argc, instrument_argv); + /* Open the logfile at this point and set the log mask if necessary. */ if (log_file) {