[PATCH v2 37/47] gdbserver: allow configuring for a heterogeneous target

Tankut Baris Aktemur
2024-12-13T16:33:58Z

gdbserver's configure.srv requires host and target systems to be the
same. This prevents building gdbserver for when a target other than
the native CPU is to be debugged, e.g. a heterogeneous system with an
Intel GPU where we want to debug the GPU.

Allow for such a combination by special-casing the Intel GPU target to
preserve the existing behavior for other cases.
---
gdbserver/configure.srv | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
index ffc84948317b2df667b75d5758bd67968c852967..db3f5631a417d3706829cfd8206ccf08c872a6c1 100644
--- a/gdbserver/configure.srv
+++ b/gdbserver/configure.srv
@@ -30,11 +30,18 @@ srv_linux_obj="linux-low.o nat/linux-osdata.o nat/linux-procfs.o nat/linux-ptrac

# Input is taken from the "${host}" and "${target}" variables.

-# GDBserver can only debug native programs.
+# GDBserver can only debug native programs. An exception to this is a
+# heterogeneous system, e.g. an Intel GPU.
if test "${target}" = "${host}"; then
gdbserver_host=${host}
else
- gdbserver_host=
+ case "${target}" in
+ intelgt*) gdbserver_host=${target}
+ ;;
+
+ *) gdbserver_host=
+ ;;
+ esac
fi

case "${gdbserver_host}" in