In skip_prologue() in rs6000-tdep.c, lr_reg is extracted from an mflr instruction as follows:

   lr_reg = (op & 0x03e00000) >> 21;

This makes lr a register number between 0 and 31.

When it is later tested when looking for a stw etc. instruction:

  if ((op & 0xffff0000) == (lr_reg | 0x90010000))
     ...

it should be left shifted by 21here, because the rS field in the stw instruction appears 21 bits to the left in the instruction. Alternatively, it should not be shifted at all when it is extracted from the mflr. In fact, the latter is how this code was written up until GDB 6.8 and maybe later.

Obviously, the above comparison could never be true (unless lr_reg is zero) because it is comparing a number with the lower 16 bits masked off with a number which has the register number in the lower 16 bits.

--Doug


_______________________________________________
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb

Reply via email to