]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: do not force -static in gdb.ada/mi_ex_cond.exp
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 9 Feb 2026 21:27:04 +0000 (16:27 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 10 Feb 2026 16:09:22 +0000 (11:09 -0500)
When running gdb.ada/mi_ex_cond.exp on Debian 13, I get:

    -catch-exception -c "i = 2" -e constraint_error
    ^error,msg="Your Ada runtime appears to be missing some debugging information.\nCannot insert Ada exception catchpoint in this configuration."
    (gdb)
    FAIL: gdb.ada/mi_ex_cond.exp: catch C_E if i = 2 (unexpected output)

And this is despite having the check "gnat_runtime_has_debug_info" at
the top of the file.

The problem is that the "gnat_runtime_has_debug_info" is done using the
toolchain's default mode, regarding linking to a static or shared
libgnat.  On Debian, the default is specificalyl changed to be shared
[1].

However, the test forces linking to a static libgnat.  The result is
that gnat_runtime_has_debug_info passes, seeing that when linking
against libgnat.so, debug info is available (distributed as separate
debug info, in /usr/lib/debug).  But then, the test explicitly builds
against a static libgnat, and then fails because debug info is not
found.

I propose to remove that "force static" part of the test.  It was added
in the test in the original commit that introduced it [2] without
explanation.  Not forcing it makes more sense to me:
gnat_runtime_has_debug_info checks if, when using the default linking
mode of the toolchain, debug info can be found.  And then, not
specifying anything to gdb_compile_ada builds the test binary with the
default mode of the toolchain.  So the two are coherent.

With this patch, I see the failures shown by Tom Tromey in this patch
[3], and with his patch applied, the test passes fine.

[1] https://salsa.debian.org/toolchain-team/gcc/-/blob/ddaf85e5648d12377294ffad2032b46983c947a5/debian/patches/ada-link-lib.diff#L44-66
[2] https://gitlab.com/gnutools/binutils-gdb/-/commit/2df4d1d5c4393fd06c2bffe75499e70a8d8ac8a8
[3] https://inbox.sourceware.org/gdb-patches/20260209060847.3643023-1-tom@tromey.com/T/#u

Change-Id: I58bf94556d68e2f476430fed4334b339dcf2819c
Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.ada/mi_ex_cond.exp

index a5adb5c3cbf04ce1053e0d3ca805601b0775d278..cfaf0577840a5d2cf956df613705faceba914502 100644 (file)
@@ -19,7 +19,7 @@ require allow_ada_tests gnat_runtime_has_debug_info
 
 standard_ada_testfile foo
 
-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-bargs additional_flags=-static additional_flags=-margs ]] != "" } {
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
     return
 }