From patchwork Fri Oct 25 06:36:58 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: 177655 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3269342ill; Fri, 25 Oct 2019 00:17:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxS5unYjJ8C8d6fnOKs8nS4iDFZ2WtX4h9/uZZVpLbWRdN9NK0PnYvxztqrkea9AKaboiR5 X-Received: by 2002:a0c:9adf:: with SMTP id k31mr1864678qvf.126.1571987834482; Fri, 25 Oct 2019 00:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571987834; cv=none; d=google.com; s=arc-20160816; b=A5iPftZOU05SV/Mxk3QxOmUvElDKNQSpsw+Q2C9HjQc6B/HU+n6s2Pe+CYllHIX7SZ HETIdn6iXDwSDHmgACPntYU1c1GSpyt5nb4Z4MoCmoNwmtpOwLceOQa8NOBM5Hg2bG1b KXwtdwUcdx5bFVO7Gvs6+IJMNZBO8MLVlZUf+JE4TsRun59BHUVKl1YDrhIIB0s6ZYzq lOqojxKRgFj05A3vzU630yNMIi4exZ6EcCWbAVty1TSswodvBVdwnPXBPgfm6EMnJvhT bo53dfBO9vmVB/RuWDgqw30X2SJE2c0BBaZcKb3Tg+VyMTRRK1qAiscTH/rjkhX7Jrv0 bPLw== 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=iCdf3P82phD9cLVEW6A0PP5pJmmTk2IWDOwxH2phJBw=; b=HE8pH84qGcUGFCQBmSn05D+eDfDtWF4WT5zxDa8IgicCt3WVM7x7XH1t1pOXXoyQ2J Y4ywoorx57lfiSrbGn54+9aNLuRDnSPuwqs81VYWywaneuk39gwbKuQo3yr7Wxa7jtHH wamkcq/PvagNteuNdcDfUEiv9zeKdgSAzgrRN0PzgeUnXN4O6i9VRh3Bk6lHYM4XN4Hi lsI8fBpMTIxTBJ6oMNXCSg1LKu6njs3A4BTU58Tjn7QlNuWGb9rQOs1PSBze+XPYtUtz L9x5yjQIHuMV5r72JRN9fWDRtvpodDDc6Rc5txNu0KV4NhV/YnVBaR96zJPneihUT4hl aKyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="P/uo3G+x"; 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 bx17si829421qvb.80.2019.10.25.00.17.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Oct 2019 00:17:14 -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="P/uo3G+x"; 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]:56518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtqS-00049z-W4 for patch@linaro.org; Fri, 25 Oct 2019 03:17:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37104) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtN8-00089g-U9 for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNtN7-0003IV-KF for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:54 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:54513) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNtN6-0003Cm-Jf for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:52 -0400 Received: by mail-wm1-x32c.google.com with SMTP id g7so778259wmk.4 for ; Thu, 24 Oct 2019 23:46:46 -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=iCdf3P82phD9cLVEW6A0PP5pJmmTk2IWDOwxH2phJBw=; b=P/uo3G+xBuax0OH+AqwxRCHg2F6MbPdJClHZ68Q34hwsPmTMKFpQHZMe3gnPWLIZVv 84l4Pgwh0HrepgBrI4AgC+7I6vupapCGWDeTi3AS6azb97RVLEVBmmud5AsBXIn95CAy 1YTd30xobH9CPRYcwZudGLeBhMtzA7ZEIUSquvGdtXn6QdV2iz2sqZjSYeWBuOv/OkUk XfJ2N7PjyAXER01NmDgW9WRrmLZEo0If73AqXSpOv9CuM+UZ+l+sS5B1u6u46Ti1dFCD q14Ek2AkBg3nYvmrMsz42ffBQbW8RAlXWUGDhBKBtkDKjl9+IaEb7PTHkbseK5FJ6+3T TOAw== 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=iCdf3P82phD9cLVEW6A0PP5pJmmTk2IWDOwxH2phJBw=; b=IaxRdgLbmubY/yRavAkTyexwomsnsuIn9L/+9YvUPzKkvPkUPlXKSlMI4AHDfrC5gv T0YU3seLnLvzWbuuxTBEB0dvqrPoxSn5wU46RXHcV2aNYAwPIbKufITtn0M01gCDgPtY Q/T6zTltNLfmW8nH3fNqZBaaQmgoLkUsJkGuV/T/6019n1vbZ2sM4CPF/2yC2jPhcOl7 ls2Ko5WmuKho3B1ZmyYSwiKiAbRhWe+XGYnvUDNrm71yMUmWdFn5pNlKWNNumj1s1opk DNcTitEJZ0W34C3tr0rVmuGgKfeoTMBq3J1eSqyjGONb+ZMxaSUyDzCtVW0vxo94w1mR lx7A== X-Gm-Message-State: APjAAAXuPolUzgIN3CyKa/GKt5p46ERFeODQXlfpsU8gWLELk9TIMSmL Uh9uCLicc/phAuGTfbaeTM74uQ== X-Received: by 2002:a05:600c:2943:: with SMTP id n3mr1804990wmd.11.1571986005504; Thu, 24 Oct 2019 23:46:45 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w22sm1170795wmc.16.2019.10.24.23.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 23:46:42 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 31ACC1FF91; Fri, 25 Oct 2019 07:37:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 58/73] linux-user: support -plugin option Date: Fri, 25 Oct 2019 07:36:58 +0100 Message-Id: <20191025063713.23374-59-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191025063713.23374-1-alex.bennee@linaro.org> References: <20191025063713.23374-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::32c 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 , qemu-devel@nongnu.org, Laurent Vivier , "Emilio G . Cota" , =?utf-8?q?Al?= =?utf-8?q?ex_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 -- 2.20.1 diff --git a/linux-user/main.c b/linux-user/main.c index 560d053f724..6ff7851e86f 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));