From patchwork Mon Oct 14 10:49:31 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: 176199 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4401088ill; Mon, 14 Oct 2019 04:48:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiPboN5bZXvxKuTKdOvfs6wKaY+kKvHjua5o7q4IPlBIcuhdAdYSWTyYtx7laKY0aD5fuL X-Received: by 2002:ac8:1c34:: with SMTP id a49mr32695368qtk.184.1571053680039; Mon, 14 Oct 2019 04:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571053680; cv=none; d=google.com; s=arc-20160816; b=aeb8tznAekDJnwxkV/EVF/daoSQtT/gJ8Q/0NtRBZeU+wLR0i7y3SbZMUeGewva7/4 bhiyhZrEg1qcoxTRjU5PYKFCeI23T9UanBtAi7xpWUnGp8QeyaoADsAmqOp39FbKTR00 NN0y9Wt19e3Z/zDs7v4hgOL/2RZsZHS+d9B72Tc5dhq7E6rxL38rnrq+Q1Pr57vvPorx HTWo/Q/WLShpIWTmrCSFQzlC7dyLkIzvV9abQmIv/G4sPklOIynUvW4hPk1h+8hF9Kty VIQdr/uCEeUkhkhTygAQl9/8wYQrPzkB4bV1dB1y36SRAouvn3ddFi9ChidMQNR+LgdI fJcg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=j9VLj7yufnPKaz6aaA2SbuwWsfLmWj3MLD1Awwtmne8=; b=07/kijS0hSmEj24PskyrpvMys/zqlWIlxsXYrXCXp6BOZa4hCvFY6Fqn0N2AqMas6H EWCKTNzwysruT79wzEu26i+N2luveIkSFmeXUIe1nlCyELgOLceZI1mzwhKP26PloqLJ 6AFP6sXgvFOJOTNoNOcib5wxp7WipMuhofEBXof97YQNusyWJKSJzNmx2EHwvIF0CveM sDYcmdKUx5E/SpRgh3vCGq6G+yvs7VrhDfD5a1aitcYTCPxFbHmbq4U0yb1CAXAgY4Si u9YgCnToMhcXItSjYLsNoHWVHrdT44fvZxvlhtAOOJeqEVqT8Kw0B4XEP3UeORLwJ9hc RepQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="oecO6g/3"; 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 l55si18918956qta.288.2019.10.14.04.47.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Oct 2019 04:48:00 -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="oecO6g/3"; 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]:48118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJypT-0003KV-Ha for patch@linaro.org; Mon, 14 Oct 2019 07:47:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46862) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJyCA-000842-CN for qemu-devel@nongnu.org; Mon, 14 Oct 2019 07:07:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJyC9-0007gk-2k for qemu-devel@nongnu.org; Mon, 14 Oct 2019 07:07:22 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:37598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJyC8-0007fZ-Sr for qemu-devel@nongnu.org; Mon, 14 Oct 2019 07:07:21 -0400 Received: by mail-wr1-x444.google.com with SMTP id p14so19204004wro.4 for ; Mon, 14 Oct 2019 04:07:20 -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=j9VLj7yufnPKaz6aaA2SbuwWsfLmWj3MLD1Awwtmne8=; b=oecO6g/3JdU/4TFoiyt63qfh/TjovK1lLUNBurXi88JoRRRNlCJR+waZSAZ6ypma9Y cIMvk/4JZciOdKM4dv9ThBtpNNltPafWLDaoH/OjkZOv8prhs71wseAL1TyDas083Qpw FlADygF/xNXa1g8GzCtjyOuAUwN3ezTyHiC27NhL78W6NbgItdjI8xlHpyrt4zot7y9j lIz9wOD7FbtjKNvxJmn8I6Y4OwQKtbDpqFSTBd7YKChZ4omA/FpG7PI2ruvxmE+mzNZk NWr/RStHsuBFMiwHpH+zChnZY7XFsRAa0jyFgIyvzpwtVZNKv6bHCCDm0FC261RN/c+I Yb4w== 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=j9VLj7yufnPKaz6aaA2SbuwWsfLmWj3MLD1Awwtmne8=; b=HHDS2Ljt4bI3v4XCkF1OCgfDczXV4v5YieFDmqwFGhlNUaBTEHc1DXNZFePvJOPKUZ axBoyjvisEdQxCtLWv5jaGGzXjTiPXB3WPFXGwG8muvs1a/jCFoBmiPvDJbX89Nxn6jZ mQUR4N4a2iW1/Al64xRtnkwm0dd+s++IU5kNxtnvJcJky33UtktycEzcix5MzaBai8P2 ICxlCKhRcP7+/CQhDpu2f6ze13UISMzqT6/5almVNH5rc43EAGTjYSgYgPVqh0S8LGo5 K5gwhwEQFWuzMaQvzLIEIVdzq9AhEcpKhGVkRUJs5JBDa4olbbnR0uoY9cR+KKTdhIQ9 APXQ== X-Gm-Message-State: APjAAAXadql5YK3ynerJfIzbvvgM3tpNtSvCGDCjTM2Xa4fRvvgmN+7Y 1t+w22x8H5PUcZQK3g8Fe2yeRA== X-Received: by 2002:adf:f4c2:: with SMTP id h2mr25955533wrp.69.1571051239774; Mon, 14 Oct 2019 04:07:19 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f18sm16911737wrv.38.2019.10.14.04.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 04:07:17 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8C54B1FFC7; Mon, 14 Oct 2019 11:49:57 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v5 38/55] linux-user: support -plugin option Date: Mon, 14 Oct 2019 11:49:31 +0100 Message-Id: <20191014104948.4291-39-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014104948.4291-1-alex.bennee@linaro.org> References: <20191014104948.4291-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 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: robert.foley@futurewei.com, Riku Voipio , Richard Henderson , Laurent Vivier , peter.puhov@futurewei.com, aaron@os.amperecomputing.com, cota@braap.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , =?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 560d053f72..6ff7851e86 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -34,6 +34,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" @@ -398,6 +399,15 @@ static void handle_arg_abi_call0(const char *arg) } #endif +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; @@ -449,6 +459,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"}, #if defined(TARGET_XTENSA) @@ -643,6 +657,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); @@ -650,6 +665,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));