From patchwork Wed Jul 31 16:07:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 170163 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4226572ile; Wed, 31 Jul 2019 09:19:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnehTW/JD654f7NvNNvZkhVLzxUA/AHRlhYX1Sb5jojSu+VJAUvIVkrgAPPj3AdhszZCqZ X-Received: by 2002:ac8:2f96:: with SMTP id l22mr87120898qta.188.1564589997559; Wed, 31 Jul 2019 09:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564589997; cv=none; d=google.com; s=arc-20160816; b=JiU43RM3QdiMTEyWsZE71VmuBC3Vn9/iKOPitpGhYgkqKeZuB5e/FGwXTdkBQw5iAQ kfgQqjTRo2zKNoyjyop7RjSCTzGpc37b0Mr72c98/sL985xWohGpEyr0yytmzPFSokNp QM3NVeBTQJ++WOGnnl7SkEUa8QYceeGTFxtudmBkN8ViWfZ0kNyMee+GcMgFnbOuO4aG jNEAOobTBSZ8Xd/nVqjnUMC4Z3mQ9gpkCneLkeYvH9kp8Mci2hTsWO1yZe2zHfjVjfSM D0Vc28Jpr7KGKsL8LgbrwspKzIpRy5xdzgOkdnlqBcIbgGpZKhk0uunAaP5xHNlEJ1v0 QEZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ETn84aVwzraVZR/ukzhhM5DHZ0Q2gcDn01igaexosx0=; b=aketXqksdN7n0Way+DGDh4Da92+K5ANcpesEyudMP/gQudWs1aAKyQ6ij0QH03mDCT 77mxGsUsZY0Xg6suVKjQU/J7f7rAJvPWEcntn7nDITTTBqvFYn/ctbkR/oU5Srgmbfn0 yJizGuNFtZopf7z9B8TodK6u/Ca7WP99m24XIU7EZWim/EY99px9w0wBdyx2hWpT6pcF kcwvRa6ST0K0ay0sOnVbUMgnrAC4G1ng09AHQYd258mHaMQZekz55kNA0N9nXXvMqHsg 2wrnPCd9GZ5F8CmGZzaDcnZqgC5r8ZCg43R4CNKeK6EBvFVLKRPUwe1SspDNGJ0oUEf5 LZVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IXVI1UXY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s16si22523623qkg.242.2019.07.31.09.19.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 09:19:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IXVI1UXY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrKX-00077i-6z for patch@linaro.org; Wed, 31 Jul 2019 12:19:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42322) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrG5-0005pH-Ng for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:15:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsrG1-000475-Os for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:15:19 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:33696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsrFz-00045J-R9 for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:15:17 -0400 Received: by mail-wr1-x444.google.com with SMTP id n9so70435911wru.0 for ; Wed, 31 Jul 2019 09:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ETn84aVwzraVZR/ukzhhM5DHZ0Q2gcDn01igaexosx0=; b=IXVI1UXYGYFOZ9jKBjjo/7x0/5Ula4rEgEDzcFYTcVYscj+i1zbqbhNxiX0fo8JAvu 2RcwY8m5MgfpX/zX/lLdeZL6mvvvQCbfZoHfURxRe44hPBhbtO5Hqodi53cnVEPwV3dK pZWO2rSB7Q+6jI1zFjbaodmMdDf4Wyc7uqoBOVGNyvksNCYJ7TVNLkCxl4HnU3NaQRcf F1ApoJSMzdwD4SrjL6GdkBY92p1+CI/NIJXDB6xY3UaFjlqi5AneOL+gAzm3YPYemv3u gf4AEjbHV5a/u9n6GDzt9bPPdJVro0Y5Jz52g6+Zgol0763C5A3FIfG9h3/98kOWSHsc duJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ETn84aVwzraVZR/ukzhhM5DHZ0Q2gcDn01igaexosx0=; b=pZcgfX6XmX2FSGHKO6HgIWXZ7Gnaht8hihEfWoKH6KdPGfiX0wRjSfbmF2/8fZMGZl Do0hI/vVHim72xiqpHUP1YdrWVrqdXCP2mDPHDva5/Q21Fx8I6VierrAHcaGx0PEjqvL IsAok8MEzfpP2trnKzuDGHyx0RY5t8NOiaCpY96tXwjWsjsHW0gJDi0lNK4bfTtzNo05 Az7Ma8aV6P7qyUgpk9vYPmChH7S0tVhFxWnnxT+hi1XGjKeG3/ay0nSBGyxtCBE7MsTu v/wb7aJubRd4+av7Xuc/mnP5F4NhiaVjpO0LSgkmhofnqL7j0iKZ920bP56HkTJF594g hGbw== X-Gm-Message-State: APjAAAUfmNC3GjJpWCxXd/E3BT7PdRNgi55rj/z5Lp1FYlbzue4kcHZm aCZr+8ZQlLbsx4IzZ8IjCFfpvQ== X-Received: by 2002:adf:e705:: with SMTP id c5mr87792253wrm.270.1564589713239; Wed, 31 Jul 2019 09:15:13 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l2sm46111132wmj.4.2019.07.31.09.15.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 09:15:12 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 9FE611FFC3; Wed, 31 Jul 2019 17:07:23 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 17:07:10 +0100 Message-Id: <20190731160719.11396-46-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731160719.11396-1-alex.bennee@linaro.org> References: <20190731160719.11396-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v4 45/54] linux-user: support -plugin option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Richard Henderson , Laurent Vivier , aaron@os.amperecomputing.com, cota@braap.org, bobby.prani@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Llu=C3=ADs_Vilanova?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Lluís Vilanova Signed-off-by: Lluís Vilanova [ cota: s/instrument/plugin ] Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- linux-user/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.20.1 diff --git a/linux-user/main.c b/linux-user/main.c index 8ffc5251955..42daa47dd3c 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -33,6 +33,7 @@ #include "qemu/error-report.h" #include "qemu/help_option.h" #include "qemu/module.h" +#include "qemu/plugin.h" #include "cpu.h" #include "exec/exec-all.h" #include "tcg.h" @@ -392,6 +393,15 @@ static void handle_arg_trace(const char *arg) trace_file = trace_opt_parse(arg); } +static QemuPluginList plugins = QTAILQ_HEAD_INITIALIZER(plugins); + +#ifdef CONFIG_PLUGIN +static void handle_arg_plugin(const char *arg) +{ + qemu_plugin_opt_parse(arg, &plugins); +} +#endif + struct qemu_argument { const char *argv; const char *env; @@ -443,6 +453,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_PLUGIN + {"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} @@ -633,6 +647,7 @@ int main(int argc, char **argv, char **envp) cpu_model = NULL; qemu_add_opts(&qemu_trace_opts); + qemu_plugin_add_opts(); optind = parse_args(argc, argv); @@ -640,6 +655,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));