gdb/arm-tdep: the "strd rd, [sp, #-imm]!" is the part of function prologue.
Commit Message
The "strd rd, [sp, #-imm]!" is the part of function prologue.
Dump of assembler code for function __nanosleep:
acc68: e16d41f8 strd r4, [sp, #-24]!
acc6c: ee1d5f70 mrc 15, 0, r5, cr13, cr0, {3}
acc70: e51534c0 ldr r3, [r5, #-1216]
Signed-off-by: chenzefeng <chenzefeng2@huawei.com>
---
gdb/arm-tdep.c | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
>>>>> ">" == chenzefeng <chenzefeng2@huawei.com> writes:
>> The "strd rd, [sp, #-imm]!" is the part of function prologue.
>> Dump of assembler code for function __nanosleep:
>> acc68: e16d41f8 strd r4, [sp, #-24]!
>> acc6c: ee1d5f70 mrc 15, 0, r5, cr13, cr0, {3}
>> acc70: e51534c0 ldr r3, [r5, #-1216]
Thank you for the patch.
gdb patches require a ChangeLog entry. See the GNU coding standards or
the gdb contribution checklist for details.
https://sourceware.org/gdb/wiki/ContributionChecklist
Also, do you have a copyright assignment in place?
If not, then that's something to start.
>> Signed-off-by: chenzefeng <chenzefeng2@huawei.com>
>> ---
>> gdb/arm-tdep.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
I don't know anything about ARM, really. I'm curious how this bug came
up. Like, does the compiler ordinarily emit this kind of instruction in
the prologue? Is it possible to write a test case for this, or does the
patch fix some existing test failure?
thanks,
Tom
@@ -1550,6 +1550,15 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
regs[bits (insn, 12, 15)]);
continue;
}
+ else if ((insn & 0xffff00f0) == 0xe16d00f0) /* strd rd, [sp, #imm]! */
+ {
+ unsigned imm = ((insn & 0xf00) >> 4) + (insn & 0xf);
+ if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
+ break;
+ regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -imm);
+ stack.store (regs[ARM_SP_REGNUM], 4, regs[bits (insn, 12, 15)]);
+ continue;
+ }
else if ((insn & 0xffff0000) == 0xe92d0000)
/* stmfd sp!, {..., fp, ip, lr, pc}
or