From patchwork Wed Sep 13 10:17:54 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: 813312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xsd0v1LSNz9sBW for ; Wed, 13 Sep 2017 20:18:39 +1000 (AEST) Received: from localhost ([::1]:41352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds4ke-0000y7-5r for incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 06:18:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds4kE-0000wR-PO for qemu-devel@nongnu.org; Wed, 13 Sep 2017 06:18:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ds4k8-0000u7-Ma for qemu-devel@nongnu.org; Wed, 13 Sep 2017 06:18:10 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:33743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds4k8-0000tl-BY for qemu-devel@nongnu.org; Wed, 13 Sep 2017 06:18:04 -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 v8DAI1xq008422; Wed, 13 Sep 2017 12:18:01 +0200 Received: from localhost (unknown [132.68.137.204]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id E87C73A4; Wed, 13 Sep 2017 12:17:55 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 13 Sep 2017 13:17:54 +0300 Message-Id: <150529787476.10902.6384634683395635747.stgit@frigg.lan> X-Mailer: git-send-email 2.14.1 In-Reply-To: <150529642278.10902.18234057937634437857.stgit@frigg.lan> References: <150529642278.10902.18234057937634437857.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 v8DAI1xq008422 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 v6 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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) {