This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix PR tdep/12352: Handle str pc, [Rd, #imm] in displaced stepping
- From: Yao Qi <yao at codesourcery dot com>
- To: Richard Earnshaw <Richard dot Earnshaw at buzzard dot freeserve dot co dot uk>
- Cc: gdb-patches at sourceware dot org, julian at codesourcery dot com
- Date: Mon, 24 Jan 2011 16:04:08 +0800
- Subject: Re: [patch] Fix PR tdep/12352: Handle str pc, [Rd, #imm] in displaced stepping
- References: <4D1A1343.8020204@codesourcery.com> <4D3AF29E.3020708@buzzard.freeserve.co.uk>
On 01/22/2011 11:07 PM, Richard Earnshaw wrote:
> On 28/12/10 16:41, Yao Qi wrote:
>> When I read arm-tdep.c:copy_ldr_str_ldrb_strb, I feel pretty hard to
>> understand two lines of code,
>>
>> dsc->modinsn[0] = 0xe58ff014; /* str pc, [pc, #20]. */
>> dsc->modinsn[1] = 0xe59f4010; /* ldr r4, [pc, #16]. */
>
> Hmm, looks like a rather convoluted way of moving the PC into R4.
> Julian, I think this patch was yours... can you remember why "MOV R4,
> PC" wasn't sufficient?
>
IIUC, these two instructions together with 'sub r4, r4, pc' are used to
calculate the offset of 'str pc ADDR', which is 8 or
12(implementation-dependent, but consistent for a given device).
AFAIK, 'mov r4, pc' doesn't help.
--
Yao (éå)