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

Nicholas Piggin npiggin at gmail.com
Wed Apr 20 16:49:43 AEST 2022


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 at gmail.com>
---
 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



More information about the Pdbg mailing list