From nobody Tue Nov 26 06:50:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) ARC-Seal: i=3; a=rsa-sha256; t=1709150621; cv=pass; d=zohomail.com; s=zohoarc; b=Lkp3QCKx50th6iRZEchJ+kHGvKRHfqRlrfJiSuAUBKfaSXn2jwcrMc3+qKmN3ZvnhSmpWxyNZzICqbZTVnxqZf7aN+mc0OjWkRYAAtfLitofkpXu12YOfDGjPBuHnuh5JWvVyc5l7CNAKCXJhiKSxGzcME+0OgZmO9YO23vb8cI= ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709150621; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zzOEiQj7obGsHCQd9xyo6jp7AhLHL7sbZGnf3tSSs7Q=; b=i7gW7BomuqGYMaBu4/LHXnUysueloO3bTS9O/R+O4iUhz1fYnDDoUjsQKTV4oX01fESZVw5b1geIk4T5dnMMK6yvsOJKH8WTCI5b0NHt9+w0mYa4OXP/Ybd62DTWJ1atbDWfNOBvo0pLNxnjnGQhcoQzH0V9BWc6KyMIswijeVM= ARC-Authentication-Results: i=3; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709150621218288.8972669142162; Wed, 28 Feb 2024 12:03:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfQ8p-0003h6-3W; Wed, 28 Feb 2024 15:02:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8l-0003gX-DS for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:56 -0500 Received: from catfish.pear.relay.mailchannels.net ([23.83.216.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8j-0008GI-BT for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:55 -0500 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 638BFC18EF for ; Wed, 28 Feb 2024 20:02:48 +0000 (UTC) Received: from outbound5e.eu.mailhop.org (unknown [127.0.0.6]) (Authenticated sender: duocircle) by relay.mailchannels.net (Postfix) with ESMTPA id B6F72C19BB for ; Wed, 28 Feb 2024 20:02:47 +0000 (UTC) Received: from outbound5e.eu.mailhop.org (outbound5e.eu.mailhop.org [52.28.168.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.116.14.15 (trex/6.9.2); Wed, 28 Feb 2024 20:02:48 +0000 Received: from mail.duncanthrax.net (mail.duncanthrax.net [130.180.31.158]) by outbound2.eu.mailhop.org (Halon) with ESMTPSA id 200962ad-d674-11ee-b650-9b9d9be6ef2c; Wed, 28 Feb 2024 20:01:14 +0000 (UTC) Received: from ip-134-003-094-010.um41.pools.vodafone-ip.de ([134.3.94.10] helo=t14.stackframe.org) by mail.duncanthrax.net with esmtpa (Exim 4.96) (envelope-from ) id 1rfQ8X-000DfK-0t; Wed, 28 Feb 2024 21:02:41 +0100 X-Sender-Id: _forwarded-from|134.3.94.10 ARC-Seal: i=2; s=arc-2022; d=mailchannels.net; t=1709150568; a=rsa-sha256; cv=pass; b=QZsbbADYdaayPmW80/Agz3mDk1Fuu03ICCfsRdn+FeCOAaNjaUVdcVaXHZZ63RNuuS90R+ L7DhYUwVxUcUgQiRdozkyHZejLsN5nooUf7RkGlXJCR/bOjvqOFXHrH1ZRUVS+dddUHVt/ u/crOCkNKMwM3fWbuedG5aE5mGmAPDcW+jP8oQGQLWDS2nFOOeHfLfg8t7IYA0Y8J3Yp5T 3Uj7bxJjQcRUzCdYl89rEBgqexND0SjsiFB6rZiX011Vnei48wdX3jPWCObDJnQCJllLCu 1+EG0jbMbPYE2bkYggIEuGbh08qXJKnaLRjKqhCzuZ0Bon71mjZj4+sAZIp7wA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1709150568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zzOEiQj7obGsHCQd9xyo6jp7AhLHL7sbZGnf3tSSs7Q=; b=1wOh+PBlOTUqPQgSwsC/E7vsn0qWRvBaUi9MaJ2i7bLUS+Dfdx9F26ycuPMCRv1HcXCmWg 0LpH5lqLUrxQwJ6p/xhVhm6R8dkby3+rqhUA4CBEFfIILHTCIk/4CW856ke2yLPJA4gMOv 4NbQW53rw8UU8AnZHXSq3OqmKWaf99PNicNZ8Uz/t7VtEWbj+OOHEu/bP/qhMd8YtyXoED fuWShME5Azjni6koYOJHXW8OpoI1JTARWxKCNMcSXp4+pD1KQ2mblvQAOh3Qq7tbv33Sad eKjxlrxyFhmIEfpRDlJZOqy9+S9nkrfR3QflydxafMOpgDHe8DptAfb0mjT6cg== ARC-Authentication-Results: i=2; rspamd-55b4bfd7cb-9jm27; arc=pass ("outbound.mailhop.org:s=arc-outbound20181012:i=1"); auth=pass smtp.auth=duocircle smtp.mailfrom=svens@stackframe.org X-Sender-Id: _forwarded-from|134.3.94.10 X-MC-Relay: Forwarding X-MailChannels-SenderId: _forwarded-from|134.3.94.10 X-MailChannels-Auth-Id: duocircle X-Well-Made-Chemical: 780d60c13ad88cb4_1709150568257_3132101393 X-MC-Loop-Signature: 1709150568257:1413038961 X-MC-Ingress-Time: 1709150568257 ARC-Seal: i=1; a=rsa-sha256; t=1709150478; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=QWGJQlSDZzX8Jd+QX2B1l17NfY5JumE52Nro9ZVH20n4s6NjYqIxwNheWVh4oCZb43DqOC7a8kPx0 IEpXZfJSiZfEc/NoI/qK1MZ6oiW0HtTWGsjArSD+boq9iwFavxwAR8+AyIscRrzRHx+3QGenX3oUqK 3M9G9h9IF+jA/Na+DLwujIOSzGF0OOCnRZ5l4sSH6/TFQqA2jb/FdK4ERa6MPWRWXMUyPcc8+O8Onj dydb/W8VOskVcGjz85N+usbsmGUk0pufwlRh4MvW3PoT3pBdMcvvm9+qaIUWLa2C5ZTIwBbonExcfe UqNUsYAr1wfZy/KcN19s5dXb2xdfKJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:dkim-signature:dkim-signature:dkim-signature:from; bh=zzOEiQj7obGsHCQd9xyo6jp7AhLHL7sbZGnf3tSSs7Q=; b=WnbMJtbq7YlBqEGCKiEk6sBFl50FVLpjiDqPuDrOcrb5pIGTyD2Mo9Cum2BzB+qOBTNzJmZS05ecy vg+mqnwYDPbdcvzOZAOslt7C4DEW/Biq8t9ckzLD9z4IP1h0NBoroyK6F3axj92tMJTQixDUXDW8fD ySzqJBE3H2hqCLiu1o7arf/T3DclVYW+nR1tAo/QIQnY8F1ES3kWy59z5ljOCPCZrHvAnn2nM7Mp4F wYyC8TeNIwTTRIHmoxAxa2IaCbb0+wuCX59+w2W0WaCBtKCIgPhTfHkRp+DzaYQYwM5Sf9PGZk6MpQ wz2NU+wjJj8W4xA/lKY6ULL3k+QBCXA== ARC-Authentication-Results: i=1; outbound2.eu.mailhop.org; spf=pass smtp.mailfrom=stackframe.org smtp.remote-ip=130.180.31.158; dkim=pass header.d=stackframe.org header.s=dkim1 header.a=rsa-sha256 header.b=lIVmE7Gi; dmarc=none header.from=stackframe.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackframe.org; s=duo-1634547266507-560c42ae; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=zzOEiQj7obGsHCQd9xyo6jp7AhLHL7sbZGnf3tSSs7Q=; b=oRIcTI0VIpbuVSk2Sck+juTzqLIjrtkWeNFtYSVUHSqaYjk3iowA/HpBu/TC0qUkP8nvManrl8e0f neURGoD+a5jB7xQ+h3iA7KzSa7Yf7Rov56Ni16E+ErUXGABQxn985zawYyv3SqEy1jGtGbezgB4QK2 QpcNlND2LD+qWMVM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=zzOEiQj7obGsHCQd9xyo6jp7AhLHL7sbZGnf3tSSs7Q=; b=OVg/GO0W2BUcoN5bYe1o6OZckth2DXK5GTNU5US0w7ODvFGXawhygqbq+b/ObE1isuCp2sELTc6cg tTp45PfR+9eZQvwTxMCgtc8vLsh7cWvhhr5+260rf/it0ItGa8XQiBWsSjr0ay5jKeVAtFwP1jD2+Q 8eHfgjQKx8EEI55lZvBDikv35Sp/NYQ+I61qGsJAHdvNode+SKRl1Pf6cJC3nB7GfW5eGkE+eTSUkV egdDMUGPEh2jgikZxi9FZuNJLxJsUHBOsZAjIOTDg2/Bl+JUnLFRxs3B1Cd6TNg327BZEQ8BWR76A3 HXTpgDosE+mDF8XXt8reDAFnuSSoO5w== X-Originating-IP: 130.180.31.158 X-MHO-RoutePath: dG9ta2lzdG5lcm51 X-MHO-User: 200962ad-d674-11ee-b650-9b9d9be6ef2c X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stackframe.org; s=dkim1; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zzOEiQj7obGsHCQd9xyo6jp7AhLHL7sbZGnf3tSSs7Q=; b=lIVmE7GibGzSbJHTkupMBYN0JO cnggrtTCCyS3kwPU4hRthQniLIj6mPey2UF06S/jcQfmFd5ePon/Wqibs8Bh9LhBdNcVl+8nQOd3m A9P/V3gyFQb1WQbpTUyFFnstZQ403unECxKAZi9iGgnuAWRSmXSNf0irH5DUc38s46C2EW2BTjRfk WPpP+KXWL0QQqgcfUQqJOssvqv/b29IxnxuEzjrS3zW0ic10RZUGFwhMl10VtwkGFTkkOshryaFXW R5z1Knz3B2EARgck+hDyQ97f8Ls/OXl4WEJOdLsgycqrWpY97URmXv9VuM73ZVD8sWXcVXu7PVhuH kB+z0twQ==; From: Sven Schnelle To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier Cc: qemu-devel@nongnu.org, deller@gmx.de, Sven Schnelle Subject: [PATCH 1/4] plugins/execlog: add struct execlog_ctx Date: Wed, 28 Feb 2024 21:02:08 +0100 Message-ID: <20240228200211.1512816-2-svens@stackframe.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228200211.1512816-1-svens@stackframe.org> References: <20240228200211.1512816-1-svens@stackframe.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=23.83.216.32; envelope-from=svens@stackframe.org; helo=catfish.pear.relay.mailchannels.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @stackframe.org) X-ZM-MESSAGEID: 1709150623387100005 Content-Type: text/plain; charset="utf-8" Add a context structure for future enhancements. No functional change intended. Signed-off-by: Sven Schnelle --- contrib/plugins/execlog.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index 82dc2f584e..90da1911b2 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -24,6 +24,10 @@ static GRWLock expand_array_lock; static GPtrArray *imatches; static GArray *amatches; =20 +struct execlog_ctx { + GString *s; +}; + /* * Expand last_exec array. * @@ -34,8 +38,9 @@ static void expand_last_exec(int cpu_index) { g_rw_lock_writer_lock(&expand_array_lock); while (cpu_index >=3D last_exec->len) { - GString *s =3D g_string_new(NULL); - g_ptr_array_add(last_exec, s); + struct execlog_ctx *ctx =3D g_new(struct execlog_ctx, 1); + ctx->s =3D g_string_new(NULL); + g_ptr_array_add(last_exec, ctx); } g_rw_lock_writer_unlock(&expand_array_lock); } @@ -46,14 +51,13 @@ static void expand_last_exec(int cpu_index) static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t info, uint64_t vaddr, void *udata) { - GString *s; - /* Find vCPU in array */ g_rw_lock_reader_lock(&expand_array_lock); g_assert(cpu_index < last_exec->len); - s =3D g_ptr_array_index(last_exec, cpu_index); + struct execlog_ctx *ctx =3D g_ptr_array_index(last_exec, cpu_index); g_rw_lock_reader_unlock(&expand_array_lock); =20 + GString *s =3D ctx->s; /* Indicate type of memory access */ if (qemu_plugin_mem_is_store(info)) { g_string_append(s, ", store"); @@ -77,8 +81,6 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin_= meminfo_t info, */ static void vcpu_insn_exec(unsigned int cpu_index, void *udata) { - GString *s; - /* Find or create vCPU in array */ g_rw_lock_reader_lock(&expand_array_lock); if (cpu_index >=3D last_exec->len) { @@ -86,8 +88,9 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *= udata) expand_last_exec(cpu_index); g_rw_lock_reader_lock(&expand_array_lock); } - s =3D g_ptr_array_index(last_exec, cpu_index); + struct execlog_ctx *ctx =3D g_ptr_array_index(last_exec, cpu_index); g_rw_lock_reader_unlock(&expand_array_lock); + GString *s =3D ctx->s; =20 /* Print previous instruction in cache */ if (s->len) { @@ -183,9 +186,10 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct = qemu_plugin_tb *tb) static void plugin_exit(qemu_plugin_id_t id, void *p) { guint i; - GString *s; + for (i =3D 0; i < last_exec->len; i++) { - s =3D g_ptr_array_index(last_exec, i); + struct execlog_ctx *ctx =3D g_ptr_array_index(last_exec, i); + GString *s =3D ctx->s; if (s->str) { qemu_plugin_outs(s->str); qemu_plugin_outs("\n"); --=20 2.43.2 From nobody Tue Nov 26 06:50:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) ARC-Seal: i=3; a=rsa-sha256; t=1709150652; cv=pass; d=zohomail.com; s=zohoarc; b=feoKARRNCU4IE7dCkwQQilNP5+jHlgs9HNRSD6Jz5Jm4XmrFMOe6Z2ceFd0rP3LOsoOC22jC2gUtiIEhzVy3eyg2uB1nJVRmSy1n5asGrl8gkGgNXHoznVV6EGw0ercYkojkvgNEv+suyG/QOUlWW4vbYwj/Be046X9byCFAAOk= ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709150652; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+4BO8V8Ci+BOZk6T4aIijzbqHUwsqEFz95/F59VNM+M=; b=BPTbwBfldkSC6qLGRKVRkykPQJSGkv711Ruz4FYL7Iqn5m4vR0m5npFLcxvPeYz/pFpIqa5kw4MhMeNKIl04rKL90eVtubLutPohZexYWP/jpCal+9FytLA1ndRghcTWN5N4Rl83HJ7t40Js8gtBC09XB9JkdA04G+5avWeEuuI= ARC-Authentication-Results: i=3; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709150652570452.83171773598895; Wed, 28 Feb 2024 12:04:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfQ8s-0003iu-Oh; Wed, 28 Feb 2024 15:03:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8p-0003hH-PC for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:59 -0500 Received: from catfish.pear.relay.mailchannels.net ([23.83.216.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8j-0008HP-Cl for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:57 -0500 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E2195361FE3 for ; Wed, 28 Feb 2024 20:02:51 +0000 (UTC) Received: from outbound1g.eu.mailhop.org (unknown [127.0.0.6]) (Authenticated sender: duocircle) by relay.mailchannels.net (Postfix) with ESMTPA id 30E3E361296 for ; Wed, 28 Feb 2024 20:02:51 +0000 (UTC) Received: from outbound1g.eu.mailhop.org (outbound1g.eu.mailhop.org [52.28.6.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.112.142.242 (trex/6.9.2); Wed, 28 Feb 2024 20:02:51 +0000 Received: from mail.duncanthrax.net (mail.duncanthrax.net [130.180.31.158]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 46992af1-d674-11ee-af93-eda7e384987e; Wed, 28 Feb 2024 20:02:18 +0000 (UTC) Received: from ip-134-003-094-010.um41.pools.vodafone-ip.de ([134.3.94.10] helo=t14.stackframe.org) by mail.duncanthrax.net with esmtpa (Exim 4.96) (envelope-from ) id 1rfQ8Y-000DfK-05; Wed, 28 Feb 2024 21:02:42 +0100 X-Sender-Id: _forwarded-from|134.3.94.10 ARC-Seal: i=2; s=arc-2022; d=mailchannels.net; t=1709150571; a=rsa-sha256; cv=pass; b=gtj77va2s/LeL2kgChk6PHmtnCNKsRRGfXmb/SmiAlCHP/ftUtZq/IkpOR8vHmNJiYZgCH BkZESO7XKUXKUXbcCi/3u/fU7HUB3WTn4wGUxW5DzsGcdZZD5blH++g3eV3jRVxBDJluwu qxDpEy2XlVxp7LGFNm4T9WXYfsiM5K0HhuIPQcIw0Ya2YCW6h7hw6624/HgrYQznfFxDm8 ReQj4RYKCSEkJQ+Cqe9S61kGyYnGxqj1OYTwrMb2ihkGERoQal99Fcyb0WQAOOlpm+7ES+ C/tN7eeq9Co0VKLpFq09uyLzjZXGiw+WC02Kjqv36BuWzQXkQx8v3u1LjAQz3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1709150571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+4BO8V8Ci+BOZk6T4aIijzbqHUwsqEFz95/F59VNM+M=; b=ebSqZerwWuwBAw5R7qxXRpsIKWqiTXdEuj0+al7dU48k4Px2D+Sm+gDiuuLJMJ85iyDNkU bfWrMDDfjBVDskHU3/3WnL9nw0sJtmYl3M0R+FNr/puzi1dL6jng7ZmyMYrAgy9wH6cMNZ pm0ouPlNR5eeyKwBjYDvHHPi4/xHJxtR68yfME/A6cjyj7RcuGivNomWElvwVhrC6ORVHu FjIyWm1/VJZDOc8cvVri4p36LOSYuXty53Khx7sU3qutignVqpUszEFZRnj8SoVzZX2K+4 4juMu+TUNu/kRQU87hnMsp7dzVeyQFt8JB9hLTXHKBwDQ9gOKw99kE1tnuUNlQ== ARC-Authentication-Results: i=2; rspamd-55b4bfd7cb-jlpd4; arc=pass ("outbound.mailhop.org:s=arc-outbound20181012:i=1"); auth=pass smtp.auth=duocircle smtp.mailfrom=svens@stackframe.org X-Sender-Id: _forwarded-from|134.3.94.10 X-MC-Relay: Forwarding X-MailChannels-SenderId: _forwarded-from|134.3.94.10 X-MailChannels-Auth-Id: duocircle X-Wiry-Robust: 4fde0a5d3612acad_1709150571750_1144819986 X-MC-Loop-Signature: 1709150571750:102229620 X-MC-Ingress-Time: 1709150571750 ARC-Seal: i=1; a=rsa-sha256; t=1709150543; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=VOnMD/S2PTFtD4pVmrjdLq0PUtmPsHt5R31DTZnn/vdLWiv0fHINIz0IyjKoMeNhVGdEzvbYONrzs /ca/luRM/0uemqbICJCJ2ny7gg3YFZMDWNJmUwE8ogCn4ks1UUIB+OMLgxVJqzBkTbuAIK0ze2dtSj PaeqEpJPuKMsbkH88swrPp6iyNFJo72FKE7OVK8+kMj5hhzAbRGR3cA9DAeAlBey+dDyG8rHXeBmjF WgmFGzsRlzxXGSwArblF8n7oc3/Z2AMVzvMii9d6Wqs9GSfNZzLuRIcRJRl/j6U8oJ8zHb/7VcqlRz IfwDpVMBNkRjgEj3k0zedqSoqt6UfSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:dkim-signature:dkim-signature:dkim-signature:from; bh=+4BO8V8Ci+BOZk6T4aIijzbqHUwsqEFz95/F59VNM+M=; b=igzGFhVCbyWnWFMT5A5Sxj+35jdwsuG1INFXFVW70I59sp0nKlAd6ArG0n8eXBjbCeB4alBm/HOCL iAhP5AMN6N8gPIdakpbHqZ6ZxtJx+sVim5rbV176LZ8/cbfFPqGJ869RKR0wroq5ML2Lytc2tX5QPf UxxUupcLy4dg1LZdB+V9trfp/Yci4+En76s5gYd08mQGL3fzIknJsz2/XznLw4HaVYBpFPdxTP9l1O FMSZ9sLgQzDE4GSx7k0+FJAj+JbvUIxIETl2Kq0wi8prmm/Zl9lHTnKwPfhrN4gfX11Act1Tg/2XNP eswSPS+yrYOuSIXzoLxdDYytCdwQexg== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=pass smtp.mailfrom=stackframe.org smtp.remote-ip=130.180.31.158; dkim=pass header.d=stackframe.org header.s=dkim1 header.a=rsa-sha256 header.b=OsovQkKB; dmarc=none header.from=stackframe.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackframe.org; s=duo-1634547266507-560c42ae; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=+4BO8V8Ci+BOZk6T4aIijzbqHUwsqEFz95/F59VNM+M=; b=fUdAUvWzE1J/jQ3uDDWP1qkcuWiXZSkGIFyq2kJ3+4p8/AUmUaX4ZsqjFSiygmCzD87UES3SPK4sf VZDvVIv1h29aIIKGqw8FZ6UMkjLYS8oHf17T1fwn3TB/BlAePRDxeUXprttFQiIB0rRHzBS/sAsrjf XE5gMyQw2U4/YNE4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=+4BO8V8Ci+BOZk6T4aIijzbqHUwsqEFz95/F59VNM+M=; b=mU2c5JXEGreQ/txAkiX5tJSROQ0irJ0UCrW5TuDCHJ4EtJDibkPrz7onBgpzo+ohNzvjKv/6C5fns 7G+Owlex3Y8UL9SsOy3WjRp/c3h4x1RfOWYau84IrXd7tSr0bZ0ZAIesORbBKkByimNe3w06l2JJn2 8RYc25Muinsc8RxB15aPQiaA1AKqV+oaOtEPCcryJawGC90L9WPlrXzL3LF9spob3uD7fWsRvy6kxn oaPqSYu0caQobe4OZNOEO4Qw7DWRH/PDJSpzd24xFh5Gc3pzWyTsTj9DsWjcvALxWz164gv0l6sbnq GphkfxC6ajsRBwo4knd6ed5RAERs5SA== X-Originating-IP: 130.180.31.158 X-MHO-RoutePath: dG9ta2lzdG5lcm51 X-MHO-User: 46992af1-d674-11ee-af93-eda7e384987e X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stackframe.org; s=dkim1; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+4BO8V8Ci+BOZk6T4aIijzbqHUwsqEFz95/F59VNM+M=; b=OsovQkKBl7dGeDrGVtO5mswLHe 6p9ALMnQdxUy9RwYiFDQ9/SlieJLcP4aHjaedg9oqZdyINWC/taUpTq1zGlS0W+RyKu5kxZ8KTN/S j/NKFX5FFwGTKYQFvshAQdldl4hPpocu7VfkYl9wsqVqTQTQG4dtAE3lxHQ11A4RbW6Lj/ZH6LPe0 wyPk2qVf0BqV4TSnHjCGCWyAOCxeE4pcQXZp4/ma3numjj3qmMKiirAcaI9wkSnmdGkk2W9EbeLyZ 9dWRsqlXeVFb8xEDFkk5OnmBdQxdnblNv8T/qE4cDKExlfDg1G3UeDA4rNOzKbbFA0ocl8kL/2l9b wJLhA8TQ==; From: Sven Schnelle To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier Cc: qemu-devel@nongnu.org, deller@gmx.de, Sven Schnelle Subject: [PATCH 2/4] plugins/execlog: pass matches array to parse_vaddr_match Date: Wed, 28 Feb 2024 21:02:09 +0100 Message-ID: <20240228200211.1512816-3-svens@stackframe.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228200211.1512816-1-svens@stackframe.org> References: <20240228200211.1512816-1-svens@stackframe.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=23.83.216.32; envelope-from=svens@stackframe.org; helo=catfish.pear.relay.mailchannels.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @stackframe.org) X-ZM-MESSAGEID: 1709150653425100001 Content-Type: text/plain; charset="utf-8" Pass the matches array to parse_vaddr_match(), so future address matches can reuse that function. Signed-off-by: Sven Schnelle --- contrib/plugins/execlog.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index 90da1911b2..b4b5ba113c 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -206,14 +206,14 @@ static void parse_insn_match(char *match) g_ptr_array_add(imatches, match); } =20 -static void parse_vaddr_match(char *match) +static void parse_vaddr_match(GArray **matches, char *match) { uint64_t v =3D g_ascii_strtoull(match, NULL, 16); =20 - if (!amatches) { - amatches =3D g_array_new(false, true, sizeof(uint64_t)); + if (!matches) { + *matches =3D g_array_new(false, true, sizeof(uint64_t)); } - g_array_append_val(amatches, v); + g_array_append_val(*matches, v); } =20 /** @@ -239,7 +239,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_= id_t id, if (g_strcmp0(tokens[0], "ifilter") =3D=3D 0) { parse_insn_match(tokens[1]); } else if (g_strcmp0(tokens[0], "afilter") =3D=3D 0) { - parse_vaddr_match(tokens[1]); + parse_vaddr_match(&amatches, tokens[1]); } else { fprintf(stderr, "option parsing failed: %s\n", opt); return -1; --=20 2.43.2 From nobody Tue Nov 26 06:50:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) ARC-Seal: i=3; a=rsa-sha256; t=1709150707; cv=pass; d=zohomail.com; s=zohoarc; b=U93Kct5dJas75y6LoVEjUWYgL5gq4JflbgxrksE8g9qvU14iN3saCGxgS5+spyS7SEBSV4zJZzeWRzwOb53w58jVYacMdmLrgNsXMWGTFnq6yKfiIKVvmbVeqZIkMSuUIgOR2NVtvkqOlO+rCF6nLuUayhJ4z/LaFCrQI4qu7SM= ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709150707; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oos4cikuJWmbJP4CgPy9Uasl/Cfj6YBGD9U5hBoHh6Y=; b=P4440WxthBf7uu+7lMOBsbCR/vr774SN2ZZSO0GCxwYsp62POuCUmEO89o6PNK9lV2E5rOt7jkTtkP5G5SePyJKZ3tZqYgHMsSV6qDPC5fTbRcxPOtt937dRyFHXmZLaSPt+S/tlVjLRKFl0jrZDGt7qn01v5aNO/FZZN7ny2IA= ARC-Authentication-Results: i=3; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709150706852580.7493514294207; Wed, 28 Feb 2024 12:05:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfQ8r-0003iK-RY; Wed, 28 Feb 2024 15:03:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8m-0003gd-N0 for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:57 -0500 Received: from gorilla.birch.relay.mailchannels.net ([23.83.209.75]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8k-0008Hh-Tu for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:56 -0500 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 176CB14264D for ; Wed, 28 Feb 2024 20:02:52 +0000 (UTC) Received: from outbound5a.eu.mailhop.org (unknown [127.0.0.6]) (Authenticated sender: duocircle) by relay.mailchannels.net (Postfix) with ESMTPA id 6719514352C for ; Wed, 28 Feb 2024 20:02:51 +0000 (UTC) Received: from outbound5a.eu.mailhop.org (outbound5a.eu.mailhop.org [3.124.88.253]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.123.27.58 (trex/6.9.2); Wed, 28 Feb 2024 20:02:51 +0000 Received: from mail.duncanthrax.net (mail.duncanthrax.net [130.180.31.158]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 470be23c-d674-11ee-af93-eda7e384987e; Wed, 28 Feb 2024 20:02:19 +0000 (UTC) Received: from ip-134-003-094-010.um41.pools.vodafone-ip.de ([134.3.94.10] helo=t14.stackframe.org) by mail.duncanthrax.net with esmtpa (Exim 4.96) (envelope-from ) id 1rfQ8Y-000DfK-2V; Wed, 28 Feb 2024 21:02:42 +0100 X-Sender-Id: _forwarded-from|134.3.94.10 ARC-Seal: i=2; s=arc-2022; d=mailchannels.net; t=1709150571; a=rsa-sha256; cv=pass; b=84cXRFQ6+KiKKER74m15YT3I4v6C69rf59SGMGvdhREao3X0QITo1suHI9jrbqYpVDR3F/ wMup0xbRd4zXKZwrC0Jg4wZscNL7BXBUPQBHgDQX9a7+2JtRlOwpTJ+g58ApH5T/Vi19br X7d3ffe3+DXrEf8PSw2OjEbi4iU/JsPMhTd6PXHfKtrxWcyLZdc6q/3aoLBcMdm3HSqH6m mkRy6AnE9A9F1dntb5WkiPAvx2qSbjbu9xpj3tkUutfvtl/OkZjmuB1xMso8YjwvI4BnhY bqoxGfP4+bjVeMPuMkhHf4mcWNf+gdgaUQxAhKI/yunVBXnTxAIsQbaFXdgSWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1709150571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oos4cikuJWmbJP4CgPy9Uasl/Cfj6YBGD9U5hBoHh6Y=; b=orCNVm2v065g91v0uVMZiZ/O6oZKxAzxY4TvZFewr2uiDmuW0nFqyiDrJHeDArcbm/EG8f EVfcsUsuF73TMEQ74E0D4XrrkCB0C9xMbimewW5NpHGAazETtSVNFBtRqVXiOV6X3FpdIx 0v7oh7KhclA7n9JDbKJZHFuliO5OvutwNrsRXWn6a1ATi1bjMpqgiyylKS4R/8XHk687oN X2cQyhRJIR5slf6D9lYEd220ZfiYqVtwzpRWelTjzLKr9g5dF4bEOibiEv4V04Xj6+4SsR dqRLZOxWJD2n71H/p1wl/dwEcleo5BdvnFhi8Tt6kGEr85981U6KntSe15/HWQ== ARC-Authentication-Results: i=2; rspamd-55b4bfd7cb-94f4c; arc=pass ("outbound.mailhop.org:s=arc-outbound20181012:i=1"); auth=pass smtp.auth=duocircle smtp.mailfrom=svens@stackframe.org X-Sender-Id: _forwarded-from|134.3.94.10 X-MC-Relay: Forwarding X-MailChannels-SenderId: _forwarded-from|134.3.94.10 X-MailChannels-Auth-Id: duocircle X-Average-Shelf: 07df89a1145b3d0a_1709150571938_51297580 X-MC-Loop-Signature: 1709150571938:3905586250 X-MC-Ingress-Time: 1709150571938 ARC-Seal: i=1; a=rsa-sha256; t=1709150544; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=MTnrygKpDwXUTygrQ1UC3gD/zntVSHJCimnbf7/br2mhr74VvO7LPHdoBJXIdG7gjV1G5bH0ehM5G k4CaizE7s+ihgq56XeJB1Hh/D5uoq5yYAYa9PFWqNAE/jPpg5tny9h9aEmVd+zkuuAKvIxKNDEdPdW w4ysglHSsmnynFMBK0wX+Kbh6eyCcTHeyKqrVeqeBZaLT/QvFWFdj4cii6eoh6LsYVEfXh3dLbwFsr IK0fmcBiN66jIsXqrsHcP/3bvU7yxsQjfDgvVrUg/v9x3XKpG/24dAqJse8+jOWwBd4FD9/vFCjk5+ Iupz6AMUafZjGQpBoc0yWJBwTZPgQAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:dkim-signature:dkim-signature:dkim-signature:from; bh=oos4cikuJWmbJP4CgPy9Uasl/Cfj6YBGD9U5hBoHh6Y=; b=kSstnUcEprS6uS5QeiFbZxPnzULftVNpOz2pbRmUcyWioU31LUSLOGX66Vnt747ngOfk2iTETa+oH Qi6Dyd/oPA/j6X0V/Y9s3SQV47BM6G2LJqMIqe5t2PA+ujSG960/ZKbn7BQ8cUrziR/wzRH+JmzvZ4 NpO1Z4dVSJ2OcqzC6rlx4lgBViHLO2/FIz1VgPND3pQGAvSZTKK5cffFEbrSmEkRy32DK0XPQ0dG/r lpmcSgZBcRzw3lBaBFiGNODXzMbMvx4vRHaO1RzsLSvwuLYg9yPi76xjfBPvg/fK3+diyVTrKHplB+ XEgZ6+w53BEugBMZfFJcvC4gm6zXwhA== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=pass smtp.mailfrom=stackframe.org smtp.remote-ip=130.180.31.158; dkim=pass header.d=stackframe.org header.s=dkim1 header.a=rsa-sha256 header.b=YIvKZqI4; dmarc=none header.from=stackframe.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackframe.org; s=duo-1634547266507-560c42ae; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=oos4cikuJWmbJP4CgPy9Uasl/Cfj6YBGD9U5hBoHh6Y=; b=R8egNYkjXRSixhpy65CueWb3TGqgV5DSvY3RRQZr8S0CqmT6C7hGyJGfhH18hhha9KoevD/sxjnXi ywOUGK6ieK0Ws+GPWx2kEyLRblDacGihLlI/XoimIO97kzvCyEOagaZXcA1IjuAxa7OtNev40RBMKG UAzOx4kEeBbZpzkY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=oos4cikuJWmbJP4CgPy9Uasl/Cfj6YBGD9U5hBoHh6Y=; b=uSS6BilSElGUfBqBGI2zOZJ4bshCNLmafSc/Q9CsAqnAjsemsUFRlH4kd5D+IrrA6TjHsSmlcvk+e RTFtivZ6YVa8dIKQbuWoYqg46/LsszHxgK3C/FroAGZT+M//VayWoV/Jp0g3Ny8j/q5AYvH98fCJHf 8/LNtAAnfKatDopC7SrrLq69llYtbs3EP+JvHokuWoA/WwAvttweyedwgQa24nZ1Kygw8QEL6O0NrW 9Ab7y6ArtrUPr3eTQde3AgoHSik7fBBBMBqZix5nRwFR3cUxMauMhSVWXdEbx2/PUPNZ3s2MH8HgEv sZHwemWIRul7UDT6LiNErGXobvhr9RA== X-Originating-IP: 130.180.31.158 X-MHO-RoutePath: dG9ta2lzdG5lcm51 X-MHO-User: 470be23c-d674-11ee-af93-eda7e384987e X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stackframe.org; s=dkim1; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oos4cikuJWmbJP4CgPy9Uasl/Cfj6YBGD9U5hBoHh6Y=; b=YIvKZqI4KRliYBL1t6tLA80cje K+6YfZgFbA8wkWOxKiyN3q5LFkWEyLiINSmBCtUyQ85pkw0GgsW+7wbJ3vzDboAh8WRmscJ8RUr0p Sd7JsqOXLqEAWB3bUGwDemlplzmlvjBKYcW/dtuOyWe8lxYdYAKAGegUXoPktzQ3QdIzHhM8/jd8i OWZ1SoCbuBg1Hh3fwFu+Ufdg2YDNOM5RM8r9lqWmPtN5XyrfEUVKyLpZ8mOQq6ZuhaYujeRTj71JY 6UgAuXy0g9uSzO3IrMUQV6RTKgSbZXeasmJa2XAdw9N4f0X6Z6+tiAi4bMd2KDzcrY1aX9mfMZscO IkUZ8tZA==; From: Sven Schnelle To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier Cc: qemu-devel@nongnu.org, deller@gmx.de, Sven Schnelle Subject: [PATCH 3/4] plugins/execlog: add data address match Date: Wed, 28 Feb 2024 21:02:10 +0100 Message-ID: <20240228200211.1512816-4-svens@stackframe.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228200211.1512816-1-svens@stackframe.org> References: <20240228200211.1512816-1-svens@stackframe.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=23.83.209.75; envelope-from=svens@stackframe.org; helo=gorilla.birch.relay.mailchannels.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @stackframe.org) X-ZM-MESSAGEID: 1709150707687100001 Content-Type: text/plain; charset="utf-8" Add a match similar to the afilter address match, but for data addresses. When an address is specified with '-dfilter=3D0x12345' only load/stores to/from address 0x12345 are printed. All other instructions are hidden. Signed-off-by: Sven Schnelle --- contrib/plugins/execlog.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index b4b5ba113c..33fef9bfc6 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -23,9 +23,11 @@ static GRWLock expand_array_lock; =20 static GPtrArray *imatches; static GArray *amatches; +static GArray *dmatches; =20 struct execlog_ctx { GString *s; + bool log; }; =20 /* @@ -45,6 +47,17 @@ static void expand_last_exec(int cpu_index) g_rw_lock_writer_unlock(&expand_array_lock); } =20 +static bool match_vaddr(struct execlog_ctx *ctx, uint64_t vaddr) +{ + for (int i =3D 0; i < dmatches->len; i++) { + uint64_t v =3D g_array_index(dmatches, uint64_t, i); + if (v =3D=3D vaddr) { + ctx->log =3D true; + return true; + } + } + return false; +} /** * Add memory read or write information to current instruction log */ @@ -57,6 +70,9 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin_= meminfo_t info, struct execlog_ctx *ctx =3D g_ptr_array_index(last_exec, cpu_index); g_rw_lock_reader_unlock(&expand_array_lock); =20 + if (dmatches && !match_vaddr(ctx, vaddr)) { + return; + } GString *s =3D ctx->s; /* Indicate type of memory access */ if (qemu_plugin_mem_is_store(info)) { @@ -93,7 +109,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void = *udata) GString *s =3D ctx->s; =20 /* Print previous instruction in cache */ - if (s->len) { + if (ctx->log && s->len) { qemu_plugin_outs(s->str); qemu_plugin_outs("\n"); } @@ -102,6 +118,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void= *udata) /* vcpu_mem will add memory access information to last_exec */ g_string_printf(s, "%u, ", cpu_index); g_string_append(s, (char *)udata); + ctx->log =3D dmatches ? false : true; } =20 /** @@ -190,7 +207,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) for (i =3D 0; i < last_exec->len; i++) { struct execlog_ctx *ctx =3D g_ptr_array_index(last_exec, i); GString *s =3D ctx->s; - if (s->str) { + if (ctx->log && s->str) { qemu_plugin_outs(s->str); qemu_plugin_outs("\n"); } @@ -240,6 +257,8 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_= id_t id, parse_insn_match(tokens[1]); } else if (g_strcmp0(tokens[0], "afilter") =3D=3D 0) { parse_vaddr_match(&amatches, tokens[1]); + } else if (g_strcmp0(tokens[0], "dfilter") =3D=3D 0) { + parse_vaddr_match(&dmatches, tokens[1]); } else { fprintf(stderr, "option parsing failed: %s\n", opt); return -1; --=20 2.43.2 From nobody Tue Nov 26 06:50:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) ARC-Seal: i=3; a=rsa-sha256; t=1709150621; cv=pass; d=zohomail.com; s=zohoarc; b=SdCv29ZvW9+T5WE1x+ME3vnyirbKbxYLvPNrtsSt5F0ZMq6WTXOkaFgd34q8KB7XhvAOkfAkk0eNlwfog2Al6QqtZxU7m/sXyvUFU6RGIaK7BqJZQl0U0vkzuY0XT42QZF+umnSg/vOSJvhglY7gU9tkkBKMfM50rv9KdJRrnJk= ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709150621; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MEh3TElPIn4Ux6YSLZmqkWTrrchqIem6Xp0TObmY+Wc=; b=QDYrAtsWSbn5IEgR5NuODPvo4wi6vGsZ2a4RyHNmH2sOc8VxB9Nmo+gtulDlP8GOnttboTGeZDmYcDQHVIwpMxwAFRyIfpSjec8JSV8RKbrJL6oB9EV2hhmfq4pHIBo3oEV2pJ1tUXM9k1tgVxZQtLtfR9fdGCYmRMncjWcB3jA= ARC-Authentication-Results: i=3; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=2 dmarc=pass fromdomain=stackframe.org) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170915062146132.84172992164747; Wed, 28 Feb 2024 12:03:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfQ8q-0003iD-Ro; Wed, 28 Feb 2024 15:03:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8m-0003gc-ER for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:57 -0500 Received: from ivory.cherry.relay.mailchannels.net ([23.83.223.94]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfQ8j-0008Gv-Cv for qemu-devel@nongnu.org; Wed, 28 Feb 2024 15:02:56 -0500 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id A4D58360E47 for ; Wed, 28 Feb 2024 20:02:50 +0000 (UTC) Received: from outbound1.eu.mailhop.org (unknown [127.0.0.6]) (Authenticated sender: duocircle) by relay.mailchannels.net (Postfix) with ESMTPA id C5FC536006F for ; Wed, 28 Feb 2024 20:02:49 +0000 (UTC) Received: from outbound1.eu.mailhop.org (outbound1.eu.mailhop.org [52.28.251.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.124.220.170 (trex/6.9.2); Wed, 28 Feb 2024 20:02:50 +0000 Received: from mail.duncanthrax.net (mail.duncanthrax.net [130.180.31.158]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 4772f50e-d674-11ee-af93-eda7e384987e; Wed, 28 Feb 2024 20:02:20 +0000 (UTC) Received: from ip-134-003-094-010.um41.pools.vodafone-ip.de ([134.3.94.10] helo=t14.stackframe.org) by mail.duncanthrax.net with esmtpa (Exim 4.96) (envelope-from ) id 1rfQ8Z-000DfK-1Z; Wed, 28 Feb 2024 21:02:43 +0100 X-Sender-Id: _forwarded-from|134.3.94.10 ARC-Seal: i=2; s=arc-2022; d=mailchannels.net; t=1709150570; a=rsa-sha256; cv=pass; b=6jyYEiBqCbROTj+OuhyRtTU6oqDnqXpP+z6Xk2ky6YvPH4ouicAKyGECbuP3YI3tQ+Dkcd mZTubPvLHcGWXsawWQqHh1ThxpO/oSZFqV0XKv2cKKBZWnvYHXcwPKdUlNV7sSEs+9UfEP /Ba8mfr+o621okYqpyjNJHfVjexkYBf2GsFYpwMOPnPEaA1bv52v6q307VTWZ7DPzazHgc mPItbiiF8P4dCK6Z2h69sGHrhZj0xzvLV7CPEe5d7dBTUQes/1PW02xjxM30ReXQdeBnDB 1ixrp5QGC3RGQ3TJyXD8mjiL7WbtqCOYsJMPHfnALkSm+5F4cAtIRkzGuYxk3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1709150570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MEh3TElPIn4Ux6YSLZmqkWTrrchqIem6Xp0TObmY+Wc=; b=2SStYwK6/WS0T1PW2iszNG4Su8Yi/oyQp7L0fxDubkBMDBUF9xohX4QYhhC7DLtqibDC2o GQTHu76mHkA2ltvp/mmg0mam3JVV2F8vAfUTASblH1qVkXL1XGcVE0zaZxaPM2aTk9nype sU11DWMF2/ZJUcBCHkikwNu+dxLeIFcxjjHE9Z/cs5ggo56CiLFVxRPxtKVYy91KUDzO6E NvBZOzqInpigHNpUc37C4wln5w0h2r2HKU3LskjiymvyAPLcDQbSpVh4GRP5BmQZImksS7 gIXTRem1oGFojb3NW9MG+UuPsw1ySf/548QaNZ1ENhZwJYo2ejGoDsv9q1QBGQ== ARC-Authentication-Results: i=2; rspamd-55b4bfd7cb-zdc5v; arc=pass ("outbound.mailhop.org:s=arc-outbound20181012:i=1"); auth=pass smtp.auth=duocircle smtp.mailfrom=svens@stackframe.org X-Sender-Id: _forwarded-from|134.3.94.10 X-MC-Relay: Forwarding X-MailChannels-SenderId: _forwarded-from|134.3.94.10 X-MailChannels-Auth-Id: duocircle X-Society-Shade: 19c2208f583ba17d_1709150570386_721209793 X-MC-Loop-Signature: 1709150570386:2155191330 X-MC-Ingress-Time: 1709150570386 ARC-Seal: i=1; a=rsa-sha256; t=1709150544; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=fzGB4Anz9JoTzxlrOf4IftnZyGcSnZNThKGzVQ20j77hINHF0uxODqX4PZCrVNNgG0G+CH3WdNbEb XXjWnZ99dA7xqOEc1+3dGKWA5kTn0zlYCgS6s0x0BNhjPUd5Pb+7MpY9yD8U33pxDHkJjadd0yRruP SPvWLUB6MEIaIW8WXaAXVDDPgM1P1cRBovNrmbJUeTroWfJnNbz48i5UHjP/8EvbsGsjw+tom00Zcs u5sCkzLpxGxkVGDckpWV9ISpQCqnHqlKkKdv1rSfuONaJlCxj0ATzh1w3bxvsPTtiEDl0U+oYmurqh Xu97RXdbfFz3kamb3YGH1sXjZJMR9fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:dkim-signature:dkim-signature:dkim-signature:from; bh=MEh3TElPIn4Ux6YSLZmqkWTrrchqIem6Xp0TObmY+Wc=; b=e8Rfvdo+Se4HRT0r711O6Z83n/RCeDOo9Y4dppOdxpzzNABbFneotC1VzjsRMZD8weVkXa9F9Ft5h hbrcDkYPonasi60J6DnqZ/ZdcftGajA3zhdMH62rTdHCo3V+w/1uJkEyHts/th4kOUOzDTUpelfy9Q AjS8t3y9IFLFBuDi2oc6yl9iJf6p4Dq2Xmau15NK9gpOCb32T+k917lbOj9g0Grq9nIWJD3Tkw84/S eYUMn/sG5VOo4UxXrRQ1illHOoSSZ/+gMDl/fQ53STt0nTJSRrH4AllsVF1HshTzhTe3A/A1vjEu+u sl66tiTiE1Uh+Hb5249j0MhJYnv+zAA== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=pass smtp.mailfrom=stackframe.org smtp.remote-ip=130.180.31.158; dkim=pass header.d=stackframe.org header.s=dkim1 header.a=rsa-sha256 header.b=dMZVZnn1; dmarc=none header.from=stackframe.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stackframe.org; s=duo-1634547266507-560c42ae; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=MEh3TElPIn4Ux6YSLZmqkWTrrchqIem6Xp0TObmY+Wc=; b=q8/K9qjFdZ7SxO+xP+TU0IJFSkZ73iawiwbfIa5Ex9U/c3NXEyWnaw9IJMTzkRu0xxsZmRrv/YhEo YYlXHiuPJ0iwk2t1GNCMVugElQm5xZtWGQZFPozFksL94PfL2OCb/4Vy7Bs5ZCeLcNdXeOgUmBHhgC ELf5GyB3mwvZPDEI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=MEh3TElPIn4Ux6YSLZmqkWTrrchqIem6Xp0TObmY+Wc=; b=RSfFx32DfvB767mhdVgosteAzBqnHNASl1oUVr/Uf6A8mNxbXxvXF3qms3ED391ryU5X7o/uygfu9 SqveK9nscOwgQk3cuQqNgSSq8yX3tJkYNTsPq41gOwLea+o9PbZgqwRJoV2aWQTQIPAROmNR1biPXd j1kui34yxpL6eJQrI5wIFCV8BPVaMQPdW5V54AdrKszoi/CAOlB8GADoXE95DkiJBsfZb4N5GpkANS prbl2VMvD5PamMwJh9jQC8G2KcA5UM3bMNc/i85BXkPUszspC3OhnYYusWTDG/9SsSI8T82AX6qsth PFuC/LoOU37DZxEvUELj5uzm8iLU3vQ== X-Originating-IP: 130.180.31.158 X-MHO-RoutePath: dG9ta2lzdG5lcm51 X-MHO-User: 4772f50e-d674-11ee-af93-eda7e384987e X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stackframe.org; s=dkim1; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MEh3TElPIn4Ux6YSLZmqkWTrrchqIem6Xp0TObmY+Wc=; b=dMZVZnn1KZWoFLgxzFi1jYN0Zh ulizzZ99CdwcHDAqRwf7OtXdliT28zVHUmNQBuXORwyku6eywkKKW3axetPP1wToGTgatn3xAgMe8 2ua7ihfj4/r5aR2n3sw4eQzxDZG+gLgpobiSgoBIi9KQBxdXdGN66OE+ZCLys0uKV9K6oUi9BaqP8 SsR3hPOegKTwqL3ICjL017xX0gQE64mjdIl7YwO8lwcMR+7Vy0ZWtXadOhqgiUVrK0KBfzlgI8vFL jLd54rvPEK5XPj9qmdT6sO+Q4kLf4qhYbS73oRp0oJPnlxHEbTDPN0VLQTwhNFZ4kBHrkIZOQV265 Q8Milixg==; From: Sven Schnelle To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier Cc: qemu-devel@nongnu.org, deller@gmx.de, Sven Schnelle Subject: [PATCH 4/4] plugins/execlog: add address range matching Date: Wed, 28 Feb 2024 21:02:11 +0100 Message-ID: <20240228200211.1512816-5-svens@stackframe.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228200211.1512816-1-svens@stackframe.org> References: <20240228200211.1512816-1-svens@stackframe.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=23.83.223.94; envelope-from=svens@stackframe.org; helo=ivory.cherry.relay.mailchannels.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @stackframe.org) X-ZM-MESSAGEID: 1709150623393100006 Content-Type: text/plain; charset="utf-8" Allow to match memory ranges with the address matches. This allows to give a range of adresses like '-dfilter=3D0-0x400' which would only log memory accesses between 0 and 400. Signed-off-by: Sven Schnelle --- contrib/plugins/execlog.c | 65 +++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index 33fef9bfc6..a505f98be8 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -30,6 +30,11 @@ struct execlog_ctx { bool log; }; =20 +struct address_match { + uint64_t low; + uint64_t high; +}; + /* * Expand last_exec array. * @@ -47,17 +52,18 @@ static void expand_last_exec(int cpu_index) g_rw_lock_writer_unlock(&expand_array_lock); } =20 -static bool match_vaddr(struct execlog_ctx *ctx, uint64_t vaddr) +static bool match_address_range(GArray *match, uint64_t vaddr) { - for (int i =3D 0; i < dmatches->len; i++) { - uint64_t v =3D g_array_index(dmatches, uint64_t, i); - if (v =3D=3D vaddr) { - ctx->log =3D true; + for (int i =3D 0; i < match->len; i++) { + struct address_match *m =3D + g_array_index(match, struct address_match *, i); + if (vaddr >=3D m->low && vaddr <=3D m->high) { return true; } } return false; } + /** * Add memory read or write information to current instruction log */ @@ -70,9 +76,10 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin= _meminfo_t info, struct execlog_ctx *ctx =3D g_ptr_array_index(last_exec, cpu_index); g_rw_lock_reader_unlock(&expand_array_lock); =20 - if (dmatches && !match_vaddr(ctx, vaddr)) { + if (dmatches && !match_address_range(dmatches, vaddr)) { return; } + ctx->log =3D true; GString *s =3D ctx->s; /* Indicate type of memory access */ if (qemu_plugin_mem_is_store(info)) { @@ -166,8 +173,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct q= emu_plugin_tb *tb) if (skip && amatches) { int j; for (j =3D 0; j < amatches->len && skip; j++) { - uint64_t v =3D g_array_index(amatches, uint64_t, j); - if (v =3D=3D insn_vaddr) { + if (match_address_range(amatches, insn_vaddr)) { skip =3D false; } } @@ -197,6 +203,16 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct = qemu_plugin_tb *tb) } } =20 +static void free_matches(GArray *matches) +{ + if (!matches) { + return; + } + + for (int i =3D 0; i < matches->len; i++) { + g_free(g_array_index(matches, struct address_match *, i)); + } +} /** * On plugin exit, print last instruction in cache */ @@ -212,6 +228,9 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) qemu_plugin_outs("\n"); } } + + free_matches(amatches); + free_matches(dmatches); } =20 /* Add a match to the array of matches */ @@ -223,14 +242,34 @@ static void parse_insn_match(char *match) g_ptr_array_add(imatches, match); } =20 -static void parse_vaddr_match(GArray **matches, char *match) +static void parse_vaddr_match(GArray **matches, char *token) { - uint64_t v =3D g_ascii_strtoull(match, NULL, 16); + uint64_t low, high; + gchar *endp; =20 - if (!matches) { - *matches =3D g_array_new(false, true, sizeof(uint64_t)); + low =3D g_ascii_strtoull(token, &endp, 16); + if (endp =3D=3D token) { + fprintf(stderr, "Invalid address(range) specified: %s\n", token); + return; + } + + if (*endp !=3D '-') { + high =3D low; + } else { + high =3D g_ascii_strtoull(endp + 1, &endp, 16); + if (endp =3D=3D token) { + fprintf(stderr, "Invalid address(range) specified: %s\n", toke= n); + return; + } + } + + if (!*matches) { + *matches =3D g_array_new(false, true, sizeof(struct address_match)= ); } - g_array_append_val(*matches, v); + struct address_match *match =3D g_new(struct address_match, 1); + match->low =3D low; + match->high =3D high; + g_array_append_val(*matches, match); } =20 /** --=20 2.43.2