Hi,

I'd like to do instruction traces for qemu user, but with more information. Basically I'd like qemu-x86_64 to give me roughly the same as
perf record -e intel_pt//u ./a.out

I want to submit changes upstream.

I wrote an email 14dec which Alex Bennée kindly answered but it was deleted locally so I can't reply to it now.

I understand the limitations of only having ELF STT_FUNC for
 * the binary I start + the interpreter as these two are loaded by qemu
 * the binary needs to not be stripped
Loading of subsequent libraries seems to totally be done by the interpreter, if I've read the code correctly. I would like to use plugins because I'd like to write another plugin later that dumps guest memory when entering a function of choice.

I added a new API for plugins. Example below. If any:

QEMU_PLUGIN_EXPORT
void qemu_plugin_syminfos(struct syminfo *global_syminfos) {
    local_syminfos = global_syminfos;
}

If any plugin has defined this function, elfload.c loads_symbols()

-    if (qemu_log_enabled()) {
+    if (qemu_log_enabled() || load_symbols_from_elf) {
         load_symbols(ehdr, image_fd, load_bias);
     }

The problem is that the addresses in syminfos are from ELF, and are not the same as the addresses in qemu_plugin_tb struct. So, somewhere I need to add a mapping table between this address and guest address so I can lookup the correct symbol. But where would I add that? I looked in translator.c and it's call chain but nothing was obvious to me.

Any thoughts around this would be highly appreciated.

Kind regards,
Marcus



Reply via email to