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.weig...@de.ibm.com

Reply via email to