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>
This commit is contained in:
Alex Bennée 2019-05-22 10:27:14 +01:00
parent 5901b2e15b
commit cbafa2362a
5 changed files with 130 additions and 1 deletions

View file

@ -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.