All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Mahmoud Mandour" <ma.mandourr@gmail.com>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Cc: qemu-devel@nongnu.org, deller@gmx.de,
	Sven Schnelle <svens@stackframe.org>
Subject: [PATCH 2/4] plugins/execlog: pass matches array to parse_vaddr_match
Date: Wed, 28 Feb 2024 21:02:09 +0100	[thread overview]
Message-ID: <20240228200211.1512816-3-svens@stackframe.org> (raw)
In-Reply-To: <20240228200211.1512816-1-svens@stackframe.org>

Pass the matches array to parse_vaddr_match(), so future address
matches can reuse that function.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 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);
 }
 
-static void parse_vaddr_match(char *match)
+static void parse_vaddr_match(GArray **matches, char *match)
 {
     uint64_t v = g_ascii_strtoull(match, NULL, 16);
 
-    if (!amatches) {
-        amatches = g_array_new(false, true, sizeof(uint64_t));
+    if (!matches) {
+        *matches = g_array_new(false, true, sizeof(uint64_t));
     }
-    g_array_append_val(amatches, v);
+    g_array_append_val(*matches, v);
 }
 
 /**
@@ -239,7 +239,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
         if (g_strcmp0(tokens[0], "ifilter") == 0) {
             parse_insn_match(tokens[1]);
         } else if (g_strcmp0(tokens[0], "afilter") == 0) {
-            parse_vaddr_match(tokens[1]);
+            parse_vaddr_match(&amatches, tokens[1]);
         } else {
             fprintf(stderr, "option parsing failed: %s\n", opt);
             return -1;
-- 
2.43.2



  parent reply	other threads:[~2024-02-28 20:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 20:02 [PATCH 0/4] plugins/execlog: add data address match and address range support Sven Schnelle
2024-02-28 20:02 ` [PATCH 1/4] plugins/execlog: add struct execlog_ctx Sven Schnelle
2024-02-28 20:02 ` Sven Schnelle [this message]
2024-02-28 20:02 ` [PATCH 3/4] plugins/execlog: add data address match Sven Schnelle
2024-02-28 20:02 ` [PATCH 4/4] plugins/execlog: add address range matching Sven Schnelle
2024-02-29  6:05 ` [PATCH 0/4] plugins/execlog: add data address match and address range support Pierrick Bouvier
2024-02-29 15:09   ` Sven Schnelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240228200211.1512816-3-svens@stackframe.org \
    --to=svens@stackframe.org \
    --cc=alex.bennee@linaro.org \
    --cc=deller@gmx.de \
    --cc=erdnaxe@crans.org \
    --cc=ma.mandourr@gmail.com \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.