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:
parent
ff4f0c61df
commit
9d18d32a41
4
gnu/dist/gdb6/gdb/shnbsd-tdep.c
vendored
4
gnu/dist/gdb6/gdb/shnbsd-tdep.c
vendored
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user