[binutils-gdb] z80/disassembler: call memory_error_func when appropriate

Andrew Burgess aburgess@sourceware.org
Mon Oct 11 13:09:13 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a480f1e35b7e22a3ca6309dae8f665c8dacd104

commit 3a480f1e35b7e22a3ca6309dae8f665c8dacd104
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Thu Oct 7 17:50:33 2021 +0100

    z80/disassembler: call memory_error_func when appropriate
    
    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.

Diff:
---
 opcodes/z80-dis.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/opcodes/z80-dis.c b/opcodes/z80-dis.c
index 0e7a312ff89..f62861c1de5 100644
--- a/opcodes/z80-dis.c
+++ b/opcodes/z80-dis.c
@@ -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;
 }


More information about the Binutils-cvs mailing list