public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] [PATCH] Adjust test gdb.ada/ptype_tagged_param.exp for when GNAT runtime does not have debug info Date: Sat, 28 Dec 2019 02:47:00 -0000 [thread overview] Message-ID: <b28a729db188235ce61f3a03e35a27f9427af12e@gdb-build> (raw) *** TEST RESULTS FOR COMMIT b28a729db188235ce61f3a03e35a27f9427af12e *** commit b28a729db188235ce61f3a03e35a27f9427af12e Author: Simon Marchi <simon.marchi@polymtl.ca> AuthorDate: Fri Dec 27 20:58:42 2019 -0500 Commit: Simon Marchi <simon.marchi@polymtl.ca> CommitDate: Fri Dec 27 21:02:35 2019 -0500 [PATCH] Adjust test gdb.ada/ptype_tagged_param.exp for when GNAT runtime does not have debug info This test verifies that GDB correctly identifies the run-time type of "s" as being the type "Circle". However, that can only be done correctly if the GNAT runtime has been compiled and shipped with debug information, so that GDB can poke in its internal data structures. Currently the test fails when when running against a GNAT runtime without debug info. This is the case, for example, on Arch Linux using the distribution package. This patch adds a helper in lib/ada.exp to check whether the GNAT runtime has debug info or not. It then uses it in gdb.ada/ptype_tagged_param.exp to expect a different result, depending on whether we have debug info or not in the runtime. At first, I made it so we would XFAIL the test, in the absence of debug info, but then I thought that we might as well test for the output we expect in the absence of debug info instead. gdb/testsuite/ChangeLog: * lib/ada.exp (gnat_runtime_has_debug_info): New proc. * lib/gnat_debug_info_test.adb: New file. * gdb.ada/ptype_tagged_param.exp: Use gnat_runtime_has_debug_info, expect a different output if runtime does not have debug info. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 488196c6ea..31208bdffc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-12-27 Simon Marchi <simon.marchi@polymtl.ca> + + * lib/ada.exp (gnat_runtime_has_debug_info): New proc. + * lib/gnat_debug_info_test.adb: New file. + * gdb.ada/ptype_tagged_param.exp: Use + gnat_runtime_has_debug_info, expect a different output if + runtime does not have debug info. + 2019-12-20 Simon Marchi <simon.marchi@efficios.com> * lib/sym-info-cmds.exp (GDBInfoSymbols::check_no_entry): Add diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp index 567ef8251d..08d3e5dcff 100644 --- a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp +++ b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp @@ -21,14 +21,31 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } return -1 } +set has_runtime_debug_info [gnat_runtime_has_debug_info] + clean_restart ${testfile} if ![runto "position_x" ] then { return -1 } -set eol "\[\r\n\]+" -set sp "\[ \t\]*" +# Identifying the runtime type of S can only be done when we have the debug +# info for the GNAT runtime. + +if { $has_runtime_debug_info } { + gdb_test "ptype s" \ + [multi_line \ + "type = <ref> new pck.shape with record" \ + " r: integer;" \ + "end record"] \ + "ptype s, with debug info" +} else { + gdb_test "ptype s" \ + [multi_line \ + "type = <ref> tagged record" \ + " x: integer;" \ + " y: integer;" \ + "end record" ] \ + "ptype s, without debug info" +} -gdb_test "ptype s" \ - "type = <ref> new pck.shape with record${eol}${sp}r: integer;${eol}end record" diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 45c41806a6..6f5961a822 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -149,3 +149,39 @@ proc gnatmake_version_at_least { major } { # Unknown, return 1 return 1 } + +# Return 1 if the GNAT runtime appears to have debug info. + +gdb_caching_proc gnat_runtime_has_debug_info { + global srcdir + + set src "$srcdir/lib/gnat_debug_info_test.adb" + set dst [standard_output_file "gnat_debug_info_test"] + + if { [gdb_compile_ada $src $dst executable {debug}] != "" } { + fail "failed to compile gnat-debug-info test binary" + return 0 + } + + clean_restart $dst + + if { ! [runto "GNAT_Debug_Info_Test"] } { + fail "failed to run to GNAT_Debug_Info_Test" + return 0 + } + + set has_debug_info 0 + + gdb_test_multiple "whatis __gnat_debug_raise_exception" "" { + -re "type = <text variable, no debug info>" { } + -re "type = void" { + set has_debug_info 1 + } + default { + # Some other unexpected output... + fail $gdb_test_name + } + } + + return $has_debug_info +} diff --git a/gdb/testsuite/lib/gnat_debug_info_test.adb b/gdb/testsuite/lib/gnat_debug_info_test.adb new file mode 100644 index 0000000000..b8f0b03435 --- /dev/null +++ b/gdb/testsuite/lib/gnat_debug_info_test.adb @@ -0,0 +1,6 @@ +with Ada.Text_IO; + +procedure GNAT_Debug_Info_Test is +begin + Ada.Text_IO.Put_Line("Hello, world!"); +end GNAT_Debug_Info_Test;
next reply other threads:[~2019-12-28 2:36 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-28 2:47 gdb-buildbot [this message] 2019-12-28 2:36 ` Failures on Fedora-x86_64-m64, branch master gdb-buildbot 2019-12-28 2:51 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2019-12-28 2:52 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot 2019-12-28 3:05 ` Failures on Fedora-i686, " gdb-buildbot 2019-12-28 3:10 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2019-12-28 3:19 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2019-12-28 3:38 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2019-12-28 3:53 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot 2019-12-28 10:57 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
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=b28a729db188235ce61f3a03e35a27f9427af12e@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@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: linkBe 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).