public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Add shared_gnat_runtime_has_debug_info
Date: Mon, 19 Jun 2023 11:47:50 +0200	[thread overview]
Message-ID: <20230619094750.4115-1-tdevries@suse.de> (raw)

Test-case gdb.ada/catch_ex_std.exp passes for me with package
libada7-debuginfo installed, but after removing it I get:
...
(gdb) catch exception some_kind_of_error^M
Your Ada runtime appears to be missing some debugging information.^M
Cannot insert Ada exception catchpoint in this configuration.^M
(gdb) FAIL: gdb.ada/catch_ex_std.exp: catch exception some_kind_of_error
...

The test-case contains a require gnat_runtime_has_debug_info to deal with
this, but the problem is that this checks the static gnat runtime, while this
test-case uses the shared one.

Fix this by introducing shared_gnat_runtime_has_debug_info, and requiring that
one instead.

Tested on x86_64-linux.

PR testsuite/30094
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30094
---
 gdb/testsuite/gdb.ada/catch_ex_std.exp |  2 +-
 gdb/testsuite/lib/ada.exp              | 27 ++++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
index 3a2b10a8c13..052d4d7a668 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp
@@ -17,7 +17,7 @@ require allow_shlib_tests
 
 load_lib "ada.exp"
 
-require allow_ada_tests gnat_runtime_has_debug_info
+require allow_ada_tests shared_gnat_runtime_has_debug_info
 
 standard_ada_testfile foo
 
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index b4a93faefa5..d45d75994dd 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -171,7 +171,7 @@ proc gnatmake_version_at_least { major } {
 
 # Return 1 if the GNAT runtime appears to have debug info.
 
-gdb_caching_proc gnat_runtime_has_debug_info {} {
+proc gnat_runtime_has_debug_info_1 { shared } {
     if { ![allow_ada_tests] } {
 	return 0
     }
@@ -181,7 +181,18 @@ gdb_caching_proc gnat_runtime_has_debug_info {} {
     set src "$srcdir/lib/gnat_debug_info_test.adb"
     set dst [standard_output_file "gnat_debug_info_test"]
 
-    if { [gdb_compile_ada_1 $src $dst executable {debug}] != "" } {
+    set opts {}
+    lappend opts debug
+    if { $shared } {
+	# Make sure we link against the shared GNAT run time.
+	set gnatbind_options [list -bargs -shared -margs]
+
+	foreach option $gnatbind_options {
+	    lappend opts [concat "additional_flags=" $option]
+	}
+    }
+
+    if { [gdb_compile_ada_1 $src $dst executable $opts] != "" } {
 	return 0
     }
 
@@ -208,3 +219,15 @@ gdb_caching_proc gnat_runtime_has_debug_info {} {
 
     return $has_debug_info
 }
+
+# Return 1 if the static GNAT runtime appears to have debug info.
+
+gdb_caching_proc gnat_runtime_has_debug_info {} {
+    return [gnat_runtime_has_debug_info_1 0]
+}
+
+# Return 1 if the shared GNAT runtime appears to have debug info.
+
+gdb_caching_proc shared_gnat_runtime_has_debug_info {} {
+    return [gnat_runtime_has_debug_info_1 1]
+}

base-commit: ba769bb0e6fdf5b4c55577b068b93adf2f6d1333
-- 
2.35.3


                 reply	other threads:[~2023-06-19  9:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230619094750.4115-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).