bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GDB 7.3 rs6000-tdep.c skip_prologue lr_reg computed/used incorrectly


From: Doug Graham
Subject: GDB 7.3 rs6000-tdep.c skip_prologue lr_reg computed/used incorrectly
Date: Sun, 14 Aug 2011 13:14:02 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc13 Thunderbird/3.1.10

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]