diff options
author | Alex Bennée | 2019-05-22 11:27:14 +0200 |
---|---|---|
committer | Alex Bennée | 2019-10-28 16:12:38 +0100 |
commit | cbafa2362ab8d96af39d6b01a79ea4ed16d47dda (patch) | |
tree | 57c3f69e05f35e4fd9c0f5aa11a5ad7a3685de1d /plugins | |
parent | plugin: expand the plugin_init function to include an info block (diff) | |
download | qemu-cbafa2362ab8d96af39d6b01a79ea4ed16d47dda.tar.gz qemu-cbafa2362ab8d96af39d6b01a79ea4ed16d47dda.tar.xz qemu-cbafa2362ab8d96af39d6b01a79ea4ed16d47dda.zip |
plugin: add qemu_plugin_insn_disas helper
Give the plugins access to the QEMU dissasembler so they don't have to
re-invent the wheel. We generate a warning when there are spare bytes
in the decode buffer. This is usually due to the front end loading in
more bytes than decoded.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/api.c | 9 | ||||
-rw-r--r-- | plugins/qemu-plugins.symbols | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/plugins/api.c b/plugins/api.c index 33dac8e790..5adc4d25a1 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -39,7 +39,8 @@ #include "cpu.h" #include "sysemu/sysemu.h" #include "tcg/tcg.h" -#include "trace/mem-internal.h" /* mem_info macros */ +#include "exec/exec-all.h" +#include "disas/disas.h" #include "plugin.h" #ifndef CONFIG_USER_ONLY #include "qemu/plugin-memory.h" @@ -212,6 +213,12 @@ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn) return insn->haddr; } +char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn) +{ + CPUState *cpu = current_cpu; + return plugin_disas(cpu, insn->vaddr, insn->data->len); +} + /* * The memory queries allow the plugin to query information about a * memory access. diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 40c0d1abd2..267ec381b4 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -25,6 +25,7 @@ qemu_plugin_insn_size; qemu_plugin_insn_vaddr; qemu_plugin_insn_haddr; + qemu_plugin_insn_disas; qemu_plugin_mem_size_shift; qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_big_endian; |