public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ulrich Weigand <uweigand@de.ibm.com>
To: will schmidt <will_schmidt@vnet.ibm.com>
Cc: gcc-patches@sourceware.org
Subject: Re: [PATCH, rs6000][PR gdb/27525] displaced stepping across addpcis/lnia.
Date: Fri, 26 Mar 2021 13:58:33 +0100	[thread overview]
Message-ID: <20210326125833.GA18019@oc3748833570.ibm.com> (raw)
In-Reply-To: <4f6f081cb166e374d18e397781da854970e894ae.camel@vnet.ibm.com>

On Tue, Mar 16, 2021 at 05:31:03PM -0500, will schmidt wrote:

>   This addresses PR gdb/27525.     The lnia and other variations
> of the addpcis instruction write the value of the NIA into a target register.
> If we are single-stepping across a breakpoint, the instruction is executed
> from a displaced location, and thusly the written value of the PC/NIA
> will be incorrect.   The changes here will measure the displacement
> offset, and adjust the target register value to compensate.
>     
> This is written in a way that I believe will make it easier to
> update to handle prefixed (8 byte) instructions in a future patch.


This looks good to me functionally, but I'm not sure it really makes
much sense to extract code into those new routines -- *all* of the
ppc_displaced_step_fixup routine is about handling instructions that
read the PC, like the branches do.

I'd prefer if the new instructions were simply added to the existing
switch alongside the branches.

> +      displaced_offset = from - to ;  /* FIXME - By inspection, it appears the displaced instruction
> +					    is at a lower address.  Is this always true?  */

No, it could be either way.  But it shouldn't really matter since
you just need to apply the same displaced offset to the target,
whether the offset is positive or negative.  Again, you should
just do it the same way it is already done by existing code
that handles branches.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

           reply	other threads:[~2021-03-26 12:58 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <4f6f081cb166e374d18e397781da854970e894ae.camel@vnet.ibm.com>]

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=20210326125833.GA18019@oc3748833570.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gcc-patches@sourceware.org \
    --cc=will_schmidt@vnet.ibm.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).