aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2024-06-20 16:22:11 +0100
committerAlex Bennée <alex.bennee@linaro.org>2024-06-24 10:14:22 +0100
commitad59d5caee26178b6719a2f38e931c89840b7350 (patch)
treec1420599cb87258a4ab73ad4062cc63f127d9b21
parent5b7d54d4ed7857b8b27fb040c6027ba59e003889 (diff)
downloadqemu-ad59d5caee26178b6719a2f38e931c89840b7350.zip
qemu-ad59d5caee26178b6719a2f38e931c89840b7350.tar.gz
qemu-ad59d5caee26178b6719a2f38e931c89840b7350.tar.bz2
plugins: Ensure register handles are not NULL
Ensure register handles are not NULL so that a plugin can assume NULL is invalid as a register handle. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240229-null-v1-1-e716501d981e@daynix.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240620152220.2192768-4-alex.bennee@linaro.org>
-rw-r--r--plugins/api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/api.c b/plugins/api.c
index 5a0a7f8..6bdb26b 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -507,7 +507,7 @@ static GArray *create_register_handles(GArray *gdbstub_regs)
}
/* Create a record for the plugin */
- desc.handle = GINT_TO_POINTER(grd->gdb_reg);
+ desc.handle = GINT_TO_POINTER(grd->gdb_reg + 1);
desc.name = g_intern_string(grd->name);
desc.feature = g_intern_string(grd->feature_name);
g_array_append_val(find_data, desc);
@@ -528,7 +528,7 @@ int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray *buf)
{
g_assert(current_cpu);
- return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg));
+ return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1);
}
struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_size)