From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4aFgExsRYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:03:23 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=RqqpJOxD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4A7371E09E; Thu, 23 Jul 2026 09:03:23 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 88E991E099 for ; Thu, 23 Jul 2026 09:03:22 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 552744BA7993 for ; Thu, 23 Jul 2026 13:03:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 552744BA7993 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=RqqpJOxD Received: from gorilla.apple.relay.mailchannels.net (gorilla.apple.relay.mailchannels.net [23.83.208.75]) by sourceware.org (Postfix) with ESMTPS id 05DA64BA7984 for ; Thu, 23 Jul 2026 13:02:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05DA64BA7984 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=palves.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 05DA64BA7984 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.208.75 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811760; cv=none; b=XOmLzBr2WlEoyZsAe6ZNIQeahBFGPlItb1QuqzEVOFDkUBx3191rw2Qj+EOWMJZJ0vYcPvnywFA1tGpABDpwxCquHkbyWDmtcw45lUTJQEEVGjZoUSEzMlepOumBxYbtH5RT31nEDJS0IW/lWRE4jWmmgV6rZTf6oKxk6tJgwZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811760; c=relaxed/simple; bh=Je5F8XlwD81ixLNhlCO1oc39U3WwCxpdYPR9dKhiitI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ebHd+iGT3PzyIZyw3Fp3k4tihg6FTaM1nCyBCd4b4HPxHJD98tuZawiYiCPOuMBU3NhOkBK0MMe81cbq1Z70lD2d0HPQ7Plzo6mr/RsDYaNQGYo1fIIW1t/hnjCD6Sz+YzA8Jt5ZueBuhVqgdaHGExdYhNiMjH54kv+Y6CMuqrE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=RqqpJOxD DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05DA64BA7984 X-Sender-Id: dreamhost|x-authsender|pedro@palves.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D5E5F462C08 for ; Thu, 23 Jul 2026 13:02:38 +0000 (UTC) Received: from pdx1-sub0-mail-a249.dreamhost.com (100-103-99-133.trex-nlb.outbound.svc.cluster.local [100.103.99.133]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3ED9E462CAC for ; Thu, 23 Jul 2026 13:02:36 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|pedro@palves.net X-MC-Relay: Good X-MailChannels-SenderId: dreamhost|x-authsender|pedro@palves.net X-MailChannels-Auth-Id: dreamhost X-Drop-Hook: 3697284f1ad1ea4a_1784811758787_3073799659 X-MC-Loop-Signature: 1784811758787:3566763151 X-MC-Ingress-Time: 1784811758787 Received: from pdx1-sub0-mail-a249.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.99.133 (trex/8.0.2); Thu, 23 Jul 2026 13:02:38 +0000 Received: from localhost (bl20-181-64.dsl.telepac.pt [2.81.181.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pedro@palves.net) by pdx1-sub0-mail-a249.dreamhost.com (Postfix) with ESMTPSA id 4h5WVz4Pjgz105D for ; Thu, 23 Jul 2026 06:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811755; bh=+yjGe2g8MySx4Cy27/7w0f1MEGklPkjRRTfsLTFJluo=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=RqqpJOxDsEMcUGKbeHkDfMg/+RzB5Ue7bntnxks5e38lkXlLiA9wBTeMJ0XiWVO2b hIjZRxwawOrVn9VS4Jo1crDJjj72i9eITzPKv3npTZ2R8YJCpoGcqAfjXOtRMayYZB EfFFX4iV20UR3zWzDgk9C7gEuRjJUZuLL5LJ7+4x802sf3b9A3BVpqrwypRGj3t1tz Js7XcG4gaUBQOBAzovBsOSzU5GxZ0D7xwYf6Kh0BPnwMFg439WVXzhDDV5ZgFQIqER BPAoFJt7C0I+FtpH+EA+vGlvfhV/975R5BVZkHfUOgUlKWlVCbhsGRiqBNKVSYDQfF EXx8/xx22yURA== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 05/27] gdb/testsuite: Recognize windows-msvc across lib/gdb.exp procedures Date: Thu, 23 Jul 2026 14:00:56 +0100 Message-ID: <20260723130118.206735-6-pedro@palves.net> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260723130118.206735-1-pedro@palves.net> References: <20260723130118.206735-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org The testsuite has many istarget checks like e.g.: [istarget *-*-mingw*] || [istarget *-*-cygwin*] and [istarget *-*-mingw*] || [istarget *-*-cygwin*] || [istarget *-*-pe*] to decide Windows- or PE/COFF-specific behavior. These do not match a windows-msvc target, whose triplets are {x86_64,aarch64,i686}-pc-windows-msvc, so on such a configuration the testsuite would take the non-Windows paths and misbehave in many places. Rather than adding windows-msvc to each site by hand, introduce two predicates and replace the existing checks in lib/gdb.exp with them: - is_windows_native_target -- mingw* or windows* triplets, as opposed to Cygwin. - is_pecoff_target -- any Windows-based target or a bare PE target. is_windows_based_target is extended to build on is_windows_native_target so it too picks up windows-msvc. Following patches will go over the testcases throughout using these predicates. Change-Id: I786285c009565ec2d3ddc06c0ba57d466d42e4d0 --- gdb/testsuite/lib/gdb.exp | 62 +++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index fb9f29ee03d..db22d2bc320 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2528,7 +2528,7 @@ proc default_gdb_exit {} { } if { ([is_remote host] && [board_info host exists fileid]) - || [istarget *-*-mingw*] } { + || [is_windows_native_target] } { send_gdb "quit\n" gdb_expect 10 { -re "y or n" { @@ -3102,9 +3102,7 @@ proc allow_shlib_tests {} { if {([istarget *-*-linux*] || [istarget *-*-*bsd*] || [istarget *-*-solaris2*] - || [istarget *-*-mingw*] - || [istarget *-*-cygwin*] - || [istarget *-*-pe*])} { + || [is_pecoff_target])} { return 1 } @@ -3210,7 +3208,7 @@ gdb_caching_proc allow_dlmopen_tests {} { # Return 1 if we should allow TUI-related tests. gdb_caching_proc allow_tui_tests {} { - if { [istarget *-*-mingw*] } { + if { [is_windows_native_target] } { # Avoid "Cannot enable the TUI when output is not a terminal". return 0 } @@ -4217,10 +4215,25 @@ proc is_aarch64_target {} { return [expr {![is_aarch32_target]}] } +# Return true if the target is Windows native (as opposed to Cygwin). + +proc is_windows_native_target {} { + return [expr {[istarget *-*-mingw*] + || [istarget *-*-windows*]}] +} + # Return true if the target is Windows-based. proc is_windows_based_target {} { - return [expr {[istarget *-*-cygwin*] || [istarget *-*-mingw*]}] + return [expr {[istarget *-*-cygwin*] + || [is_windows_native_target]}] +} + +# Return true if the target is PE/COFF-based. + +proc is_pecoff_target {} { + return [expr {[is_windows_based_target] + || [istarget *-*-pe*]}] } # Return true if this is a native configuration in GDB's sense. This @@ -5736,7 +5749,7 @@ proc skip_inline_var_tests {} { # time out sequences. proc allow_fork_tests {} { - if {[istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"]} { + if {[is_windows_based_target]} { return 0 } @@ -5750,7 +5763,7 @@ proc allow_fork_tests {} { # false. proc allow_multi_inferior_tests {} { - if {[istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"]} { + if {[is_windows_based_target]} { return 0 } @@ -6792,17 +6805,14 @@ proc gdb_compile {source dest type options} { # IBM xlc compiler doesn't accept shared library named other # than .so: use "-Wl," to bypass this lappend source "-Wl,$shlib_name" - } elseif { ([istarget "*-*-mingw*"] - || [istarget *-*-cygwin*] - || [istarget *-*-pe*])} { + } elseif { [is_pecoff_target] } { lappend source "${shlib_name}.a" } else { lappend source $shlib_name } if { $shlib_found == 0 } { set shlib_found 1 - if { ([istarget "*-*-mingw*"] - || [istarget *-*-cygwin*]) } { + if { [is_pecoff_target] } { lappend new_options "ldflags=-Wl,--enable-auto-import" } if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } { @@ -6924,9 +6934,7 @@ proc gdb_compile {source dest type options} { # (depending on the platform) to set a special rpath value, to allow # the executable to find the libraries it depends on. if { $shlib_load || $shlib_found } { - if { ([istarget "*-*-mingw*"] - || [istarget *-*-cygwin*] - || [istarget *-*-pe*]) } { + if { [is_pecoff_target] } { # Do not need anything. } elseif { [istarget *-*-freebsd*] || [istarget *-*-openbsd*] } { lappend new_options "ldflags=-Wl,-rpath,${outdir}" @@ -7022,9 +7030,7 @@ proc gdb_compile {source dest type options} { } if { $type == "executable" } { - if { ([istarget "*-*-mingw*"] - || [istarget "*-*-*djgpp"] - || [istarget "*-*-cygwin*"])} { + if { [is_windows_based_target] || [istarget "*-*-*djgpp"] } { # Force output to unbuffered mode, by linking in an object file # with a global constructor that calls setvbuf. # @@ -7299,9 +7305,7 @@ proc gdb_compile_shlib_1 {sources dest options} { } else { lappend link_options "additional_flags=-shared" - if { ([istarget "*-*-mingw*"] - || [istarget *-*-cygwin*] - || [istarget *-*-pe*]) } { + if { [is_pecoff_target] } { if { [is_remote host] } { set name [file tail ${dest}] } else { @@ -7325,10 +7329,7 @@ proc gdb_compile_shlib_1 {sources dest options} { if {[gdb_compile "${objects}" "${dest}" executable $link_options] != ""} { return -1 } - if { [is_remote host] - && ([istarget "*-*-mingw*"] - || [istarget *-*-cygwin*] - || [istarget *-*-pe*]) } { + if { [is_remote host] && [is_pecoff_target] } { set dest_tail_name [file tail ${dest}] remote_upload host $dest_tail_name.a ${dest}.a remote_file host delete $dest_tail_name.a @@ -7841,7 +7842,7 @@ proc kill_wait_spawned_process { proc_spawn_id } { proc spawn_id_get_pid { spawn_id } { set testpid [exp_pid -i $spawn_id] - if { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } { + if { [is_windows_based_target] } { # testpid is the Cygwin PID, GDB uses the Windows PID, which # might be different due to the way fork/exec works. set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] @@ -9102,7 +9103,7 @@ proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} { if {$allow_extra} { set extra ".*" - } elseif {[istarget *-*-cygwin*] || [istarget *-*-mingw*]} { + } elseif {[is_windows_based_target]} { # On Windows, even on supposedly single-threaded programs, we # may see thread exit output when running to end, for threads # spawned by the runtime. E.g.: @@ -9479,7 +9480,7 @@ gdb_caching_proc gdb_has_argv0 {} { || [istarget *-*-solaris*] || [istarget *-*-aix*] || [istarget *-*-gnu*] - || [istarget *-*-cygwin*] || [istarget *-*-mingw32*] + || [is_windows_based_target] || [istarget *-*-*djgpp*] || [istarget *-*-go32*] || [istarget *-wince-pe] || [istarget *-*-mingw32ce*] || [istarget *-*-osf*] @@ -9512,8 +9513,7 @@ gdb_caching_proc gdb_has_argv0 {} { # Returns "" if there is none. proc get_build_id { filename } { - if { ([istarget "*-*-mingw*"] - || [istarget *-*-cygwin*]) } { + if { ([is_windows_based_target]) } { set objdump_program [gdb_find_objdump] set result [catch {set data [exec $objdump_program -p $filename | grep signature | cut "-d " -f4]} output] verbose "result is $result" -- 2.54.0