z80/disassembler: call memory_error_func when appropriate
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 7 Oct 2021 16:50:33 +0000 (17:50 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 11 Oct 2021 13:07:03 +0000 (14:07 +0100)
If a call to the read_memory_func fails then we should call the
memory_error_func to notify the user of the disassembler of the
address that was a problem.

Without this GDB will report all memory errors as being at address
0x0.

opcodes/ChangeLog:

* z80-dis.c (fetch_data): Call memory_error_func if the
read_memory_func call fails.

opcodes/z80-dis.c

index 0e7a312ff8987e148e28e9877789cc87f022454a..f62861c1de5511b5c026cda93fbf11ec56f73027 100644 (file)
@@ -95,6 +95,8 @@ fetch_data (struct buffer *buf, disassemble_info * info, int n)
                              n, info);
   if (r == 0)
     buf->n_fetch += n;
+  else
+    info->memory_error_func (r, buf->base + buf->n_fetch, info);
   return !r;
 }