Hi Thomas,

On 9/26/25 15:08, Gustavo Romero wrote:
Hi Thomas,

On 9/26/25 07:03, Thomas Huth wrote:
On 26/09/2025 07.15, Gustavo Romero wrote:
The probe of GDB is done in 'configure' and the full path is passed to
meson.build via the -Dgdb=option.

Because a single functional test can cover different arches, such as
aarch64, ppc64, and x86_64, only a GDB that supports all the arches in
the target list is passed to Meson for use in the functional tests. To
handle this check, a new shell function, is_target_arch_in_arch_list, is
introduced in 'configure'.

Meson then can pass the location of GDB to the test via an environment
variable: QEMU_TEST_GDB.

Signed-off-by: Gustavo Romero <gustavo.rom...@linaro.org>
Signed-off-by: Thomas Huth <th...@redhat.com>
---
  configure                     | 21 +++++++++++++++++++++
  meson_options.txt             |  2 ++
  scripts/meson-buildoptions.sh |  2 ++
  tests/functional/meson.build  |  6 ++++++
  4 files changed, 31 insertions(+)

diff --git a/configure b/configure
index 0f7eb95586..20e05d233f 100755
--- a/configure
+++ b/configure
@@ -1142,12 +1142,31 @@ fi
  #########################################
  # gdb test
+# Check if all target arches are in a provided list of arches.
+is_target_arch_in_arch_list() {
+    arch_list=$1
+    for target in $target_list; do
+        arch=${target%%-*}
+        if test "${arch_list#*$arch}" = "$arch_list"; then
+            # Target arch not in arch list
+            return 1
+        fi
+    done
+    return 0
+}
+
  if test -n "$gdb_bin"; then
      gdb_version_string=$($gdb_bin --version | head -n 1)
      # Extract last field in the version string
      gdb_version=${gdb_version_string##* }
      if version_ge $gdb_version 9.1; then
          gdb_arches=$($python "$source_path/scripts/probe-gdb-support.py" 
$gdb_bin)
+
+    if is_target_arch_in_arch_list "$gdb_arches"; then

No TABs, please!

+            gdb_multiarch="yes"
+        else
+            gdb_multiarch=""
+    fi

This unfortunately does not work with the GDB from Fedora - it only supports "arch64_be arm 
riscv64 riscv32 ppc i386 s390x ppc64 aarch64 ppc64le x86_64", but if you configured a target 
like "alpha-softmmu", this breaks.

argh! ok


(BTW, does the gdb-multiarch from Debian/Ubuntu really also support exotic QEMU 
targets like tricore?)

No, I've checked GDB upstream and I can't see any trace of tricore.
And I just saw that Alex left a comment in scripts/probe-gdb-support.py
saying "# no tricore in upstream gdb", so nope, it seems that it still holds.


I think it would be better to drop this hunk, and rather check in the spot 
where we use GDB if the required target is really there (i.e. in the functional 
test that uses it).

OK. I'm also not a big fan of doing it in bash. How do you suggest
to do it? Directly in the code, via a skipIf decorator, or something else?

$gdb_arches, obtained using scripts/probe-gdb-support.py in configure,
could be passed to meson and meson sets it in the test env, as we're
doing for $gdb_bin and QEMU_TEST_GDB env var. wdyt?


Cheers,
Gustavo

Reply via email to