]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: riscv: Fix crash during instruction decoding
authorJaydeep Patil <jaydeep.patil@imgtec.com>
Thu, 11 Jan 2024 05:28:21 +0000 (05:28 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 23 Jan 2024 01:16:27 +0000 (20:16 -0500)
The match_never() function has been removed and thus step_once() crashes
during instruction decoding. Fixed it by checking for null pointer before
invoking function attached to match_func member of riscv_opcode structure

sim/riscv/sim-main.c

index 52dca4ad2829e0864107da3c38c574e788708b55..0b05f1ce86183e10c05fc6741d5b53f57b2184ee 100644 (file)
@@ -1040,7 +1040,7 @@ void step_once (SIM_CPU *cpu)
   for (; op->name; op++)
     {
       /* Does the opcode match?  */
-      if (! op->match_func (op, iw))
+      if (! op->match_func || ! op->match_func (op, iw))
        continue;
       /* Is this a pseudo-instruction and may we print it as such?  */
       if (op->pinfo & INSN_ALIAS)