[PATCH v2 1/2] ppc: use 'trap' ('tw, 31, 0, 0', 0x7fe00008) as breakpoint instruction

Joel Brobecker brobecker@adacore.com
Sat Nov 27 06:45:33 GMT 2021


Hi Jan,

On Wed, Nov 24, 2021 at 01:09:25PM +0000, Jan Vrany via Gdb-patches wrote:
> GDB used to use "tw 12, r2, r2" as a breakpoint instruction. While it
> works, the PowerPC specifies 'tw, 31, 0, 0' (0x7fe00008) as the
> canonical unconditional trap.
> ---
>  gdb/rs6000-tdep.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
> index 87a494e0bb8..43880fa4426 100644
> --- a/gdb/rs6000-tdep.c
> +++ b/gdb/rs6000-tdep.c
> @@ -824,8 +824,8 @@ rs6000_fetch_pointer_argument (struct frame_info *frame, int argi,
>  
>  /* Sequence of bytes for breakpoint instruction.  */
>  
> -constexpr gdb_byte big_breakpoint[] = { 0x7d, 0x82, 0x10, 0x08 };
> -constexpr gdb_byte little_breakpoint[] = { 0x08, 0x10, 0x82, 0x7d };
> +constexpr gdb_byte big_breakpoint[] = { 0x7f, 0xe0, 0x00, 0x08 };
> +constexpr gdb_byte little_breakpoint[] = { 0x08, 0x00, 0xe0, 0x7f };
>  
>  typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint)
>    rs6000_breakpoint;

I'm going to say OK, but I'd like to know what your source is
for this, so we can document that change. Part of me wonders
why we're making a change like this one on some code which
works, which is always a risk, no matter how small, unless we have
enough evidence that this is going to be helpful in practice.

Thank you,
-- 
Joel


More information about the Gdb-patches mailing list