aboutsummaryrefslogtreecommitdiff
path: root/gdb/riscv-tdep.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-06-04 10:30:41 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-06-05 09:54:47 +0100
commit312617a3d06b8df67b9f4f63f92ebfaa6b591921 (patch)
tree37d49c97d82d795c3d0c0519f78283531543a0b9 /gdb/riscv-tdep.c
parentfbe4d6650d714643fe340d9ccba7fc500c26b91d (diff)
downloadgdb-312617a3d06b8df67b9f4f63f92ebfaa6b591921.zip
gdb-312617a3d06b8df67b9f4f63f92ebfaa6b591921.tar.gz
gdb-312617a3d06b8df67b9f4f63f92ebfaa6b591921.tar.bz2
gdb/riscv: Don't error when decoding a 6 or 8 byte instruction
If the RISC-V prologue scanner finds a 6 or 8 byte instruction we currently throw an internal error, which is not great for the user. A mechanism already exists in the prologue scanner to leave instructions marked as unknown so that we can stop the prologue scan without raising an error, this is used for all 2 and 4 byte instructions that are not part of the small set the prologue scanner actually understands. This commit changes GDB so that all 6 and 8 byte instructions are marked as unknown, rather than causing an error. gdb/ChangeLog: * riscv-tdep.c (riscv_insn::decode): Gracefully ignore instructions of lengths 6 or 8 bytes. gdb/testsuite/ChangeLog: * gdb.arch/riscv-unwind-long-insn-6.s: New file. * gdb.arch/riscv-unwind-long-insn-8.s: New file. * gdb.arch/riscv-unwind-long-insn.c: New file. * gdb.arch/riscv-unwind-long-insn.exp: New file.
Diffstat (limited to 'gdb/riscv-tdep.c')
-rw-r--r--gdb/riscv-tdep.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 3fc86ab..bae987c 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1385,10 +1385,12 @@ riscv_insn::decode (struct gdbarch *gdbarch, CORE_ADDR pc)
m_opcode = OTHER;
}
else
- internal_error (__FILE__, __LINE__,
- _("unable to decode %d byte instructions in "
- "prologue at %s"), m_length,
- core_addr_to_string (pc));
+ {
+ /* This must be a 6 or 8 byte instruction, we don't currently decode
+ any of these, so just ignore it. */
+ gdb_assert (m_length == 6 || m_length == 8);
+ m_opcode = OTHER;
+ }
}
/* The prologue scanner. This is currently only used for skipping the