public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/fortran: Don't include module symbols when searching for types
@ 2019-08-28 12:36 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2019-08-28 12:36 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d8f27c6018adbb32a3ebba39a5abac44a6b9e67c

commit d8f27c6018adbb32a3ebba39a5abac44a6b9e67c
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Tue Jul 9 15:49:07 2019 +0100

    gdb/fortran: Don't include module symbols when searching for types
    
    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.

Diff:
---
 gdb/ChangeLog                            |  5 +++++
 gdb/symtab.c                             |  3 ++-
 gdb/testsuite/ChangeLog                  |  5 +++++
 gdb/testsuite/gdb.fortran/info-types.exp |  4 +++-
 gdb/testsuite/gdb.fortran/info-types.f90 | 11 +++++++++++
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4767e03..a82f7c6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 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.
 	* f-lang.h (f_print_typedef): Declare.
 	* f-typeprint.c (f_print_typedef): Define.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 7762c85..88e34de 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 02a3c01..3939a74 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 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.
 	* gdb.fortran/info-types.f90: New file.
 	* lib/fortran.exp (fortran_character1): New proc.
diff --git a/gdb/testsuite/gdb.fortran/info-types.exp b/gdb/testsuite/gdb.fortran/info-types.exp
index 9571dc4..81e6739 100644
--- a/gdb/testsuite/gdb.fortran/info-types.exp
+++ b/gdb/testsuite/gdb.fortran/info-types.exp
@@ -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;" ]
diff --git a/gdb/testsuite/gdb.fortran/info-types.f90 b/gdb/testsuite/gdb.fortran/info-types.f90
index 21c9d9d..0e27e1d 100644
--- a/gdb/testsuite/gdb.fortran/info-types.f90
+++ b/gdb/testsuite/gdb.fortran/info-types.f90
@@ -13,13 +13,24 @@
 ! 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-28 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28 12:36 [binutils-gdb] gdb/fortran: Don't include module symbols when searching for types Andrew Burgess

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).