summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorAlex Bennée2021-06-23 12:27:48 +0200
committerAlex Bennée2021-06-25 11:08:37 +0200
commit7c4ab60f18f5257d37164df0ae0951ece4425b02 (patch)
tree46ce2c450d490590c506c5422700f3b24f391756 /plugins
parenttests/tcg: skip the signals test for hppa/s390x for now (diff)
downloadqemu-7c4ab60f18f5257d37164df0ae0951ece4425b02.tar.gz
qemu-7c4ab60f18f5257d37164df0ae0951ece4425b02.tar.xz
qemu-7c4ab60f18f5257d37164df0ae0951ece4425b02.zip
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>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/api.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/api.c b/plugins/api.c
index 817c9b6b69..332e2c60e2 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -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.