On 11/3/23 12:59, Alex Bennée wrote:
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -89,7 +89,11 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct 
qemu_plugin_tb *tb,
                                            void *udata)
  {
      if (!tb->mem_only) {
-        plugin_register_dyn_cb__udata(&tb->cbs[PLUGIN_CB_REGULAR],
+        int index = flags == QEMU_PLUGIN_CB_R_REGS ||
+                    flags == QEMU_PLUGIN_CB_RW_REGS ?
+                    PLUGIN_CB_REGULAR_R : PLUGIN_CB_REGULAR;
+

I'd really rather you reject QEMU_PLUGIN_CB_RW_REGS entirely, rather than implement it with incorrect semantics.

Otherwise,
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>

+        plugin_register_dyn_cb__udata(&tb->cbs[index],
                                        cb, flags, udata);
      }
  }
@@ -109,7 +113,11 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct 
qemu_plugin_insn *insn,
                                              void *udata)
  {
      if (!insn->mem_only) {
-        
plugin_register_dyn_cb__udata(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_REGULAR],
+        int index = flags == QEMU_PLUGIN_CB_R_REGS ||
+                    flags == QEMU_PLUGIN_CB_RW_REGS ?
+                    PLUGIN_CB_REGULAR_R : PLUGIN_CB_REGULAR;
+
+        plugin_register_dyn_cb__udata(&insn->cbs[PLUGIN_CB_INSN][index],
                                        cb, flags, udata);
      }
  }


Reply via email to