[PATCH v2 11/12] MIPS: Return correct size from `mips_insn_size' for MIPS16 JAL/X

"Maciej W. Rozycki" <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
From: Maciej W. Rozycki <[email protected]>

Among MIPS16 instructions not only the extended ones have the size of 4 
bytes, but JAL and JALX as well, even though they have their distinct 
major opcode and do not use the EXTEND prefix.  Update `mips_insn_size' 
accordingly.

This function is currently never called for ISA_MIPS16, so the bug does 
not hit, but it will with the next change.

Approved-By: Maciej W. Rozycki <[email protected]>
---
New change in v2.
---
 gdb/mips-tdep.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

gdb-mips16-insn-size-jal.diff
Index: binutils-gdb/gdb/mips-tdep.c
===================================================================
--- binutils-gdb.orig/gdb/mips-tdep.c
+++ binutils-gdb/gdb/mips-tdep.c
@@ -1563,7 +1563,8 @@ mips_insn_size (enum mips_isa isa, ULONG
       else
 	return MIPS_INSN16_SIZE;
     case ISA_MIPS16:
-      if ((insn & 0xf800) == 0xf000)
+      if ((insn & 0xf800) == 0x1800
+	  || (insn & 0xf800) == 0xf000)
 	return 2 * MIPS_INSN16_SIZE;
       else
 	return MIPS_INSN16_SIZE;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.