public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH, rs6000][PR gdb/27525] displaced stepping across addpcis/lnia.
       [not found] <4f6f081cb166e374d18e397781da854970e894ae.camel@vnet.ibm.com>
@ 2021-03-26 12:58 ` Ulrich Weigand
  0 siblings, 0 replies; only message in thread
From: Ulrich Weigand @ 2021-03-26 12:58 UTC (permalink / raw)
  To: will schmidt; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-26 12:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4f6f081cb166e374d18e397781da854970e894ae.camel@vnet.ibm.com>
2021-03-26 12:58 ` [PATCH, rs6000][PR gdb/27525] displaced stepping across addpcis/lnia Ulrich Weigand

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).