Branch with delay slot executes delay slot even if branch is not

taken, so adjust next_pc logic accordingly.  Fixes SIGILL
(breakpoint's "trapa" causes an illegal slot instruction exception)
when stepping through such branches.
This commit is contained in:
uwe 2011-02-04 00:05:29 +00:00
parent ff4f0c61df
commit 9d18d32a41

View File

@ -286,14 +286,14 @@ shnbsd_get_next_pc (CORE_ADDR pc)
{
sr = read_register (SR_REGNUM);
delay_slot = CONDITIONAL_BRANCH_SLOT_P(insn);
if (!CONDITIONAL_BRANCH_TAKEN_P(insn, sr))
next_pc = pc + 2;
next_pc = pc + (delay_slot ? 4 : 2);
else
{
displacement = shnbsd_displacement_8 (insn);
next_pc = pc + 4 + (displacement << 1);
delay_slot = CONDITIONAL_BRANCH_SLOT_P(insn);
}
}