gdb/fortran: Don't include module symbols when searching for types
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 9 Jul 2019 14:49:07 +0000 (15:49 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 28 Aug 2019 12:33:55 +0000 (13:33 +0100)
Currently the 'info types' command will return symbols that correspond
to Fortran modules.  This is because the symbols are created with
domain MODULE_DOMAIN and address_class LOC_TYPEDEF.  The address_class
LOC_TYPEDEF is the same address_class used for type symbols which is
why the modules show up when listing types.

This commit explicitly prevents symbols in the MODULE_DOMAIN from
appearing when we search for symbols in the TYPES_DOMAIN, this
prevents the Fortran module symbols from appearing in the output of
'info types'.

gdb/ChangeLog:

* symtab.c (search_symbols): Don't include MODULE_DOMAIN symbols
when searching for types.

gdb/testsuite/ChangeLog:

* gdb.fortran/info-types.exp: Add module.
* gdb.fortran/info-types.f90: Update expected results.

gdb/ChangeLog
gdb/symtab.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/info-types.exp
gdb/testsuite/gdb.fortran/info-types.f90

index 4767e03b7e083f527457c72fcdde5e884cf9f68b..a82f7c64ae89e0972b5cb649c5015193527bd5d3 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-28  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * symtab.c (search_symbols): Don't include MODULE_DOMAIN symbols
+       when searching for types.
+
 2019-08-28  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * f-lang.c (f_language_defn): Use f_print_typedef.
index 7762c857082a8f3bd3ba7d150f4e69e9ecfa9455..88e34de05be4ff70838bc79cfb236ab37a1edb11 100644 (file)
@@ -4659,7 +4659,8 @@ search_symbols (const char *regexp, enum search_domain kind,
                                      || treg_matches_sym_type_name (*treg,
                                                                     sym)))
                              || (kind == TYPES_DOMAIN
-                                 && SYMBOL_CLASS (sym) == LOC_TYPEDEF))))
+                                 && SYMBOL_CLASS (sym) == LOC_TYPEDEF
+                                 && SYMBOL_DOMAIN (sym) != MODULE_DOMAIN))))
                    {
                      /* match */
                      result.emplace_back (i, sym);
index 02a3c01667cbdc1af3cd361d14484d36498db62c..3939a747c5b61315d9b62d35e107477b849dca56 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-28  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.fortran/info-types.exp: Add module.
+       * gdb.fortran/info-types.f90: Update expected results.
+
 2019-08-28  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.fortran/info-types.exp: New file.
index 9571dc455934d2d44a30e9a098f31e885e3bd48d..81e67395e8aeeeb4a46e8707d9a2beeadf0c3065 100644 (file)
@@ -42,4 +42,6 @@ gdb_test "info types" \
         "\[\t \]+${character1}" \
         "\[\t \]+${integer4}" \
         "\[\t \]+${logical4}" \
-        "16:\[\t \]+Type s1;" ]
+        "20:\[\t \]+Type __vtype_mod1_M1t1;" \
+        "17:\[\t \]+Type m1t1;" \
+        "22:\[\t \]+Type s1;" ]
index 21c9d9df63c45bc3ce1434c4911b70412595640b..0e27e1ddf088f16919b6ffde3848c0fe6983ba06 100644 (file)
 ! You should have received a copy of the GNU General Public License
 ! along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+module mod1
+  type :: m1t1
+     integer :: b
+  end type m1t1
+end module mod1
+
 program info_types_test
+  use mod1
+
   type :: s1
      integer :: a
   end type s1
 
   logical :: l
   type (s1) :: var_a
+  type (m1t1) :: var_b
+
   var_a%a = 1
+  var_b%b = 2
   l = .FALSE.
 end program info_types_test
This page took 0.037528 seconds and 4 git commands to generate.