[binutils-gdb] gdb.base/callfuncs.exp: Adjust for Windows
Pedro Alves via Gdb-cvs <[email protected]> Wed, 22 Jul 2026 13:01:02 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5ad0c48c7811= a5f96fd696208fd926a15f8ce24b commit 5ad0c48c7811a5f96fd696208fd926a15f8ce24b Author: Pedro Alves <[email protected]> Date: Tue Jul 14 19:48:30 2026 +0100 gdb.base/callfuncs.exp: Adjust for Windows =20 On Windows, gdb.base/callfuncs.exp currently ends up skipping the "noproto" tests, like: =20 UNTESTED: gdb.base/callfuncs.exp: noproto: failed to prepare =20 This is because the testcase tries to overwrite the executable while GDB has the executable still open, which doesn't work on Windows: =20 Executing on host: x86_64-w64-mingw32-gcc ... -o .../gdb.base/callfunc= s/callfuncs .../x86_64-w64-mingw32/bin/ld.exe: cannot open output file .../gdb.bas= e/callfuncs/callfuncs.exe: Permission denied =20 Fix this with two changes: =20 - Compile the prototyped and non-prototyped executables to two separate executables. This is just what we normally do, so that it's convenient to test manually against either of the executables. =20 - Restart GDB instead of just re-running to main, to pick up the new executable. =20 Reviewed-By: Andrew Burgess <[email protected]> Change-Id: I496e0da65f9d484079c5d9a1222104bec39ee98b Diff: --- gdb/testsuite/gdb.base/callfuncs.exp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/= callfuncs.exp index f2870c577f2..0ac1c603351 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -334,12 +334,18 @@ proc fetch_all_registers {test} { # Global used by RERUN_AND_PREPARE to make test names unique. set rerun_count 0 =20 -proc rerun_and_prepare {} { +proc rerun_and_prepare {prototypes} { global rerun_count =20 + clean_restart $::testfile-$prototypes + incr rerun_count with_test_prefix "rerun number ${rerun_count}" { =20 + gdb_test_no_output "set print sevenbit-strings" + gdb_test_no_output "set print address off" + gdb_test_no_output "set width 0" + if { ![runto_main] } { return } @@ -359,11 +365,7 @@ proc rerun_and_prepare {} { } =20 proc perform_all_tests {prototypes} { - gdb_test_no_output "set print sevenbit-strings" - gdb_test_no_output "set print address off" - gdb_test_no_output "set width 0" - - rerun_and_prepare + rerun_and_prepare $prototypes =20 # Save all register contents. set old_reg_content \ @@ -382,7 +384,7 @@ proc perform_all_tests {prototypes} { fail "gdb function calls preserve register contents" } =20 - rerun_and_prepare + rerun_and_prepare $prototypes # Save all register contents. set old_reg_content \ [fetch_all_registers "retrieve original register contents 2"] @@ -408,7 +410,7 @@ proc perform_all_tests {prototypes} { } } =20 - rerun_and_prepare + rerun_and_prepare $prototypes # Set breakpoint at a function we will call from gdb. gdb_breakpoint add # Save all register contents. @@ -434,7 +436,7 @@ proc perform_all_tests {prototypes} { } } =20 - rerun_and_prepare + rerun_and_prepare $prototypes # Set breakpoint at a function we will call from gdb. gdb_breakpoint add # Save all register contents. @@ -459,7 +461,7 @@ proc perform_all_tests {prototypes} { } } =20 - rerun_and_prepare + rerun_and_prepare $prototypes # Set breakpoint at a function we will call from gdb. gdb_breakpoint add set old_reg_content \ @@ -547,12 +549,12 @@ proc perform_all_tests {prototypes} { =20 # Perform all tests with and without function prototypes. =20 -if { ![prepare_for_testing "failed to prepare" $testfile $srcfile "$compil= e_flags additional_flags=3D-DPROTOTYPES"] } { +if { ![build_executable "failed to build" $testfile-1 $srcfile "$compile_f= lags additional_flags=3D-DPROTOTYPES"] } { perform_all_tests 1 } =20 with_test_prefix "noproto" { - if { ![prepare_for_testing "failed to prepare" $testfile $srcfile \ + if { ![build_executable "failed to build" $testfile-0 $srcfile \ "$compile_flags additional_flags=3D-DNO_PROTOTYPES"] } { perform_all_tests 0 }