From patchwork Thu Oct 25 17:20:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53E9413A9 for ; Thu, 25 Oct 2018 17:55:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 468E42C2AC for ; Thu, 25 Oct 2018 17:55:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39FC92C2B0; Thu, 25 Oct 2018 17:55:26 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 D0FB72C2AC for ; Thu, 25 Oct 2018 17:55:25 +0000 (UTC) Received: from localhost ([::1]:56198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFjqu-0006dd-Oo for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 13:55:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFjKj-0006ix-9V for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:22:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFjKh-0000Q4-T8 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:22:09 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:34201) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFjKh-0000CD-KQ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:22:07 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 32448221EE; Thu, 25 Oct 2018 13:21:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 13:21:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mesmtp; bh=MKHat/22//I/LLXdHqd+NGCp1Wrms7QA+9XMZx05kKM=; b=NSjBMwSCffaj Ew7U2Ae8QRCfOLuhkbIEm4/LHR9vmQbhI207pXkLRjPvgMkEaBKATJutKOJaP1TR erhYfACjh5WJNjSjVsiIhNUevw4usrFDryiT2aUbiiLeYa6XqSKwJPe0R5pZcNni bos1chCMXyZHZtbVzFxpnCbUbGHEHDk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=MKHat/22//I/LLXdHqd+NGCp1Wrms7QA+9XMZx05k KM=; b=rWEqi72IRIgdIgCpi+9XsMTs4c7zQWkGlJnKzwM/jrhSyRoq4VY9M/Npd daHdeVELnKWuBOhXxDlMeGkYC4WprJ0H5eNVveFAzFZNWzHtpNCf5gyAHhG/kdT8 W2y0cOD3bnJXpxMgX8ulBxcuf1qBLCd/WFqhNeHMHDaphsRAflU/dbSYwFpP1c4x W/m3BUyyfBDpdzfri5wBtNrXoDbRC0aZsidrTFrFiihsKio7Yr5cb0nwM2AAuITM cPo3m9Pi/JwHJVcCjVn7E/Yv7MnVljA7u624JlJ/YVN/zgytMXRJ9w7fXHkSEARY nQTa1akLj/wHtt3HhDVbBUsdw/3pg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id AD998E4074; Thu, 25 Oct 2018 13:21:16 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 13:20:52 -0400 Message-Id: <20181025172057.20414-44-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025172057.20414-1-cota@braap.org> References: <20181025172057.20414-1-cota@braap.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC 43/48] linux-user: support -plugin option 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: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Llu=C3=ADs?= =?utf-8?q?_Vilanova?= , Pavel Dovgalyuk , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Lluís Vilanova Signed-off-by: Lluís Vilanova [ cota: s/instrument/plugin ] Signed-off-by: Emilio G. Cota --- linux-user/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/linux-user/main.c b/linux-user/main.c index 923cbb753a..0244ad736c 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -28,6 +28,7 @@ #include "qemu/config-file.h" #include "qemu/cutils.h" #include "qemu/help_option.h" +#include "qemu/plugin.h" #include "cpu.h" #include "exec/exec-all.h" #include "tcg.h" @@ -385,6 +386,15 @@ static void handle_arg_trace(const char *arg) trace_file = trace_opt_parse(arg); } +static struct qemu_plugin_list plugins = QTAILQ_HEAD_INITIALIZER(plugins); + +#ifdef CONFIG_PLUGINS +static void handle_arg_plugin(const char *arg) +{ + qemu_plugin_opt_parse(arg, &plugins); +} +#endif + struct qemu_argument { const char *argv; const char *env; @@ -436,6 +446,10 @@ static const struct qemu_argument arg_table[] = { "", "Seed for pseudo-random number generator"}, {"trace", "QEMU_TRACE", true, handle_arg_trace, "", "[[enable=]][,events=][,file=]"}, +#ifdef CONFIG_PLUGINS + {"plugin", "QEMU_PLUGIN", true, handle_arg_plugin, + "", "[file=][,arg=]"}, +#endif {"version", "QEMU_VERSION", false, handle_arg_version, "", "display version information and exit"}, {NULL, NULL, false, NULL, NULL, NULL} @@ -627,6 +641,7 @@ int main(int argc, char **argv, char **envp) srand(time(NULL)); qemu_add_opts(&qemu_trace_opts); + qemu_plugin_add_opts(); optind = parse_args(argc, argv); @@ -634,6 +649,9 @@ int main(int argc, char **argv, char **envp) exit(1); } trace_init_file(trace_file); + if (qemu_plugin_load_list(&plugins)) { + exit(1); + } /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs));