[1/2] s12z/disassembler: call memory_error_func when appropriate

Message ID 4cb7a8ad174a550c5692f35375b26530f9053fb1.1633770634.git.andrew.burgess@embecosm.com
State New
Headers show
Series
  • Add some missing calls to memory_error_func
Related show

Commit Message

Andrew Burgess Oct. 9, 2021, 9:13 a.m.
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:

	* s12z-disc.c (abstract_read_memory): Call memory_error_func if
	the read_memory_func call fails.
---
 opcodes/s12z-dis.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.25.4

Patch

diff --git a/opcodes/s12z-dis.c b/opcodes/s12z-dis.c
index ec8f4f70883..24125574b78 100644
--- a/opcodes/s12z-dis.c
+++ b/opcodes/s12z-dis.c
@@ -61,6 +61,9 @@  abstract_read_memory (struct mem_read_abstraction_base *b,
 
   int status = (*mra->info->read_memory_func) (mra->memaddr + offset,
 					       bytes, n, mra->info);
+  if (status != 0)
+    (*mra->info->memory_error_func) (status, mra->memaddr + offset,
+                                     mra->info);
   return status != 0 ? -1 : 0;
 }