diff mbox series

[v2,09/39] gdbserver: use standard compatibility test calls

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

Commit Message

Nicholas Piggin April 20, 2022, 6:49 a.m. UTC
p10.dts.m4 defines compatible = "ibm,power-thread", "ibm,power10-thread"
which fails to match on a basic strcmp.

Use pdbg_target_compatible() for matching threads. Also document another
case in hwunit.c that is using strcmp (seems to be the only other place
in the tree that does).

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 libpdbg/hwunit.c | 1 +
 src/pdbgproxy.c  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Joel Stanley May 3, 2022, 6:54 a.m. UTC | #1
On Wed, 20 Apr 2022 at 06:50, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> p10.dts.m4 defines compatible = "ibm,power-thread", "ibm,power10-thread"
> which fails to match on a basic strcmp.
>
> Use pdbg_target_compatible() for matching threads. Also document another
> case in hwunit.c that is using strcmp (seems to be the only other place
> in the tree that does).
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

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

> ---
>  libpdbg/hwunit.c | 1 +
>  src/pdbgproxy.c  | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libpdbg/hwunit.c b/libpdbg/hwunit.c
> index 074ddef5..f64ec440 100644
> --- a/libpdbg/hwunit.c
> +++ b/libpdbg/hwunit.c
> @@ -44,6 +44,7 @@ static const struct hw_unit_info *find_driver(enum pdbg_backend backend,
>                 p = g_hw_unit[backend][i];
>                 target = p->hw_unit;
>
> +               // XXX: should this be using pdbg_target_compatible?
>                 if (!strcmp(target->compatible, compat))
>                         return p;
>         }
> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> index 5a8b5f99..906ed2f6 100644
> --- a/src/pdbgproxy.c
> +++ b/src/pdbgproxy.c
> @@ -532,8 +532,8 @@ static int gdbserver(uint16_t port)
>
>         //
>         // Temporary until I can get this working a bit smoother on p9
> -       if (strcmp(thread->compatible, "ibm,power8-thread")) {
> -               PR_ERROR("GDBSERVER is only tested on POWER8\n");
> +       if (!pdbg_target_compatible(thread, "ibm,power8-thread")) {
> +               PR_ERROR("GDBSERVER is only available on POWER8\n");
>                 return -1;
>         }
>
> --
> 2.35.1
>
> --
> Pdbg mailing list
> Pdbg@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
diff mbox series

Patch

diff --git a/libpdbg/hwunit.c b/libpdbg/hwunit.c
index 074ddef5..f64ec440 100644
--- a/libpdbg/hwunit.c
+++ b/libpdbg/hwunit.c
@@ -44,6 +44,7 @@  static const struct hw_unit_info *find_driver(enum pdbg_backend backend,
 		p = g_hw_unit[backend][i];
 		target = p->hw_unit;
 
+		// XXX: should this be using pdbg_target_compatible?
 		if (!strcmp(target->compatible, compat))
 			return p;
 	}
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index 5a8b5f99..906ed2f6 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -532,8 +532,8 @@  static int gdbserver(uint16_t port)
 
 	//
 	// Temporary until I can get this working a bit smoother on p9
-	if (strcmp(thread->compatible, "ibm,power8-thread")) {
-		PR_ERROR("GDBSERVER is only tested on POWER8\n");
+	if (!pdbg_target_compatible(thread, "ibm,power8-thread")) {
+		PR_ERROR("GDBSERVER is only available on POWER8\n");
 		return -1;
 	}