Patchwork include address in invalid memory region accesses

login
register
mail settings
Submitter Mike Frysinger
Date Sept. 16, 2012, 7:46 p.m.
Message ID <1347824787-1160-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/184146/
State New
Headers show

Comments

Mike Frysinger - Sept. 16, 2012, 7:46 p.m.
The current code to display invalid memory accesses isn't terribly useful
as it doesn't tell you what address is actually being accessed.  Include
it in the error message.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 memory.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/memory.c b/memory.c
index d528d1f..0ea0320 100644
--- a/memory.c
+++ b/memory.c
@@ -998,7 +998,9 @@  static uint64_t invalid_read(void *opaque, target_phys_addr_t addr,
     MemoryRegion *mr = opaque;
 
     if (!mr->warning_printed) {
-        fprintf(stderr, "Invalid read from memory region %s\n", mr->name);
+        fprintf(stderr,
+                "Invalid read from memory region %s at %#" TARGET_PRIxPHYS "\n",
+                mr->name, addr);
         mr->warning_printed = true;
     }
     return -1U;
@@ -1010,7 +1012,9 @@  static void invalid_write(void *opaque, target_phys_addr_t addr, uint64_t data,
     MemoryRegion *mr = opaque;
 
     if (!mr->warning_printed) {
-        fprintf(stderr, "Invalid write to memory region %s\n", mr->name);
+        fprintf(stderr,
+                "Invalid write to memory region %s at %#" TARGET_PRIxPHYS "\n",
+                mr->name, addr);
         mr->warning_printed = true;
     }
 }