gdb/fortran: Add test for module variables in 'info variables' output
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 24 Jul 2019 13:00:07 +0000 (14:00 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 16 Oct 2019 21:22:09 +0000 (22:22 +0100)
Recent work from Tom Tromey to better handle variables with associated
copy relocations has fixed a Fortran issue where module variables
wouldn't show up in the output of 'info variables'.

This commit adds a test for this functionality to ensure it doesn't
get broken in the future.

gdb/testsuite/ChangeLog:

* gdb.fortran/module.exp: Extend with 'info variables' test.

Change-Id: I7306b1d0a9a72947fd48ad7a03f49df774d6573b

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/module.exp

index d2fa9ed24ea1be1ff1b3a6b9f96b217345b050e3..395a3ccacf4f37369898f67afad3dfacdb743e15 100644 (file)
@@ -1,3 +1,7 @@
+2019-10-16  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.fortran/module.exp: Extend with 'info variables' test.
+
 2019-10-16  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * boards/cc-with-tweaks.exp: Setup F90_FOR_TARGET and
index 4d71e7efac540fdb1c5dbea2a4524d04ddd0eb4a..276f7dc3c24dc8d6f7c7e3f010be937d51e5e697 100644 (file)
@@ -13,6 +13,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+load_lib "fortran.exp"
+
 standard_testfile .f90
 
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] } {
@@ -32,6 +34,28 @@ if ![runto MAIN__] then {
     continue
 }
 
+set int_type [fortran_int4]
+
+# Test 'info variables' can find module variables.
+gdb_test "info variables -n" \
+    [multi_line \
+        "All defined variables:" \
+        "" \
+        "File .*$srcfile:" \
+        "18:\[ \t\]+${int_type} mod1::var_const;" \
+        "17:\[ \t\]+${int_type} mod1::var_i;" \
+        "23:\[ \t\]+${int_type} mod2::var_i;" \
+        "28:\[ \t\]+${int_type} mod3::mod1;" \
+        "27:\[ \t\]+${int_type} mod3::mod2;" \
+        "29:\[ \t\]+${int_type} mod3::var_i;" \
+        "33:\[ \t\]+${int_type} modmany::var_a;" \
+        "33:\[ \t\]+${int_type} modmany::var_b;" \
+        "33:\[ \t\]+${int_type} modmany::var_c;" \
+        "33:\[ \t\]+${int_type} modmany::var_i;" \
+        "37:\[ \t\]+${int_type} moduse::var_x;" \
+        "37:\[ \t\]+${int_type} moduse::var_y;" ]
+
+
 # Do not use simple single-letter names as GDB would pick up for expectedly
 # nonexisting symbols some static variables from system libraries debuginfos.