From b50420fd058824ecc737709f49f87d622b0f3371 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 6 Mar 2023 16:49:19 +0100 Subject: [PATCH] [gdb/testsuite] Use regular proc syntax for gdb_caching_proc A regular tcl proc with no args looks like: ... proc foo {} { return 1 } ... but a gdb_caching_proc deviates from that syntax by dropping the explicit no args bit: ... gdb_caching_proc foo { return 1 } ... Make the gdb_caching_proc use the same syntax as regular procs, such that we have instead: ... gdb_caching_proc foo {} { return 1 } ... Tested on x86_64-linux. Reviewed-By: Tom Tromey --- .../gdb.testsuite/gdb-caching-proc.exp | 2 +- gdb/testsuite/lib/ada.exp | 2 +- gdb/testsuite/lib/cache.exp | 5 +- gdb/testsuite/lib/gdb-guile.exp | 2 +- gdb/testsuite/lib/gdb.exp | 104 +++++++++--------- gdb/testsuite/lib/opencl.exp | 2 +- gdb/testsuite/lib/rocm.exp | 2 +- gdb/testsuite/lib/rust-support.exp | 4 +- 8 files changed, 63 insertions(+), 60 deletions(-) diff --git a/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp b/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp index de35c046185..33a21df8f13 100644 --- a/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp +++ b/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp @@ -12,7 +12,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -gdb_caching_proc gdb_testsuite_gdb_caching_proc_exp_noarg { +gdb_caching_proc gdb_testsuite_gdb_caching_proc_exp_noarg {} { incr ::count return 1 } diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index f5bf2dcbb71..02a5d1ad271 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -166,7 +166,7 @@ proc gnatmake_version_at_least { major } { # Return 1 if the GNAT runtime appears to have debug info. -gdb_caching_proc gnat_runtime_has_debug_info { +gdb_caching_proc gnat_runtime_has_debug_info {} { global srcdir set src "$srcdir/lib/gnat_debug_info_test.adb" diff --git a/gdb/testsuite/lib/cache.exp b/gdb/testsuite/lib/cache.exp index b9f64837e66..5c44ed8dcf7 100644 --- a/gdb/testsuite/lib/cache.exp +++ b/gdb/testsuite/lib/cache.exp @@ -121,7 +121,10 @@ proc gdb_do_cache {name} { # results, both in memory and, if GDB_PARALLEL is defined, in the # filesystem for use across invocations of dejagnu. -proc gdb_caching_proc {name body} { +proc gdb_caching_proc {name arglist body} { + if { [llength $arglist] != 0 } { + error "gdb_caching_proc with non-empty args list" + } # Define the underlying proc that we'll call. set real_name gdb_real__$name proc $real_name {} $body diff --git a/gdb/testsuite/lib/gdb-guile.exp b/gdb/testsuite/lib/gdb-guile.exp index 50189c8ed90..3451022c3e9 100644 --- a/gdb/testsuite/lib/gdb-guile.exp +++ b/gdb/testsuite/lib/gdb-guile.exp @@ -20,7 +20,7 @@ set ghex {[0-9a-f]+} # Return a 1 for configurations that support Guile scripting. -gdb_caching_proc allow_guile_tests { +gdb_caching_proc allow_guile_tests {} { set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS --configuration"] return [expr {[string first "--with-guile" $output] != -1}] } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 19c782bea46..04d49e658ba 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2448,7 +2448,7 @@ proc allow_rust_tests {} { # Return a 1 for configurations that support Python scripting. -gdb_caching_proc allow_python_tests { +gdb_caching_proc allow_python_tests {} { set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS --configuration"] return [expr {[string first "--with-python" $output] != -1}] } @@ -2477,7 +2477,7 @@ proc allow_shlib_tests {} { # Return 1 if we should run dlmopen tests, 0 if we should not. -gdb_caching_proc allow_dlmopen_tests { +gdb_caching_proc allow_dlmopen_tests {} { global srcdir subdir gdb_prompt inferior_exited_re # We need shared library support. @@ -2573,7 +2573,7 @@ gdb_caching_proc allow_dlmopen_tests { # Return 1 if we should allow TUI-related tests. -gdb_caching_proc allow_tui_tests { +gdb_caching_proc allow_tui_tests {} { set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS --configuration"] return [expr {[string first "--enable-tui" $output] != -1}] } @@ -3164,7 +3164,7 @@ proc with_read1_timeout_factor { factor body } { # Return 1 if _Complex types are supported, otherwise, return 0. -gdb_caching_proc support_complex_tests { +gdb_caching_proc support_complex_tests {} { if { ![allow_float_test] } { # If floating point is not supported, _Complex is not @@ -3185,7 +3185,7 @@ gdb_caching_proc support_complex_tests { } # Return 1 if compiling go is supported. -gdb_caching_proc support_go_compile { +gdb_caching_proc support_go_compile {} { return [gdb_can_simple_compile go-hello { package main @@ -3209,7 +3209,7 @@ proc supports_get_siginfo_type {} { # Return 1 if memory tagging is supported at runtime, otherwise return 0. -gdb_caching_proc supports_memtag { +gdb_caching_proc supports_memtag {} { global gdb_prompt gdb_test_multiple "memory-tag check" "" { @@ -3301,7 +3301,7 @@ proc readline_is_used { } { } # Return 1 if target is ELF. -gdb_caching_proc is_elf_target { +gdb_caching_proc is_elf_target {} { set me "is_elf_target" set src { int foo () {return 0;} } @@ -3329,7 +3329,7 @@ gdb_caching_proc is_elf_target { # Return 1 if the memory at address zero is readable. -gdb_caching_proc is_address_zero_readable { +gdb_caching_proc is_address_zero_readable {} { global gdb_prompt set ret 0 @@ -3358,7 +3358,7 @@ proc gdb_produce_source { name sources } { # Return 1 if target is ILP32. # This cannot be decided simply from looking at the target string, # as it might depend on externally passed compiler options like -m64. -gdb_caching_proc is_ilp32_target { +gdb_caching_proc is_ilp32_target {} { return [gdb_can_simple_compile is_ilp32_target { int dummy[sizeof (int) == 4 && sizeof (void *) == 4 @@ -3369,7 +3369,7 @@ gdb_caching_proc is_ilp32_target { # Return 1 if target is LP64. # This cannot be decided simply from looking at the target string, # as it might depend on externally passed compiler options like -m64. -gdb_caching_proc is_lp64_target { +gdb_caching_proc is_lp64_target {} { return [gdb_can_simple_compile is_lp64_target { int dummy[sizeof (int) == 4 && sizeof (void *) == 8 @@ -3380,7 +3380,7 @@ gdb_caching_proc is_lp64_target { # Return 1 if target has 64 bit addresses. # This cannot be decided simply from looking at the target string, # as it might depend on externally passed compiler options like -m64. -gdb_caching_proc is_64_target { +gdb_caching_proc is_64_target {} { return [gdb_can_simple_compile is_64_target { int function(void) { return 3; } int dummy[sizeof (&function) == 8 ? 1 : -1]; @@ -3390,7 +3390,7 @@ gdb_caching_proc is_64_target { # Return 1 if target has x86_64 registers - either amd64 or x32. # x32 target identifies as x86_64-*-linux*, therefore it cannot be determined # just from the target string. -gdb_caching_proc is_amd64_regs_target { +gdb_caching_proc is_amd64_regs_target {} { if {![istarget "x86_64-*-*"] && ![istarget "i?86-*"]} { return 0 } @@ -3420,7 +3420,7 @@ proc is_x86_64_m64_target {} { # Return 1 if this target is an arm or aarch32 on aarch64. -gdb_caching_proc is_aarch32_target { +gdb_caching_proc is_aarch32_target {} { if { [istarget "arm*-*-*"] } { return 1 } @@ -3464,7 +3464,7 @@ proc support_displaced_stepping {} { # Run a test on the target to see if it supports vmx hardware. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. -gdb_caching_proc allow_altivec_tests { +gdb_caching_proc allow_altivec_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_altivec_tests" @@ -3534,7 +3534,7 @@ gdb_caching_proc allow_altivec_tests { } # Run a test on the power target to see if it supports ISA 3.1 instructions -gdb_caching_proc allow_power_isa_3_1_tests { +gdb_caching_proc allow_power_isa_3_1_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_power_isa_3_1_tests" @@ -3583,7 +3583,7 @@ gdb_caching_proc allow_power_isa_3_1_tests { # Run a test on the target to see if it supports vmx hardware. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. -gdb_caching_proc allow_vsx_tests { +gdb_caching_proc allow_vsx_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_vsx_tests" @@ -3652,7 +3652,7 @@ gdb_caching_proc allow_vsx_tests { # Run a test on the target to see if it supports TSX hardware. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. -gdb_caching_proc allow_tsx_tests { +gdb_caching_proc allow_tsx_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_tsx_tests" @@ -3701,7 +3701,7 @@ gdb_caching_proc allow_tsx_tests { # Run a test on the target to see if it supports avx512bf16. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. -gdb_caching_proc allow_avx512bf16_tests { +gdb_caching_proc allow_avx512bf16_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_avx512bf16_tests" @@ -3752,7 +3752,7 @@ gdb_caching_proc allow_avx512bf16_tests { # Run a test on the target to see if it supports avx512fp16. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. -gdb_caching_proc allow_avx512fp16_tests { +gdb_caching_proc allow_avx512fp16_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_avx512fp16_tests" @@ -3803,7 +3803,7 @@ gdb_caching_proc allow_avx512fp16_tests { # Run a test on the target to see if it supports btrace hardware. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. -gdb_caching_proc allow_btrace_tests { +gdb_caching_proc allow_btrace_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_btrace_tests" @@ -3854,7 +3854,7 @@ gdb_caching_proc allow_btrace_tests { # Return 1 if so, 0 if it does not. Based on 'check_vmx_hw_available' # from the GCC testsuite. -gdb_caching_proc allow_btrace_pt_tests { +gdb_caching_proc allow_btrace_pt_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_btrace_pt_tests" @@ -3907,7 +3907,7 @@ gdb_caching_proc allow_btrace_pt_tests { # Run a test on the target to see if it supports Aarch64 SVE hardware. # Return 1 if so, 0 if it does not. Note this causes a restart of GDB. -gdb_caching_proc allow_aarch64_sve_tests { +gdb_caching_proc allow_aarch64_sve_tests {} { global srcdir subdir gdb_prompt inferior_exited_re set me "allow_aarch64_sve_tests" @@ -3963,17 +3963,17 @@ proc gdb_int128_helper {lang} { } # Return true if the C compiler understands the __int128 type. -gdb_caching_proc has_int128_c { +gdb_caching_proc has_int128_c {} { return [gdb_int128_helper c] } # Return true if the C++ compiler understands the __int128 type. -gdb_caching_proc has_int128_cxx { +gdb_caching_proc has_int128_cxx {} { return [gdb_int128_helper c++] } # Return true if the IFUNC feature is supported. -gdb_caching_proc allow_ifunc_tests { +gdb_caching_proc allow_ifunc_tests {} { if [gdb_can_simple_compile ifunc { extern void f_ (); typedef void F (void); @@ -4246,7 +4246,7 @@ proc use_gdb_stub {} { # Return 1 if the current remote target is an instance of our GDBserver, 0 # otherwise. Return -1 if there was an error and we can't tell. -gdb_caching_proc target_is_gdbserver { +gdb_caching_proc target_is_gdbserver {} { global gdb_prompt set is_gdbserver -1 @@ -4525,7 +4525,7 @@ proc gdb_wrapper_init { args } { } # Determine options that we always want to pass to the compiler. -gdb_caching_proc universal_compile_options { +gdb_caching_proc universal_compile_options {} { set me "universal_compile_options" set options {} @@ -6821,7 +6821,7 @@ proc exec_has_index_section { executable } { } # Return list with major and minor version of readelf, or an empty list. -gdb_caching_proc readelf_version { +gdb_caching_proc readelf_version {} { set readelf_program [gdb_find_readelf] set res [catch {exec $readelf_program --version} output] if { $res != 0 } { @@ -6880,7 +6880,7 @@ proc exec_is_pie { executable } { # point support or GDB can't fetch the contents from floating point # registers. -gdb_caching_proc allow_float_test { +gdb_caching_proc allow_float_test {} { if [target_info exists gdb,skip_float_tests] { return 0 } @@ -6993,7 +6993,7 @@ proc gdb_skip_bogus_test { msg } { # Return true if XML support is enabled in the host GDB. # NOTE: This must be called while gdb is *not* running. -gdb_caching_proc allow_xml_test { +gdb_caching_proc allow_xml_test {} { global gdb_spawn_id global gdb_prompt global srcdir @@ -7018,7 +7018,7 @@ gdb_caching_proc allow_xml_test { # Return true if argv[0] is available. -gdb_caching_proc gdb_has_argv0 { +gdb_caching_proc gdb_has_argv0 {} { set result 0 # Compile and execute a test program to check whether argv[0] is available. @@ -7729,7 +7729,7 @@ proc get_endianness { } { } # Get the target's default endianness and return it. -gdb_caching_proc target_endianness { +gdb_caching_proc target_endianness {} { global gdb_prompt set me "target_endianness" @@ -7938,7 +7938,7 @@ proc core_find {binfile {deletefiles {}} {arg ""}} { # the output from objdump to determine the prefix (such as underscore) # for linker symbol prefixes. -gdb_caching_proc gdb_target_symbol_prefix { +gdb_caching_proc gdb_target_symbol_prefix {} { # Compile a simple test program... set src { int main() { return 0; } } if {![gdb_simple_compile target_symbol_prefix $src executable]} { @@ -7963,7 +7963,7 @@ gdb_caching_proc gdb_target_symbol_prefix { # Return 1 if target supports scheduler locking, otherwise return 0. -gdb_caching_proc target_supports_scheduler_locking { +gdb_caching_proc target_supports_scheduler_locking {} { global gdb_prompt set me "gdb_target_supports_scheduler_locking" @@ -8022,7 +8022,7 @@ gdb_caching_proc target_supports_scheduler_locking { # Return 1 if compiler supports use of nested functions. Otherwise, # return 0. -gdb_caching_proc support_nested_function_tests { +gdb_caching_proc support_nested_function_tests {} { # Compile a test program containing a nested function return [gdb_can_simple_compile nested_func { int main () { @@ -8550,7 +8550,7 @@ proc cmp_binary_files { file1 file2 } { # flag? If not then we should skip these tests. We should also # skip them if libctf was explicitly disabled. -gdb_caching_proc allow_ctf_tests { +gdb_caching_proc allow_ctf_tests {} { global enable_libctf if {$enable_libctf eq "no"} { @@ -8569,7 +8569,7 @@ gdb_caching_proc allow_ctf_tests { # Return 1 if compiler supports -gstatement-frontiers. Otherwise, # return 0. -gdb_caching_proc supports_statement_frontiers { +gdb_caching_proc supports_statement_frontiers {} { return [gdb_can_simple_compile supports_statement_frontiers { int main () { return 0; @@ -8580,7 +8580,7 @@ gdb_caching_proc supports_statement_frontiers { # Return 1 if compiler supports -mmpx -fcheck-pointer-bounds. Otherwise, # return 0. -gdb_caching_proc supports_mpx_check_pointer_bounds { +gdb_caching_proc supports_mpx_check_pointer_bounds {} { set flags "additional_flags=-mmpx additional_flags=-fcheck-pointer-bounds" return [gdb_can_simple_compile supports_mpx_check_pointer_bounds { int main () { @@ -8592,7 +8592,7 @@ gdb_caching_proc supports_mpx_check_pointer_bounds { # Return 1 if compiler supports -fcf-protection=. Otherwise, # return 0. -gdb_caching_proc supports_fcf_protection { +gdb_caching_proc supports_fcf_protection {} { return [gdb_can_simple_compile supports_fcf_protection { int main () { return 0; @@ -8864,7 +8864,7 @@ proc gdb_note { message } { } # Return 1 if compiler supports -fuse-ld=gold, otherwise return 0. -gdb_caching_proc have_fuse_ld_gold { +gdb_caching_proc have_fuse_ld_gold {} { set me "have_fuse_ld_gold" set flags "additional_flags=-fuse-ld=gold" set src { int main() { return 0; } } @@ -8872,7 +8872,7 @@ gdb_caching_proc have_fuse_ld_gold { } # Return 1 if compiler supports fvar-tracking, otherwise return 0. -gdb_caching_proc have_fvar_tracking { +gdb_caching_proc have_fvar_tracking {} { set me "have_fvar_tracking" set flags "additional_flags=-fvar-tracking" set src { int main() { return 0; } } @@ -8880,7 +8880,7 @@ gdb_caching_proc have_fvar_tracking { } # Return 1 if linker supports -Ttext-segment, otherwise return 0. -gdb_caching_proc linker_supports_Ttext_segment_flag { +gdb_caching_proc linker_supports_Ttext_segment_flag {} { set me "linker_supports_Ttext_segment_flag" set flags ldflags="-Wl,-Ttext-segment=0x7000000" set src { int main() { return 0; } } @@ -8888,7 +8888,7 @@ gdb_caching_proc linker_supports_Ttext_segment_flag { } # Return 1 if linker supports -Ttext, otherwise return 0. -gdb_caching_proc linker_supports_Ttext_flag { +gdb_caching_proc linker_supports_Ttext_flag {} { set me "linker_supports_Ttext_flag" set flags ldflags="-Wl,-Ttext=0x7000000" set src { int main() { return 0; } } @@ -8896,7 +8896,7 @@ gdb_caching_proc linker_supports_Ttext_flag { } # Return 1 if linker supports --image-base, otherwise 0. -gdb_caching_proc linker_supports_image_base_flag { +gdb_caching_proc linker_supports_image_base_flag {} { set me "linker_supports_image_base_flag" set flags ldflags="-Wl,--image-base=0x7000000" set src { int main() { return 0; } } @@ -8906,7 +8906,7 @@ gdb_caching_proc linker_supports_image_base_flag { # Return 1 if compiler supports scalar_storage_order attribute, otherwise # return 0. -gdb_caching_proc supports_scalar_storage_order_attribute { +gdb_caching_proc supports_scalar_storage_order_attribute {} { set me "supports_scalar_storage_order_attribute" set src { #include @@ -8940,7 +8940,7 @@ gdb_caching_proc supports_scalar_storage_order_attribute { } # Return 1 if compiler supports __GNUC__, otherwise return 0. -gdb_caching_proc supports_gnuc { +gdb_caching_proc supports_gnuc {} { set me "supports_gnuc" set src { #ifndef __GNUC__ @@ -8951,7 +8951,7 @@ gdb_caching_proc supports_gnuc { } # Return 1 if target supports mpx, otherwise return 0. -gdb_caching_proc have_mpx { +gdb_caching_proc have_mpx {} { global srcdir set me "have_mpx" @@ -9026,7 +9026,7 @@ gdb_caching_proc have_mpx { } # Return 1 if target supports avx, otherwise return 0. -gdb_caching_proc have_avx { +gdb_caching_proc have_avx {} { global srcdir set me "have_avx" @@ -9110,7 +9110,7 @@ proc target_file_exists_with_timeout { path } { return 0 } -gdb_caching_proc has_hw_wp_support { +gdb_caching_proc has_hw_wp_support {} { # Power 9, proc rev 2.2 does not support HW watchpoints due to HW bug. # Need to use a runtime test to determine if the Power processor has # support for HW watchpoints. @@ -9218,7 +9218,7 @@ proc get_set_option_choices { set_cmd {set_arg ""} } { # set, use that. If not, try a few common compiler names, making sure # that the executable they produce can run. -gdb_caching_proc arm_cc_for_target { +gdb_caching_proc arm_cc_for_target {} { if {[info exists ::ARM_CC_FOR_TARGET]} { # If the user specified the compiler explicitly, then don't # check whether the resulting binary runs outside GDB. Assume @@ -9327,7 +9327,7 @@ proc is_target_non_stop { {testname ""} } { # # Returns True if it is associated with the closing brace, # False if it is the last statement -gdb_caching_proc have_epilogue_line_info { +gdb_caching_proc have_epilogue_line_info {} { set main { int @@ -9394,7 +9394,7 @@ proc has_dependency { file dep } { # Detect linux kernel version and return as list of 3 numbers: major, minor, # and patchlevel. On failure, return an empty list. -gdb_caching_proc linux_kernel_version { +gdb_caching_proc linux_kernel_version {} { if { ![istarget *-*-linux*] } { return {} } diff --git a/gdb/testsuite/lib/opencl.exp b/gdb/testsuite/lib/opencl.exp index 4c66d2a9ecd..dc7966443d5 100644 --- a/gdb/testsuite/lib/opencl.exp +++ b/gdb/testsuite/lib/opencl.exp @@ -29,7 +29,7 @@ proc gdb_compile_opencl_hostapp {clsource executable options} { # Run a test on the target to check if it supports OpenCL. Return 1 if so, 0 if # it does not. -gdb_caching_proc allow_opencl_tests { +gdb_caching_proc allow_opencl_tests {} { global srcdir objdir subdir gdb_prompt global inferior_exited_re diff --git a/gdb/testsuite/lib/rocm.exp b/gdb/testsuite/lib/rocm.exp index 92e8221b772..b3e435339db 100644 --- a/gdb/testsuite/lib/rocm.exp +++ b/gdb/testsuite/lib/rocm.exp @@ -59,7 +59,7 @@ proc hcc_amdgpu_targets {} { return $targets } -gdb_caching_proc allow_hipcc_tests { +gdb_caching_proc allow_hipcc_tests {} { # Only the native target supports ROCm debugging. E.g., when # testing against GDBserver, there's no point in running the ROCm # tests. diff --git a/gdb/testsuite/lib/rust-support.exp b/gdb/testsuite/lib/rust-support.exp index df517647ce9..f3739e2ce02 100644 --- a/gdb/testsuite/lib/rust-support.exp +++ b/gdb/testsuite/lib/rust-support.exp @@ -80,7 +80,7 @@ proc gdb_compile_rust {sources dest options} { # Return the version of LLVM used by the Rust compiler. Note that # older versions of rustc don't print this -- in this case the # returned version is "0.0". -gdb_caching_proc rust_llvm_version { +gdb_caching_proc rust_llvm_version {} { set rustc [find_rustc] if {$rustc == ""} { verbose "could not find rustc" @@ -97,7 +97,7 @@ gdb_caching_proc rust_llvm_version { } # Return the version of the Rust compiler. -gdb_caching_proc rust_compiler_version { +gdb_caching_proc rust_compiler_version {} { set rustc [find_rustc] if {$rustc == ""} { verbose "could not find rustc" -- 2.30.2