public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Jon Burgess <jburgess777@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC][PATCH] arm-tdep.c (arm_m_exception_cache): Handle stack switching to PSP during exception unwind.
Date: Mon, 22 Sep 2014 18:16:00 -0000	[thread overview]
Message-ID: <87iokfzfjt.fsf@redhat.com> (raw)
In-Reply-To: <1411253227.22117.27.camel@shark.nightingale.homedns.org> (Jon	Burgess's message of "Sat, 20 Sep 2014 23:47:07 +0100")

On Saturday, September 20 2014, Jon Burgess wrote:

> This my first GDB patch submission and I have not been through this FSF
> copyright assignment process.

Hi Jon,

Thanks for the patch.  I can submit the necessary form offlist so that
you can get started in the process of obtaining the copyright assignment
process.

Meanwhile, here goes a non-technical review, which is meant to fix
formatting issues.

> 2014-09-20  Jon Burgess  <jburgess777@gmail.com>
>
>         * arm-tdep.c (arm_m_exception_cache): Handle stack switching
>        to PSP during exception unwind.

This is almost perfect; the only thing missing is that the entry need to
be indented with TAB instead of spaces.  Take a look at the
gdb/ChangeLog file for examples.

> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index 5cdfc5b..66a0ae8 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -3010,6 +3010,7 @@ arm_m_exception_cache (struct frame_info
> *this_frame)
>    struct gdbarch *gdbarch = get_frame_arch (this_frame);
>    enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>    struct arm_prologue_cache *cache;
> +  CORE_ADDR this_pc = get_frame_pc (this_frame);
>    CORE_ADDR unwound_sp;
>    LONGEST xpsr;
>  
> @@ -3019,6 +3020,24 @@ arm_m_exception_cache (struct frame_info
> *this_frame)
>    unwound_sp = get_frame_register_unsigned (this_frame,
>                                             ARM_SP_REGNUM);
>  
> +  /* The EXC_RETURN address indicates what type of transition
> +     the CPU makes when returning from the exception. A value
> +     of 0xfffffffd causes the stack pointer to switch from
> +     MSP to PSP. */

Two spaces after dot.

  /* The EXC_RETURN address indicates what type of transition
     the CPU makes when returning from the exception.  A value
     of 0xfffffffd causes the stack pointer to switch from
     MSP to PSP.  */

> +  if (this_pc == 0xfffffffd) {
> +    int pspreg;
> +    struct regcache *regcache;
> +    struct value *pspval;
> +
> +    pspreg = user_reg_map_name_to_regnum (gdbarch, "psp", 3);
> +    gdb_assert (pspreg != -1);
> +
> +    regcache = get_current_regcache ();
> +    pspval = regcache_cooked_read_value (regcache, pspreg);
> +    if (pspval && !value_lazy (pspval))
> +      unwound_sp = value_as_address (pspval);
> +  }

The GNU Coding Style says that the open/close brackets should be
indented one line below and two whitespaces after the "if" column, so it
would be:

  if (this_pc == 0xfffffffd)
    {
      int pspreg;
      struct regcache *regcache;
      struct value *pspval;

      pspreg = user_reg_map_name_to_regnum (gdbarch, "psp", 3);
      gdb_assert (pspreg != -1);

      regcache = get_current_regcache ();
      pspval = regcache_cooked_read_value (regcache, pspreg);
      if (pspval && !value_lazy (pspval))
        unwound_sp = value_as_address (pspval);
    }

Also, if a line has 8 whitespaces, they have to be converted to a TAB
char (but this is not the case here).

> +
>    /* The hardware saves eight 32-bit words, comprising xPSR,
>       ReturnAddress, LR (R14), R12, R3, R2, R1, R0.  See details in
>       "B1.5.6 Exception entry behavior" in

Cheers,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

  reply	other threads:[~2014-09-22 18:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-20 22:47 Jon Burgess
2014-09-22 18:16 ` Sergio Durigan Junior [this message]
2014-09-23  5:30 ` Yao Qi
2014-09-23  8:38   ` Pedro Alves
2014-09-23 12:27     ` Yao Qi
2014-09-23 12:45       ` Pedro Alves
2015-05-07 18:00         ` Simon Schubert

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=87iokfzfjt.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jburgess777@gmail.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).