Skip to content

Commit b68b8da

Browse files
committed
Avoid the capstone error
1 parent d98f258 commit b68b8da

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

qiling/arch/riscv.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ def init_context(self):
5050

5151
def soft_interrupt_handler(self, ql, intno):
5252
if intno == 2:
53-
address, size = ql.reg.pc - 4, 4
54-
tmp = ql.mem.read(address, size)
55-
qd = ql.arch.create_disassembler()
56-
57-
insn = '\n> '.join(f'{insn.mnemonic} {insn.op_str}' for insn in qd.disasm(tmp, address))
53+
try:
54+
address, size = ql.reg.pc - 4, 4
55+
tmp = ql.mem.read(address, size)
56+
qd = ql.arch.create_disassembler()
57+
58+
insn = '\n> '.join(f'{insn.mnemonic} {insn.op_str}' for insn in qd.disasm(tmp, address))
59+
except QlErrorNotImplemented:
60+
insn = ''
61+
5862
ql.log.warning(f'[{hex(address)}] Illegal instruction ({insn})')
5963
else:
6064
raise QlErrorNotImplemented(f'Unhandled interrupt number ({intno})')

0 commit comments

Comments
 (0)