`gdb.lookup_type` from the Python API doesn't work for Fortran. In the following Fortran program (compiled with gfortran 7.2.1): program mvce implicit none type :: my_type integer :: my_int end type my_type type(my_type) :: foo foo%my_int = 4 print*, foo%my_int end program mvce gives: (gdb) py gdb.lookup_type(str(gdb.parse_and_eval("foo").type)) Traceback (most recent call last): File "<string>", line 1, in <module> gdb.error: No type named Type my_type. Error while executing Python code. Possibly related is that `info types` also doesn't work for Fortran, although `info types <type>` does: (gdb) info types All defined types: File ../../../gcc/fortran/libgfortran.h: Language not supported. (gdb) info types my_type All types matching regular expression "my_type": File mvce.f90: Type my_type;
I wonder if this is the same cause as PR21763, in which case this would be an easy fix (add fortan to the switch in symbol_matches_domain)
Created attachment 12325 [details] Include Fortran veto on symbol_matches_domain I've bumped into this problem today. I tried looking up the solution from bug 21763: In symtab.c's symbol_matches_domain, it seems that symbol_domain and domain do not match (d'uh) for the derived type lookup. I've then looked up the definition of my derived type in the dwarf output of gfortran, and found that the derived is tagged as DW_TAG_structure_type (would go into STRUCT_DOMAIN), not as DW_TAG_typedef (would go into VAR_DOMAIN), as one could maybe expect? The information about the type should then be searched in STRUCT_DOMAIN and not in VAR_DOMAIN, or not? Adding an exception for language_fortran in symtab.c's symbol_matches_domain seems to resolve the problem (however, I did not run the testsuite).
(In reply to Simon Braß from comment #2) > Created attachment 12325 [details] > Include Fortran veto on symbol_matches_domain > > I've bumped into this problem today. > > I tried looking up the solution from bug 21763: > In symtab.c's symbol_matches_domain, it seems that symbol_domain and domain > do not match (d'uh) for the derived type lookup. > > I've then looked up the definition of my derived type in the dwarf output of > gfortran, and found that the derived is tagged as DW_TAG_structure_type > (would go into STRUCT_DOMAIN), not as DW_TAG_typedef (would go into > VAR_DOMAIN), as one could maybe expect? > > The information about the type should then be searched in STRUCT_DOMAIN and > not in VAR_DOMAIN, or not? > > Adding an exception for language_fortran in symtab.c's symbol_matches_domain > seems to resolve the problem (however, I did not run the testsuite). Is there any progress regarding this bug? E.g. general progress on the Fortran support?