[Pdbg] [PATCH v2 39/39] gdbserver: remove fallback breakpoint support in put_mem

Joel Stanley joel at jms.id.au
Tue May 3 17:45:58 AEST 2022


On Wed, 20 Apr 2022 at 06:52, Nicholas Piggin <npiggin at gmail.com> wrote:
>
> With breakpoint ops implemented, gdb does not need to write its
> break op using memory-ops. Remove the breakpoint logic from the
> memory-write command.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>

Reviewed-by: Joel Stanley <joel at jms.id.au>

> ---
>  src/pdbgproxy.c | 34 ----------------------------------
>  1 file changed, 34 deletions(-)
>
> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> index cc73a36d..13b72408 100644
> --- a/src/pdbgproxy.c
> +++ b/src/pdbgproxy.c
> @@ -603,8 +603,6 @@ static void put_mem(uint64_t *stack, void *priv)
>  {
>         uint64_t addr, len;
>         uint8_t *data;
> -       uint8_t attn_opcode[] = {0x00, 0x00, 0x02, 0x00};
> -       uint8_t gdb_break_opcode[] = {0x7d, 0x82, 0x10, 0x08};
>         int err = 0;
>
>         addr = stack[0];
> @@ -618,38 +616,6 @@ static void put_mem(uint64_t *stack, void *priv)
>                 goto out;
>         }
>
> -       if (len == 4 && !memcmp(data, gdb_break_opcode, 4)) {
> -               uint64_t msr;
> -
> -               /* Check endianess in MSR */
> -               err = thread_getmsr(thread_target, &msr);
> -               if (err) {
> -                       PR_ERROR("Couldn't read the MSR. Are all threads on this chiplet quiesced?\n");
> -                       goto out;
> -               }
> -               if (msr & 1) { /* little endian */
> -                       attn_opcode[1] = 0x02;
> -                       attn_opcode[2] = 0x00;
> -               }
> -
> -               /* According to linux-ppc-low.c gdb only uses this
> -                * op-code for sw break points so we replace it with
> -                * the correct attn opcode which is what we need for
> -                * breakpoints.
> -                *
> -                * TODO: Upstream a patch to gdb so that it uses the
> -                * right opcode for baremetal debug. */
> -
> -               PR_INFO("Breakpoint opcode detected, replacing with attn\n");
> -               memcpy(data, attn_opcode, 4);
> -
> -               /* Need to enable the attn instruction in HID0 */
> -               if (set_attn(true)) {
> -                       err = 2;
> -                       goto out;
> -               }
> -       }
> -
>         if (write_memory(addr, len, data, 8)) {
>                 PR_ERROR("Unable to write memory\n");
>                 err = 3;
> --
> 2.35.1
>
> --
> Pdbg mailing list
> Pdbg at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg


More information about the Pdbg mailing list