Commit
80eaec735e ("[gdb/symtab] Handle named DW_TAG_unspecified_type
DIE") changed the handling of DW_TAG_unspecified_type. Before this
change, such types were not entered into the symbol table.
It turns out that, when such a type is in the symtab, it can cause
failures in Ada. In particular, a private type in another package may
be seen locally as "void".
Now, it would probably be better to fix this via check_typedef.
However, that is somewhat difficult given the state of the DWARF
reader -- in particular with gdb_index, this would require expanding
potentially many CUs to find the correct type.
Instead, this patch changes gdb to not enter a symbol for an
unspecified type -- but only for Ada.
sym->set_domain (VAR_DOMAIN);
list_to_add = cu->list_in_scope;
break;
+ case DW_TAG_unspecified_type:
+ if (cu->lang () == language_ada)
+ break;
+ /* FALLTHROUGH */
case DW_TAG_array_type:
case DW_TAG_base_type:
case DW_TAG_subrange_type:
case DW_TAG_generic_subrange:
- case DW_TAG_unspecified_type:
sym->set_aclass_index (LOC_TYPEDEF);
sym->set_domain (VAR_DOMAIN);
list_to_add = cu->list_in_scope;
"False"
gdb_test "python print(v.type.strip_typedefs().target().code is gdb.TYPE_CODE_VOID)" \
"False"
+
+# This was a convenient spot to put a regression test. GNAT will
+# create a DW_TAG_unspecified_type in the main.adb CU, and if gdb
+# isn't careful, this will result in this 'whatis' yielding 'void'.
+gdb_test "whatis pkg.value_record" "type = pkg.value_record"