[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/12] plugins/execlog: use range list api
From: |
Sven Schnelle |
Subject: |
[PATCH v3 11/12] plugins/execlog: use range list api |
Date: |
Fri, 1 Mar 2024 18:46:08 +0100 |
Instead of doing its own implementation, use the new range
list API to parse and match address lists.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
contrib/plugins/execlog.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index a1dfd59ab7..c518797893 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -35,7 +35,7 @@ static GArray *cpus;
static GRWLock expand_array_lock;
static GPtrArray *imatches;
-static GArray *amatches;
+static GList *amatches;
static GPtrArray *rmatches;
static bool disas_assist;
static GMutex add_reg_name_lock;
@@ -215,12 +215,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
}
if (skip && amatches) {
- int j;
- for (j = 0; j < amatches->len && skip; j++) {
- uint64_t v = g_array_index(amatches, uint64_t, j);
- if (v == insn_vaddr) {
- skip = false;
- }
+ if (qemu_plugin_range_list_contains(amatches, insn_vaddr)) {
+ skip = false;
}
}
@@ -398,16 +394,6 @@ static void parse_insn_match(char *match)
g_ptr_array_add(imatches, g_strdup(match));
}
-static void parse_vaddr_match(char *match)
-{
- uint64_t v = g_ascii_strtoull(match, NULL, 16);
-
- if (!amatches) {
- amatches = g_array_new(false, true, sizeof(uint64_t));
- }
- g_array_append_val(amatches, v);
-}
-
/*
* We have to wait until vCPUs are started before we can check the
* patterns find anything.
@@ -440,7 +426,12 @@ 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]);
+ Error *err = NULL;
+ qemu_plugin_range_list_from_string(&amatches, tokens[1], &err);
+ if (err) {
+ qemu_plugin_error_print(err);
+ return -1;
+ }
} else if (g_strcmp0(tokens[0], "reg") == 0) {
add_regpat(tokens[1]);
} else if (g_strcmp0(tokens[0], "rdisas") == 0) {
--
2.43.2
- [PATCH v3 05/12] util/range: use append_new_range() in range_list_from_string(), (continued)
- [PATCH v3 05/12] util/range: use append_new_range() in range_list_from_string(), Sven Schnelle, 2024/03/01
- [PATCH v3 02/12] util/log: make qemu_set_dfilter_ranges() take a GList, Sven Schnelle, 2024/03/01
- [PATCH v3 03/12] util/range: move range_list_from_string() to range.c, Sven Schnelle, 2024/03/01
- [PATCH v3 07/12] util/range: make range_list_from_string() accept a single number, Sven Schnelle, 2024/03/01
- [PATCH v3 08/12] qemu/range: add range_list_contains() function, Sven Schnelle, 2024/03/01
- [PATCH v3 04/12] util/range: add range_list_free(), Sven Schnelle, 2024/03/01
- [PATCH v3 10/12] plugins: add range list API, Sven Schnelle, 2024/03/01
- [PATCH v3 12/12] plugins/execlog: add data address match, Sven Schnelle, 2024/03/01
- [PATCH v3 09/12] plugins: add API to print errors, Sven Schnelle, 2024/03/01
- [PATCH v3 11/12] plugins/execlog: use range list api,
Sven Schnelle <=