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. Signed-off-by: Pierrick Bouvier <[email protected]> --- configure | 22 ++-------------------- meson_options.txt | 2 +- tests/tcg/meson.build | 8 ++++---- 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/configure b/configure index 0ae20b7cdfc..06af81e18f6 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 @@ -738,7 +736,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 ;; @@ -870,7 +868,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 @@ -1121,20 +1119,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 @@ -1735,7 +1719,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 @@ -1934,7 +1917,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 a07cb47d35e..d2bf5ca1f53 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 88b2a6337bb..120634ae0b0 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') -- 2.47.3
