Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/4] gdb.base/callfuncs.exp: Adjust for Windows
Date: Wed, 22 Jul 2026 19:42:38 +0100	[thread overview]
Message-ID: <878q72q31d.fsf@redhat.com> (raw)
In-Reply-To: <06c8b831-aa8c-4ed4-8a2d-29065f643f93@palves.net>

Pedro Alves <pedro@palves.net> writes:

> On 2026-07-16 22:26, Andrew Burgess wrote:
>> Pedro Alves <pedro@palves.net> writes:
>>> Strictly speaking, either of the changes alone would fix it, but I
>>> think both are useful to do.
>> 
>> Is this true?  After the first perform_all_tests call GDB is still
>> running and has the executable file open.  Without the separate
>> filenames the second build_executable call will try to change the
>> executable that GDB holds open.
>
> Right, that was sloppy last minute editing, didn't think it that well.
> Sorry about that.  I was originally going to add add a gdb_exit before the
> second compilation, but that would end up more complicated, and I realized
> I might as well make the programs have different names, and clean_restart is
> handy to reload the new executable, and so I didn't need the gdb_exit
> any longer...
>
>
>> Not that I object to these changes, I just disagree with the last
>> sentence as I don't think the clean_restart change alone will fix the
>> problem.
>> 
>> Reviewed-By: Andrew Burgess <aburgess@redhat.com>
>> 
>
> I've removed that last sentence, and added "to pick up the new executable." to
> the preceding one.
>
> From a08b0bf87322cc11aace49407382e0f9c4e92078 Mon Sep 17 00:00:00 2001
> From: Pedro Alves <pedro@palves.net>
> Date: Tue, 14 Jul 2026 19:48:30 +0100
> Subject: [PATCH] gdb.base/callfuncs.exp: Adjust for Windows
>
> On Windows, gdb.base/callfuncs.exp currently ends up skipping the
> "noproto" tests, like:
>
>  UNTESTED: gdb.base/callfuncs.exp: noproto: failed to prepare
>
> This is because the testcase tries to overwrite the executable while
> GDB has the executable still open, which doesn't work on Windows:
>
>  Executing on host: x86_64-w64-mingw32-gcc ... -o .../gdb.base/callfuncs/callfuncs
>  .../x86_64-w64-mingw32/bin/ld.exe: cannot open output file .../gdb.base/callfuncs/callfuncs.exe: Permission denied
>
> Fix this with two changes:
>
>  - 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.
>
>  - Restart GDB instead of just re-running to main, to pick up the new
>    executable.

LGTM.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

>
> Change-Id: I496e0da65f9d484079c5d9a1222104bec39ee98b
> ---
>  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
>  
> -proc rerun_and_prepare {} {
> +proc rerun_and_prepare {prototypes} {
>      global rerun_count
>  
> +    clean_restart $::testfile-$prototypes
> +
>      incr rerun_count
>      with_test_prefix "rerun number ${rerun_count}" {
>  
> +	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 {} {
>  }
>  
>  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
>  
>      # Save all register contents.
>      set old_reg_content \
> @@ -382,7 +384,7 @@ proc perform_all_tests {prototypes} {
>  	fail "gdb function calls preserve register contents"
>      }
>  
> -    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} {
>  		 }
>  	     }
>  
> -    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} {
>  		 }
>  	     }
>  
> -    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} {
>  		 }
>  	     }
>  
> -    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} {
>  
>  # Perform all tests with and without function prototypes.
>  
> -if { ![prepare_for_testing "failed to prepare" $testfile $srcfile "$compile_flags additional_flags=-DPROTOTYPES"] } {
> +if { ![build_executable "failed to build" $testfile-1 $srcfile "$compile_flags additional_flags=-DPROTOTYPES"] } {
>      perform_all_tests 1
>  }
>  
>  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=-DNO_PROTOTYPES"] } {
>  	perform_all_tests 0
>      }
>
> base-commit: 490469846dcef89fe53668bdbba73591c64bed61
> prerequisite-patch-id: 4252e00ad379be8852a564f351cbd3e3b8a5f0ec
> -- 
> 2.54.0


  reply	other threads:[~2026-07-22 18:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 22:06 [PATCH 0/4] gdb/testsuite: "long double" infcall tests Pedro Alves
2026-07-14 22:06 ` [PATCH 1/4] gdb.base/nodebug.exp: Add long double testing Pedro Alves
2026-07-16 21:14   ` Andrew Burgess
2026-07-17 13:59     ` Pedro Alves
2026-07-22 18:41       ` Andrew Burgess
2026-07-14 22:06 ` [PATCH 2/4] gdb.base/callfuncs.exp: Adjust for Windows Pedro Alves
2026-07-14 22:25   ` Pedro Alves
2026-07-16 21:26     ` Andrew Burgess
2026-07-17 14:27       ` Pedro Alves
2026-07-22 18:42         ` Andrew Burgess [this message]
2026-07-14 22:06 ` [PATCH 3/4] gdb.base/callfuncs.c: factor out float/double functions Pedro Alves
2026-07-16 21:33   ` Andrew Burgess
2026-07-14 22:06 ` [PATCH 4/4] gdb.base/callfuncs.exp: Exercise "long double" Pedro Alves
2026-07-16 21:36   ` Andrew Burgess
2026-07-22 13:01 ` [PATCH 0/4] gdb/testsuite: "long double" infcall tests Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878q72q31d.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox