From: Tom Tromey Date: Mon, 31 Mar 2025 17:53:53 +0000 (-0600) Subject: Check gnatmake version in gnat_version_compare X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b63e824775e8ebab501b2d66656ebefd4536e08b;p=thirdparty%2Fbinutils-gdb.git Check gnatmake version in gnat_version_compare Tom de Vries pointed out that my earlier change to gnat_version_compare made it actually test gcc's version -- not gnat's. This patch changes gnat_version_compare to examine gnatmake's version, while preserving the nicer API. Approved-By: Tom de Vries --- diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 0a1231b1d59..e1a3a237c35 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -181,12 +181,16 @@ proc find_ada_tool {tool} { # compiler does not appear to be GCC, this will always return false. proc gnat_version_compare {op l2} { - set gccvers [gcc_major_version] - if {$gccvers == -1} { + set gnatmake [find_gnatmake] + set gnatmake [lindex [split $gnatmake] 0] + if {[catch {exec $gnatmake --version} output]} { + return 0 + } + if {![regexp {GNATMAKE ([0-9]+(\.[0-9]+)*)} $output match version]} { return 0 } - return [version_compare [split $gccvers .] $op $l2] + return [version_compare [split $version .] $op $l2] } # Return 1 if the GNAT runtime appears to have debug info.