Commit 00eb02b4f5 for qemu.org
commit 00eb02b4f5f5ad56bd3a302c364e5579d3f9a5db
Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Date: Thu Aug 27 22:15:00 2026 +0000
configure: directly pass gdb path as a meson option
Move the remaining bit of the detection logic to meson. We can assume
gdb can be probed since gdb-9 has been published more than 6 years ago.
If ./configure --gdb is set, make sure the given program exists by using
find_program(..., required: true).
Also, using a proper meson option lists this at end of meson summary.
Tested-by: Aniket Sahu <asahu1x@linux.ibm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260827221506.91574-100-pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/configure b/configure
index cb5fdfed22..cec6f18f85 100755
--- a/configure
+++ b/configure
@@ -263,8 +263,6 @@ skip_meson=no
use_containers="yes"
rust="disabled"
rust_target_triple=""
-gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
-gdb_arches=""
# Don't accept a target_list environment variable.
unset target_list
@@ -737,7 +735,7 @@ for opt do
;;
--rust-target-triple=*) rust_target_triple="$optarg"
;;
- --gdb=*) gdb_bin="$optarg"
+ --gdb=*) meson_option_add -Dgdb="$optarg"
;;
--enable-rust) rust=enabled
;;
@@ -869,7 +867,7 @@ Advanced options (experts only):
--cpu=CPU Build for host CPU [$cpu]
--disable-containers don't use containers for cross-building
--container-command=CMD which container command to use [autodetect]
- --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
+ --gdb=GDB-path gdb to use for gdbstub tests [autodetect]
--wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default
is to use the whole 64-bit range).
EOF
@@ -1120,20 +1118,6 @@ if test "$tcg" = "auto"; then
fi
fi
-#########################################
-# gdb test
-
-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)
- else
- gdb_bin=""
- fi
-fi
-
##########################################
# big/little endian test
cat > $TMPC << EOF
@@ -1734,7 +1718,6 @@ echo all: >> $config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
echo "TARGET_DIRS=$target_list" >> $config_host_mak
-echo "GDB=$gdb_bin" >> $config_host_mak
if test "$container_command" != ""; then
echo "CONTAINER_COMMAND=$container_command" >> $config_host_mak
fi
@@ -1930,7 +1913,6 @@ if test "$skip_meson" = no; then
test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
test "$plugins" = yes && meson_option_add "-Dplugins=true"
test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
- test -n "$gdb_bin" && meson_option_add "-Dgdb=$gdb_bin"
run_meson() {
NINJA=$ninja $meson setup "$@" "$PWD" "$source_path"
diff --git a/meson_options.txt b/meson_options.txt
index d8f59cf92c..a41ed64bc9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -36,7 +36,7 @@ option('trace_file', type: 'string', value: 'trace',
option('coroutine_backend', type: 'combo',
choices: ['ucontext', 'sigaltstack', 'windows', 'wasm', 'auto'],
value: 'auto', description: 'coroutine backend to use')
-option('gdb', type: 'string', value: '',
+option('gdb', type: 'string',
description: 'Path to GDB')
# Everything else can be set via --enable/--disable-* option
diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 76f8f3e6e0..144577fd94 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -1,11 +1,11 @@
env = find_program('env')
docker_wrapper = find_program('../docker/docker.py')
-gdb_progs = ['gdb-multiarch', 'gdb']
-if config_host.has_key('GDB')
- gdb_progs = [config_host['GDB'], gdb_progs]
+if get_option('gdb') != ''
+ gdb = find_program(get_option('gdb'), required: true)
+else
+ gdb = find_program(['gdb-multiarch', 'gdb'], required: false)
endif
-gdb = find_program(gdb_progs, required: false)
prog_check_plugin_output = find_program('./scripts/check_plugin_output.sh')
prog_gdb_test = find_program('../guest-debug/run-test.py')
prog_record_replay = find_program('./scripts/record_replay.sh')