From 685bb4e84bafaa5d9506cdacaf2766638bbbc560 Mon Sep 17 00:00:00 2001 From: Nelson Chu Date: Mon, 30 Aug 2021 23:20:45 +0800 Subject: [PATCH] RISC-V: PR28291, Fix the gdb fails that PR27916 caused. * According to PR28291, we get the following unexpected gdb behavior, (gdb) disassemble 0x0,+4 Dump of assembler code from 0x0 to 0x4: 0x0000000000000000: 0x0000000000000001: 0x0000000000000002: 0x0000000000000003: End of assembler dump. * This patch should fix it to the right behavior, (gdb) disassemble 0x0,+4 Dump of assembler code from 0x0 to 0x4: 0x0000000000000000: Cannot access memory at address 0x0 opcodes/ pr 28291 * riscv-dis.c (print_insn_riscv): Return STATUS if it is not zero. --- opcodes/riscv-dis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 30b42ef3aec..171aea21c7a 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -793,7 +793,7 @@ print_insn_riscv (bfd_vma memaddr, struct disassemble_info *info) if (status != 0) { (*info->memory_error_func) (status, memaddr, info); - return 1; + return status; } insn = (insn_t) bfd_getl16 (packet); dump_size = riscv_insn_length (insn); @@ -805,7 +805,7 @@ print_insn_riscv (bfd_vma memaddr, struct disassemble_info *info) if (status != 0) { (*info->memory_error_func) (status, memaddr, info); - return 1; + return status; } insn = (insn_t) bfd_get_bits (packet, dump_size * 8, false); -- 2.30.2