public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yvan Roux <yvan.roux@foss.st.com>
To: Luis Machado <luis.machado@arm.com>, <gdb-patches@sourceware.org>
Cc: Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
Subject: Re: [PATCH 1/3] gdb/arm: Fetch initial sp value prior to compare
Date: Wed, 15 Jun 2022 11:20:55 +0200	[thread overview]
Message-ID: <20220615092055.GA26132@gnbcxd0114.gnb.st.com> (raw)
In-Reply-To: <17271abd-9c22-dae1-8ac6-9b549ff1f686@arm.com>

On Wed, Jun 15, 2022 at 09:39:21AM +0100, Luis Machado wrote:
> On 6/14/22 15:59, Yvan Roux wrote:
> > For Arm Cortex-M33 with security extensions, there are 4 different
> > stack pointers (msp_s, msp_ns, psp_s, psp_ns).  In order to
> > identify the active one, compare the values of the different
> > stacks. The value of the initial sp register needs to be fetched to
> > perform this comparison.
> > 
> > Signed-off-by: Torbj�rn SVENSSON <torbjorn.svensson@foss.st.com>
> > Signed-off-by: Yvan Roux <yvan.roux@foss.st.com>
> > ---
> >   gdb/arm-tdep.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> > index 456649afdaa..1df57f5b5c8 100644
> > --- a/gdb/arm-tdep.c
> > +++ b/gdb/arm-tdep.c
> > @@ -341,6 +341,7 @@ arm_cache_init (struct arm_prologue_cache *cache, struct frame_info *frame)
> >     arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
> >     arm_cache_init (cache, gdbarch);
> > +  cache->sp = get_frame_register_unsigned (frame, ARM_SP_REGNUM);
> >     if (tdep->have_sec_ext)
> >       {
> 
> Does that mean that before this patch the value of cache->sp was uninitialized?

Yes, what Torbjorn found is that arm_prologue_cache->sp value was 0x0 due to
lack of initialization.

-- 
Y.

  reply	other threads:[~2022-06-15  9:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 14:56 [PATCH 0/3] gdb/arm: ARMv8-M Secure/Non-Secure stack support fixes Yvan Roux
2022-06-14 14:59 ` [PATCH 1/3] gdb/arm: Fetch initial sp value prior to compare Yvan Roux
2022-06-15  8:39   ` Luis Machado
2022-06-15  9:20     ` Yvan Roux [this message]
2022-06-14 15:00 ` [PATCH 2/3] gdb/arm: Track msp and psp Yvan Roux
2022-06-15  8:57   ` Luis Machado
2022-06-15  9:28     ` Yvan Roux
2022-06-15  9:46       ` Torbjorn SVENSSON
2022-06-15 10:15         ` Luis Machado
2022-06-15 10:46           ` Yvan Roux
2022-06-14 15:01 ` [PATCH 3/3] gdb/arm: Make sp alias for one of the other stack pointers Yvan Roux

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=20220615092055.GA26132@gnbcxd0114.gnb.st.com \
    --to=yvan.roux@foss.st.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.com \
    --cc=torbjorn.svensson@foss.st.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).