On 6/26/24 23:04, Xingtao Yao (Fujitsu) wrote:


-----Original Message-----
From: Pierrick Bouvier <pierrick.bouv...@linaro.org>
Sent: Thursday, June 27, 2024 1:29 PM
To: Yao, Xingtao/姚 幸涛 <yaoxt.f...@fujitsu.com>; qemu-devel@nongnu.org
Cc: Alexandre Iooss <erdn...@crans.org>; Philippe Mathieu-Daudé
<phi...@linaro.org>; Mahmoud Mandour <ma.mando...@gmail.com>; Paolo
Bonzini <pbonz...@redhat.com>; Eduardo Habkost <edua...@habkost.net>;
Richard Henderson <richard.hender...@linaro.org>; Alex Bennée
<alex.ben...@linaro.org>
Subject: Re: [PATCH v2 6/7] tests/plugin/mem: add option to print memory
accesses

Hi Xingtao,

On 6/26/24 20:17, Xingtao Yao (Fujitsu) wrote:
Hi, Pierrick

+static void print_access(unsigned int cpu_index, qemu_plugin_meminfo_t
meminfo,
+                         uint64_t vaddr, void *udata)
+{
+    unsigned size = 8 << qemu_plugin_mem_size_shift(meminfo);
+    const char *type = qemu_plugin_mem_is_store(meminfo) ? "store" :
"load";
+    uint64_t upper = qemu_plugin_mem_get_value_upper_bits(meminfo);
+    uint64_t lower = qemu_plugin_mem_get_value_lower_bits(meminfo);
+    const char *sym = udata ? udata : "";
+    g_autoptr(GString) out = g_string_new("");
+    g_string_printf(out, "access: 0x%.0"PRIx64"%"PRIx64",%d,%s,%s\n",
+                    upper, lower, size, type, sym);
+    qemu_plugin_outs(out->str);
+}
I think it may be helpful to output the GVA and GPA, can you append these
information?


You mean virtual and physical addresses?
Yes. currently we only known the memory value, appending these info may help us 
to trace the
memory access.


Sounds good, I'll add this in v3.



Thanks
Xingtao

Reply via email to