From patchwork Tue Sep 12 21:25:56 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: 9950167 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 BAF45602C9 for ; Tue, 12 Sep 2017 21:27:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC96A28A86 for ; Tue, 12 Sep 2017 21:27:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA9B1290CF; Tue, 12 Sep 2017 21:27:12 +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 3BFD1290DF for ; Tue, 12 Sep 2017 21:27:09 +0000 (UTC) Received: from localhost ([::1]:38681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drsi4-00074U-CM for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Sep 2017 17:27:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drshA-00073A-3s for qemu-devel@nongnu.org; Tue, 12 Sep 2017 17:26:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drsh5-0007Eh-OR for qemu-devel@nongnu.org; Tue, 12 Sep 2017 17:26:12 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:47898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drsh5-0007Dn-CD for qemu-devel@nongnu.org; Tue, 12 Sep 2017 17:26:07 -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 v8CLQ3ER022266; Tue, 12 Sep 2017 23:26:03 +0200 Received: from localhost (unknown [31.210.187.58]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id 554C425B; Tue, 12 Sep 2017 23:25:57 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 13 Sep 2017 00:25:56 +0300 Message-Id: <150525155585.15988.1048249945691112897.stgit@frigg.lan> X-Mailer: git-send-email 2.14.1 In-Reply-To: <150525010239.15988.8172586618197849619.stgit@frigg.lan> References: <150525010239.15988.8172586618197849619.stgit@frigg.lan> User-Agent: StGit/0.18 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id v8CLQ3ER022266 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 v5 06/22] 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" , Markus Armbruster , 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 | 19 +++++++++++++++++++ vl.c | 15 +++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 9f6e2adfff..6947388aab 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4077,6 +4077,25 @@ HXCOMM HX does not support conditional compilation of text. @findex -trace @include qemu-option-trace.texi ETEXI +#if defined(CONFIG_INSTRUMENT) +DEF("instr", HAS_ARG, QEMU_OPTION_instr, + "-instr [file=][,arg=]\n" + " load an instrumentation library\n", + QEMU_ARCH_ALL) +#endif +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 fb1f05b937..aea05ed4cc 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" @@ -3037,6 +3038,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); @@ -3064,6 +3068,9 @@ 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); +#if defined(CONFIG_INSTRUMENT) + qemu_add_opts(&qemu_instr_opts); +#endif qemu_add_opts(&qemu_option_rom_opts); qemu_add_opts(&qemu_machine_opts); qemu_add_opts(&qemu_accel_opts); @@ -4009,6 +4016,12 @@ int main(int argc, char **argv, char **envp) g_free(trace_file); trace_file = trace_opt_parse(optarg); break; +#if defined(CONFIG_INSTRUMENT) + case QEMU_OPTION_instr: + instr_opt_parse(optarg, &instrument_path, + &instrument_argc, &instrument_argv); + break; +#endif case QEMU_OPTION_readconfig: { int ret = qemu_read_config_file(optarg); @@ -4196,6 +4209,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) {