mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
plugins/api: expose symbol lookup to plugins
This is a quality of life helper for plugins so they don't need to re-implement symbol lookup when dumping an address. The strings are constant so don't need to be duplicated. One minor tweak is to return NULL instead of a zero length string to show lookup failed. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com> Message-Id: <20210608040532.56449-2-ma.mandourr@gmail.com> Message-Id: <20210623102749.25686-8-alex.bennee@linaro.org>
This commit is contained in:
parent
f101c9fe29
commit
7c4ab60f18
@ -525,6 +525,15 @@ qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id,
|
||||
|
||||
char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn);
|
||||
|
||||
/**
|
||||
* qemu_plugin_insn_symbol() - best effort symbol lookup
|
||||
* @insn: instruction reference
|
||||
*
|
||||
* Return a static string referring to the symbol. This is dependent
|
||||
* on the binary QEMU is running having provided a symbol table.
|
||||
*/
|
||||
const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn);
|
||||
|
||||
/**
|
||||
* qemu_plugin_vcpu_for_each() - iterate over the existing vCPU
|
||||
* @id: plugin ID
|
||||
|
@ -233,6 +233,12 @@ char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn)
|
||||
return plugin_disas(cpu, insn->vaddr, insn->data->len);
|
||||
}
|
||||
|
||||
const char *qemu_plugin_insn_symbol(const struct qemu_plugin_insn *insn)
|
||||
{
|
||||
const char *sym = lookup_symbol(insn->vaddr);
|
||||
return sym[0] != 0 ? sym : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The memory queries allow the plugin to query information about a
|
||||
* memory access.
|
||||
|
Loading…
Reference in New Issue
Block a user