diff mbox series

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

Message ID 20220420065013.222816-40-npiggin@gmail.com
State New
Headers show
Series gdbserver multi-threaded debugging and POWER9/10 support | expand

Checks

Context Check Description
snowpatch_ozlabs/github-CI fail Build failed at step arm32.

Commit Message

Nicholas Piggin April 20, 2022, 6:50 a.m. UTC
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@gmail.com>
---
 src/pdbgproxy.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

Comments

Joel Stanley May 3, 2022, 7:45 a.m. UTC | #1
On Wed, 20 Apr 2022 at 06:52, Nicholas Piggin <npiggin@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@gmail.com>

Reviewed-by: Joel Stanley <joel@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@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
diff mbox series

Patch

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;