[patch] Fix PR tdep/12352: Handle str pc, [Rd, #imm] in displaced stepping

Yao Qi yao@codesourcery.com
Tue Feb 15 10:55:00 GMT 2011


On 02/14/2011 10:16 PM, Ulrich Weigand wrote:
> I think this is wrong: the "pipeline offset" of 8 bytes is already
> added to the PC value when it is retrieved by displaced_read_reg
> (this applies to any use of PC as source operand in any instruction).
> 
> The special case relating to STR PC is about an optional *additional*
> offset of 4 bytes (such that PC + 12 instead of PC + 8 is stored);
> the "offset" value computed by this routine should therefore be
> 0 or 4 (not 8 or 12).

Thanks for the explanation.

> Maybe it would be good to add a test that verifies the value
> stored under displaced stepping is identical to the value
> stored when running the instruction natively?

In my new patch, the test case is revised to execute instructions below
twice,

       str     pc, [sp, #-4]
       ldr     rN, [sp, #-4]
       sub     rN, rN, pc

the first `str' instruction is executed with displaced stepping, while
the second `str' is executed without displaced stepping.  Then, values
of two registers are compared to make sure they should be the same.

-- 
Yao (齐尧)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr12352-0215.patch
Type: text/x-patch
Size: 5465 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20110215/4670341f/attachment.bin>


More information about the Gdb-patches mailing list