From nobody Sat Apr 5 07:17:26 2025 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1738010936; cv=none; d=zohomail.com; s=zohoarc; b=R5/eWR+WB/vXbAwi3X/eS4fo/adb8key+nzKDMmp+aRQSmlx6zbYVyLW0jbSVoOlB4g5NoKayVPsBn/HunAydU+ejDZ1IvTkJ1J122zpj8TKatqpD+fL5F62V+6zlwI1TvmuvD3L0s0h/eAQNzJATJa3/dkgG0qVZfabF3JqZIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738010936; 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=WcKTGMMiTjZZht9zvN7I639YNhzuzVFjcTQBn6ctpVY=; b=LcTw37494gmY4zL8m5ySkzyJUeTQDOroe+ySPXpor+a/80jxeWU8RmxaQTFAoOB5WRbO+ud7tzRZAPPgKU2pZjKsgfTR6uVpyEZ/ve3fr9MmYfkKEmzUsu7TGzFNR8K4sAscORIMGTzc8yqmRoAazk9PZx6z0YFjR+bx84+v8WE= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738010936760204.2979288320438; Mon, 27 Jan 2025 12:48:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tcW28-0005aS-O5; Mon, 27 Jan 2025 15:48:37 -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 1tcVYD-0006gh-CN for qemu-devel@nongnu.org; Mon, 27 Jan 2025 15:17:42 -0500 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tcVYA-0000UX-OO for qemu-devel@nongnu.org; Mon, 27 Jan 2025 15:17:40 -0500 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-4679eacf25cso28325941cf.3 for ; Mon, 27 Jan 2025 12:17:38 -0800 (PST) Received: from luke-igloo.. ([18.4.85.124]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46e668636e5sm42601081cf.4.2025.01.27.12.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 12:17:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738009057; x=1738613857; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WcKTGMMiTjZZht9zvN7I639YNhzuzVFjcTQBn6ctpVY=; b=HOqBmzuv9YbRb6elYMMF/SfwRNORm7vewrSfT+91i02CUBAb+2ysBvSVlT6D24AsXA H5zUA88NztEyNDln9/d8DNzdFjqcozakhfYdHNJ3om+2XDVsWQCH4K6f0VPu/DM891xy gvEVp5ndXCfcX3DC5XBgjDjJEfrI2qLF7TH+0n7/5Aumt94PfMhj1dJ6FJr1ZHAh2SmV CCYEeZDbaDTYnF2jswwLtgXoB8FQcobklJGwQfPyZgx0HCbEpgVv8z1ROZJuonWtQ8qY k0RfDOO2LXWLeOMsmziM8I8ToOcVHvGcSGrc4sn31Vh/jTsVJLYoyfsoGWc9Lb3q+Hez 2MNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738009057; x=1738613857; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WcKTGMMiTjZZht9zvN7I639YNhzuzVFjcTQBn6ctpVY=; b=mmwffjpe6tlUtzHAcGGLMGlOSY9H2kI8jxBOseUaMuF3ITKDQ2i+Dki8SiRRESpJtg N4110BZA7b67qmu4x4pyOMZhdDWxBSlzUOAlNmB7S6ssC0rKz2mfYMzm5Gal3H2HBSE9 AF4PX627j6MrL5C8S9srmMxeJgnWoFbjkk7JOQ5t7Wx3GjA/kN3CDsgHdBfbyeR89c/m hnmt34odMba3PuucdenFMRSb6lLVCyM9eKEz83T0NHhQc6hwt79qts1DL4DQRZ4ZuSTm Qd4EFoh+lpQYbFnji8vKX1rY8gMTyGFzp4L/K/yBKG+ZW3oYz2RK6Vcl/8JopUEuaYh9 RlXg== X-Gm-Message-State: AOJu0YwsKOnm2UqgpqMtodmqeU/H314sT2oORj952ubu1qRWSz+F2TV8 c7e7LVF+PoKoZGuCrgAz3FDWlahi6iuWR5DNE9Km6LSeDZTsiRpIT1Bfw1sf X-Gm-Gg: ASbGncsD+6KZ/Ec88JkhTZFr11SRMgXjO44CPV0pHuhh1LsDnkdBMMBzZCxEnlAhikp y/Uhrz62qc3iuEO8DruGjJrBnQ6bly8C2xWX9UXOKOvvt3ndQQkm2lavdlgvz3QwHn5cpiEoxRa EhDSsO02bRMhO1Q0Xy2CQYFArOqTJN6GzJOGrOwzzbrZtXPAB8T/CPq1bMAGw7QT2534wUEvvrs btOw4y93OTzEFzo7iOodAQhPmiEm8F4Nrz5Wci95mOX7eaMRZXCP+xKHdFysxcxxw7JX0fnZoGX X-Google-Smtp-Source: AGHT+IGs76o6hwvNVVabsf2sPFIcodGALqJHGphFjIbC8Ps2ENXLhVDGa8OaPQDZfMOZNVk5joTEBg== X-Received: by 2002:ac8:7608:0:b0:46e:548f:ab8d with SMTP id d75a77b69052e-46e548fad8amr289542651cf.37.1738009057164; Mon, 27 Jan 2025 12:17:37 -0800 (PST) From: Luke Craig To: qemu-devel@nongnu.org Cc: Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Luke Craig Subject: [PATCH 1/2] plugin: extend API with qemu_plugin_tb_get_insn_by_vaddr Date: Mon, 27 Jan 2025 15:17:33 -0500 Message-Id: <20250127201734.1769540-2-lacraig3@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250127201734.1769540-1-lacraig3@gmail.com> References: <20250127201734.1769540-1-lacraig3@gmail.com> 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=2607:f8b0:4864:20::836; envelope-from=lacraig3@gmail.com; helo=mail-qt1-x836.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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-Mailman-Approved-At: Mon, 27 Jan 2025 15:48:33 -0500 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 @gmail.com) X-ZM-MESSAGEID: 1738010938360019000 Content-Type: text/plain; charset="utf-8" --- include/qemu/qemu-plugin.h | 11 +++++++++++ plugins/api.c | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 3a850aa216..a1c478c54f 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -500,6 +500,17 @@ QEMU_PLUGIN_API struct qemu_plugin_insn * qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx); =20 +/** + * qemu_plugin_tb_get_insn_by_vaddr() - lookup handle for instruction by v= addr + * @tb: opaque handle to TB passed to callback + * @vaddr: virtual address of instruction + * + * Returns: opaque handle to instruction + */ +QEMU_PLUGIN_API +struct qemu_plugin_insn * +qemu_plugin_tb_get_insn_by_vaddr(const struct qemu_plugin_tb *tb, uint64_t= vaddr); + /** * qemu_plugin_insn_data() - copy instruction data * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() diff --git a/plugins/api.c b/plugins/api.c index 4110cfaa23..7ff5e1c1bd 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -258,6 +258,19 @@ qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *t= b, size_t idx) return insn; } =20 +struct qemu_plugin_insn * +qemu_plugin_tb_get_insn_by_vaddr(const struct qemu_plugin_tb *tb, uint64_t= vaddr) +{ + struct qemu_plugin_insn *insn; + for (size_t i =3D 0; i < tb->n; i++){ + insn =3D g_ptr_array_index(tb->insns, idx); + if (insn !=3D NULL && insn->vaddr =3D=3D vaddr){ + return insn; + } + } + return NULL; +} + /* * Instruction information * --=20 2.34.1 From nobody Sat Apr 5 07:17:26 2025 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1738010958; cv=none; d=zohomail.com; s=zohoarc; b=l7U+16I8lhQa4YPnCc+894nGpwHxMv1hh9UdBtte/NB2fG4VTsBJjfgX6XOhF1lDCIQq0NBG+c+9cODVLaYYdx6DH3Fn6KnR54cfrTmFshTERLQGPvUd4F3Da3cXx3GUnYhkwrs1lkbwle6vmsUHdKmIslM2S1yS9H0bZHoUN6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738010958; 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=YrPftONXk3GzsFDMQyrnwK7mxsH9D1E2c7v5NO85doA=; b=RGy7v0Y1d+/8eLCKx9InY/gSHkAY2xV5aJaasb4yjUE0dwSVveHyQOi9gRACGdyU8fpR0NFU+vKGlb5AyCD4QZtPsn/W2x/BjV6fNNaGIXolv9O9Nl31s7yob9ZtafnSCZuYK75RmFrgf98Bk8jq+MoCdZD+hV8VoMvGfVP6htw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173801095870154.05023497571642; Mon, 27 Jan 2025 12:49:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tcW2F-0005dB-O6; Mon, 27 Jan 2025 15:48:43 -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 1tcVYE-0006hH-GL for qemu-devel@nongnu.org; Mon, 27 Jan 2025 15:17:43 -0500 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tcVYB-0000Un-8I for qemu-devel@nongnu.org; Mon, 27 Jan 2025 15:17:41 -0500 Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-467a17055e6so53725531cf.3 for ; Mon, 27 Jan 2025 12:17:38 -0800 (PST) Received: from luke-igloo.. ([18.4.85.124]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46e668636e5sm42601081cf.4.2025.01.27.12.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 12:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738009058; x=1738613858; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YrPftONXk3GzsFDMQyrnwK7mxsH9D1E2c7v5NO85doA=; b=O70/eyY6pIDgvvZRMkovOF2cMzHUFLQKMa9LQfiEIGTJjIQDFjCUj/hyP3jWiCDMT7 RwHn9StHyg7qqV5e2kEqvvXEh3qdKDTlUqX2MWtoy9+8vPcSETrgAIziRzAPiYGG69AP p+4sovpFtX0JVbQKoX8TbEKsk1Na+13dtLmFfnU98nrmH9vfbGflTCn9mFOXmlZB21HI aCx/8HJXdsjV/wgxPPIGmuQg9HsLykvD0l1IyVr0+ZNaKRSiLPRiq1wUkn0XQV+E64Fa AeKeg3Bz8cNjm2SE2b/N79XoSEaEPHP9eABo1/pnqQoEwd8gzYRFn2r1l0UZ5453NsaL pQ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738009058; x=1738613858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YrPftONXk3GzsFDMQyrnwK7mxsH9D1E2c7v5NO85doA=; b=tE9X5DRGwQR/i2sQoimzN6XuGAktIIgWkSGTIoCFWztDy2zLALmkqWmaoYYCFtJrmC q5lCuCsNzOjoKkNfxW0XLYAUoJYPv286gzToboacyVRV79IYWYU98bMg2AAqE/1wQpBK fayTfsX+na7va+1sUq1SAZPk/9cX89zh763Iy8QFl8HBYWfpWugBggEd35u09XbpbrG4 Yz4kMOvMTnmG3ribLqZDExcwAmACLWHg59UPyQmrWpFJtTNDDzs00exr6kamT8EieM/Y fbHygegFDHNyuC+swtTMHiGwE+dYkHCFYjdskGCdvwus/GlOXP6W+00Ijl6OXXIfYaA3 OxIQ== X-Gm-Message-State: AOJu0YzDsHPUlDOAo+lTQbYES3/+JJnzrhPJ3qmhzNlnZuahFykusM1p HQvx4OD4cpK2G1lWBJGeE2cjUdB9yNuQukaTpo75UYzb0W8GTENMyhnWVtvq X-Gm-Gg: ASbGncvBy9v+SOYTCoAFzcskvSKFc47wSu9JgqrBWkQRDhkhZmqxSevbMLEc6tvdzSf /21Vv0fUpN8tourFMKg3Q6UPfvTHwfNPIgbQZkDN1s8qEviZUTFkPQ08JdhpwjnzOuPWdsMf79L J4gFXnbyL9NWuY/F29ZsRB4pRT0UZ6sBS/Ls5yphpMS9KD82UUea4pN3LlD5HHQzJevmGzI+nWt DcrqKRKFO/c/EzM8MvrpFG3TOP4y3X9q3jNIKuLSNNPATAwAoeLM5dXe+KxoFWfu+JMQaWW89TX X-Google-Smtp-Source: AGHT+IFHu7n0kzv/4FfvnulW3Q9HJrZXrs0KScjWoUJI6Hf5SwXwrrRAfEmGIB05/PdsiY90tl0sWw== X-Received: by 2002:ac8:5ac1:0:b0:46c:7646:4a29 with SMTP id d75a77b69052e-46e12a8727cmr643033001cf.29.1738009057943; Mon, 27 Jan 2025 12:17:37 -0800 (PST) From: Luke Craig To: qemu-devel@nongnu.org Cc: Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Luke Craig Subject: [PATCH 2/2] plugin: extend API with qemu_plugin_tb_size Date: Mon, 27 Jan 2025 15:17:34 -0500 Message-Id: <20250127201734.1769540-3-lacraig3@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250127201734.1769540-1-lacraig3@gmail.com> References: <20250127201734.1769540-1-lacraig3@gmail.com> 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=2607:f8b0:4864:20::829; envelope-from=lacraig3@gmail.com; helo=mail-qt1-x829.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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-Mailman-Approved-At: Mon, 27 Jan 2025 15:48:33 -0500 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 @gmail.com) X-ZM-MESSAGEID: 1738010960653019000 Content-Type: text/plain; charset="utf-8" --- include/qemu/qemu-plugin.h | 10 ++++++++++ plugins/api.c | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index a1c478c54f..1fa656da82 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -476,6 +476,16 @@ void qemu_plugin_register_vcpu_insn_exec_inline_per_vc= pu( QEMU_PLUGIN_API size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb *tb); =20 +/** + * qemu_plugin_tb_size() - query helper for size of TB + * @tb: opaque handle to TB passed to callback + *=20 + * Returns: size of block in bytes + */ + +QEMU_PLUGIN_API +size_t qemu_plugin_tb_size(const struct qemu_plugin_tb *tb); + /** * qemu_plugin_tb_vaddr() - query helper for vaddr of TB start * @tb: opaque handle to TB passed to callback diff --git a/plugins/api.c b/plugins/api.c index 7ff5e1c1bd..177f0ac9b6 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -241,6 +241,11 @@ size_t qemu_plugin_tb_n_insns(const struct qemu_plugin= _tb *tb) return tb->n; } =20 +size_t qemu_plugin_tb_size(const struct qemu_plugin_tb *tb){ + const DisasContextBase *db =3D tcg_ctx->plugin_db; + return db->size; +} + uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb) { const DisasContextBase *db =3D tcg_ctx->plugin_db; --=20 2.34.1