aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorJaydeep Patil <jaydeep.patil@imgtec.com>2024-01-11 05:28:21 +0000
committerMike Frysinger <vapier@gentoo.org>2024-01-22 20:16:27 -0500
commitb783d068d969b5422ce60ecc6968a1a35ee92a7e (patch)
tree9d2c2de089744bea934a815777fea4f409742b14 /sim
parent8fed036befd8e87e9a602a5fc926db30aad69af3 (diff)
downloadgdb-b783d068d969b5422ce60ecc6968a1a35ee92a7e.zip
gdb-b783d068d969b5422ce60ecc6968a1a35ee92a7e.tar.gz
gdb-b783d068d969b5422ce60ecc6968a1a35ee92a7e.tar.bz2
sim: riscv: Fix crash during instruction decoding
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
Diffstat (limited to 'sim')
-rw-r--r--sim/riscv/sim-main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c
index 52dca4a..0b05f1c 100644
--- a/sim/riscv/sim-main.c
+++ b/sim/riscv/sim-main.c
@@ -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)