Fix magic number in arm-tdep.c

Yao Qi yao@codesourcery.com
Wed Mar 2 07:10:00 GMT 2011


On 02/18/2011 02:06 PM, Yao Qi wrote:
>>> >> 	(cleanup_branch): Replace magic number by macros.
>> >
>>> >> -      ULONGEST pc = displaced_read_reg (regs, from, 15);
>>> >> -      displaced_write_reg (regs, dsc, 14, pc - 4, CANNOT_WRITE_PC);
>>> >> +      ULONGEST pc = displaced_read_reg (regs, from, ARM_PC_REGNUM);
>>> >> +      displaced_write_reg (regs, dsc, ARM_LR_REGNUM, pc - 4,
CANNOT_WRITE_PC);
>> >
>> > I'm not sure about this change -- other callers just pass in plain
>> > register numbers as well ...  Either those should all be changed,
>> > or none of them.  In any case, this is really an unrelated change,
>> > and should be done -if at all- in a separate patch.
>> >
> I'll remove this chunk from my patch, and create another patch specific
> to this 'magic number' problem separately.

When writing patches for thumb displaced stepping, I find some registers
number are magic numbers.  This patch is to replace them with
corresponding macros.

This change is probably obvious, but, I'd ask for a review.

-- 
Yao (齐尧)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-magic-num-0302.patch
Type: text/x-patch
Size: 5127 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20110302/8fecf392/attachment.bin>


More information about the Gdb-patches mailing list