From: Yao Qi <yao@codesourcery.com>
To: Will Newton <will.newton@linaro.org>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/4] Restrict matching add/sub sp, #imm
Date: Mon, 07 Jul 2014 01:38:00 -0000 [thread overview]
Message-ID: <53B9F9C2.70601@codesourcery.com> (raw)
In-Reply-To: <CANu=DmiOm27eXhYHo4CBZrE7Yx+MjmFajrky8MwLS5fRa+wpjA@mail.gmail.com>
On 07/03/2014 04:31 PM, Will Newton wrote:
> One too many ms?
>
Oh, sorry.
>> > (thumb_in_function_epilogue_p): Don't match 'sub sp, #imm'.
>> > ---
>> > gdb/arm-tdep.c | 15 +++++----------
>> > 1 file changed, 5 insertions(+), 10 deletions(-)
>> >
>> > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
>> > index 8cc60a4..0fc7fc1 100644
>> > --- a/gdb/arm-tdep.c
>> > +++ b/gdb/arm-tdep.c
>> > @@ -737,16 +737,11 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
>> > pv_area_store (stack, regs[ARM_SP_REGNUM], 4, regs[regno]);
>> > }
>> > }
>> > - else if ((insn & 0xff00) == 0xb000) /* add sp, #simm OR
>> > - sub sp, #simm */
>> > + else if ((insn & 0xff80) == 0xb080) /* sub sp, #simm */
> I wonder if we should adjust the comment to just #imm, as #simm
> implies it is a signed quantity.
>
Fixed.
--
Yao (é½å°§)
gdb:
2014-07-07 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_analyze_prologue): Don't match instruction
'add sp, #imm'.
(thumb_in_function_epilogue_p): Don't match 'sub sp, #imm'.
---
gdb/arm-tdep.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 8cc60a4..6b1cf3c 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -737,16 +737,11 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
pv_area_store (stack, regs[ARM_SP_REGNUM], 4, regs[regno]);
}
}
- else if ((insn & 0xff00) == 0xb000) /* add sp, #simm OR
- sub sp, #simm */
+ else if ((insn & 0xff80) == 0xb080) /* sub sp, #imm */
{
offset = (insn & 0x7f) << 2; /* get scaled offset */
- if (insn & 0x80) /* Check for SUB. */
- regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM],
- -offset);
- else
- regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM],
- offset);
+ regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM],
+ -offset);
}
else if ((insn & 0xf800) == 0xa800) /* add Rd, sp, #imm */
regs[bits (insn, 8, 10)] = pv_add_constant (regs[ARM_SP_REGNUM],
@@ -3264,7 +3259,7 @@ thumb_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
found_return = 1;
else if (insn == 0x46bd) /* mov sp, r7 */
found_stack_adjust = 1;
- else if ((insn & 0xff00) == 0xb000) /* add sp, imm or sub sp, imm */
+ else if ((insn & 0xff80) == 0xb000) /* add sp, imm */
found_stack_adjust = 1;
else if ((insn & 0xfe00) == 0xbc00) /* pop <registers> */
{
@@ -3324,7 +3319,7 @@ thumb_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
if (insn2 == 0x46bd) /* mov sp, r7 */
found_stack_adjust = 1;
- else if ((insn2 & 0xff00) == 0xb000) /* add sp, imm or sub sp, imm */
+ else if ((insn2 & 0xff80) == 0xb000) /* add sp, imm */
found_stack_adjust = 1;
else if ((insn2 & 0xff00) == 0xbc00) /* pop <registers> without PC */
found_stack_adjust = 1;
--
1.9.0
next prev parent reply other threads:[~2014-07-07 1:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-03 6:11 [PATCH 0/4] Fix gdb.trace/entry-values.exp fails in thumb mode Yao Qi
2014-07-03 6:11 ` [PATCH 2/4] Match instruction adjusts SP in thumb Yao Qi
2014-07-03 8:35 ` Will Newton
2014-07-11 13:25 ` Joel Brobecker
2014-09-24 12:56 ` Yao Qi
2014-07-03 6:11 ` [PATCH 3/4] Stop prologue analysis when past the epilogue Yao Qi
2014-07-03 8:39 ` Will Newton
2014-07-11 13:39 ` Joel Brobecker
2014-07-03 6:11 ` [PATCH 4/4] Fix gdb.trace/entry-values.exp for thumb mode Yao Qi
2014-07-07 15:15 ` Joel Brobecker
2014-07-08 8:53 ` Yao Qi
2014-07-03 6:11 ` [PATCH 1/4] Restrict matching add/sub sp, #imm Yao Qi
2014-07-03 8:31 ` Will Newton
2014-07-07 1:38 ` Yao Qi [this message]
2014-07-11 13:25 ` Joel Brobecker
2014-07-11 13:49 ` Yao Qi
2014-07-11 7:34 ` [PATCH 0/4] Fix gdb.trace/entry-values.exp fails in thumb mode Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53B9F9C2.70601@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=will.newton@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox