diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-17 13:51:24 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-06-01 10:19:55 -0600 |
commit | e86ca25fd6cc06488c9dda936cf83f0fcdf6b58b (patch) | |
tree | e7cd08ab978fa972959ac445c3799e9ccbf0ebc0 /gdb/dwarf2read.c | |
parent | c1ec8cea7ff53eb76cb7c354b813c67fde755409 (diff) | |
download | gdb-e86ca25fd6cc06488c9dda936cf83f0fcdf6b58b.zip gdb-e86ca25fd6cc06488c9dda936cf83f0fcdf6b58b.tar.gz gdb-e86ca25fd6cc06488c9dda936cf83f0fcdf6b58b.tar.bz2 |
Remove TYPE_TAG_NAME
TYPE_TAG_NAME has been an occasional source of confusion and bugs. It
seems to me that it is only useful for C and C++ -- but even there,
not so much, because at least with DWARF there doesn't seem to be any
way to wind up with a type where the name and the tag name are both
non-NULL and different.
So, this patch removes TYPE_TAG_NAME entirely. This should save a
little memory, but more importantly, it simplifies this part of gdb.
A few minor test suite adjustments were needed. In some situations
the new code does not yield identical output to the old code.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* valops.c (enum_constant_from_type, value_namespace_elt)
(value_maybe_namespace_elt): Update.
* valarith.c (find_size_for_pointer_math): Update.
* target-descriptions.c (make_gdb_type): Update.
* symmisc.c (print_symbol): Update.
* stabsread.c (define_symbol, read_type)
(complain_about_struct_wipeout, add_undefined_type)
(cleanup_undefined_types_1): Update.
* rust-lang.c (rust_tuple_type_p, rust_slice_type_p)
(rust_range_type_p, val_print_struct, rust_print_struct_def)
(rust_internal_print_type, rust_composite_type)
(rust_evaluate_funcall, rust_evaluate_subexp)
(rust_inclusive_range_type_p): Update.
* python/py-type.c (typy_get_tag): Update.
* p-typeprint.c (pascal_type_print_base): Update.
* mdebugread.c (parse_symbol, parse_type): Update.
* m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum):
Update.
* guile/scm-type.c (gdbscm_type_tag): Update.
* go-lang.c (sixg_string_p): Update.
* gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type):
Update.
* gdbtypes.h (struct main_type) <tag_name>: Remove.
(TYPE_TAG_NAME): Remove.
* gdbtypes.c (type_name_no_tag): Simplify.
(check_typedef, check_types_equal, recursive_dump_type)
(copy_type_recursive, arch_composite_type): Update.
* f-typeprint.c (f_type_print_base): Update. Print "Type" prefix
in summary mode when needed.
* eval.c (evaluate_funcall): Update.
* dwarf2read.c (fixup_go_packaging, read_structure_type)
(process_structure_scope, read_enumeration_type)
(read_namespace_type, read_module_type, determine_prefix): Update.
* cp-support.c (inspect_type): Update.
* coffread.c (process_coff_symbol, decode_base_type): Update.
* c-varobj.c (c_is_path_expr_parent): Update.
* c-typeprint.c (c_type_print_base_struct_union): Update.
(c_type_print_base_1): Update. Print struct/class/union/enum in
summary when using C language.
* ax-gdb.c (gen_struct_ref, gen_namespace_elt)
(gen_maybe_namespace_elt): Update.
* ada-lang.c (ada_type_name): Simplify.
(empty_record, ada_template_to_fixed_record_type_1)
(template_to_static_fixed_type)
(to_record_with_fixed_variant_part, ada_check_typedef): Update.
gdb/testsuite/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* gdb.xml/tdesc-regs.exp (load_description): Update expected
results.
* gdb.dwarf2/method-ptr.exp: Set language to C++.
* gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++.
* gdb.cp/typeid.exp (do_typeid_tests): Update type_re.
* gdb.base/maint.exp (maint_pass_if): Update.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 14cae6e..b8e681b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9762,8 +9762,6 @@ fixup_go_packaging (struct dwarf2_cu *cu) saved_package_name); struct symbol *sym; - TYPE_TAG_NAME (type) = TYPE_NAME (type); - sym = allocate_symbol (objfile); SYMBOL_SET_LANGUAGE (sym, language_go, &objfile->objfile_obstack); SYMBOL_SET_NAMES (sym, saved_package_name, @@ -15653,18 +15651,13 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) if (get_die_type (die, cu) != NULL) return get_die_type (die, cu); - TYPE_TAG_NAME (type) = full_name; - if (die->tag == DW_TAG_structure_type - || die->tag == DW_TAG_class_type) - TYPE_NAME (type) = TYPE_TAG_NAME (type); + TYPE_NAME (type) = full_name; } else { /* The name is already allocated along with this objfile, so we don't need to duplicate it for the type. */ - TYPE_TAG_NAME (type) = name; - if (die->tag == DW_TAG_class_type) - TYPE_NAME (type) = TYPE_TAG_NAME (type); + TYPE_NAME (type) = name; } } @@ -15944,8 +15937,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) if (i < TYPE_N_BASECLASSES (t)) complaint (_("virtual function table pointer " "not found when defining class '%s'"), - TYPE_TAG_NAME (type) ? TYPE_TAG_NAME (type) : - ""); + TYPE_NAME (type) ? TYPE_NAME (type) : ""); } else { @@ -16135,7 +16127,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) TYPE_CODE (type) = TYPE_CODE_ENUM; name = dwarf2_full_name (NULL, die, cu); if (name != NULL) - TYPE_TAG_NAME (type) = name; + TYPE_NAME (type) = name; attr = dwarf2_attr (die, DW_AT_type, cu); if (attr != NULL) @@ -16686,7 +16678,6 @@ read_namespace_type (struct die_info *die, struct dwarf2_cu *cu) /* Create the type. */ type = init_type (objfile, TYPE_CODE_NAMESPACE, 0, name); - TYPE_TAG_NAME (type) = TYPE_NAME (type); return set_die_type (die, type, cu); } @@ -16751,9 +16742,6 @@ read_module_type (struct die_info *die, struct dwarf2_cu *cu) sect_offset_str (die->sect_off)); type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name); - /* determine_prefix uses TYPE_TAG_NAME. */ - TYPE_TAG_NAME (type) = TYPE_NAME (type); - return set_die_type (die, type, cu); } @@ -22183,18 +22171,18 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) DW_TAG_namespace DIEs with a name of "::" for the global namespace. Work around this problem here. */ if (cu->language == language_cplus - && strcmp (TYPE_TAG_NAME (parent_type), "::") == 0) + && strcmp (TYPE_NAME (parent_type), "::") == 0) return ""; /* We give a name to even anonymous namespaces. */ - return TYPE_TAG_NAME (parent_type); + return TYPE_NAME (parent_type); case DW_TAG_class_type: case DW_TAG_interface_type: case DW_TAG_structure_type: case DW_TAG_union_type: case DW_TAG_module: parent_type = read_type_die (parent, cu); - if (TYPE_TAG_NAME (parent_type) != NULL) - return TYPE_TAG_NAME (parent_type); + if (TYPE_NAME (parent_type) != NULL) + return TYPE_NAME (parent_type); else /* An anonymous structure is only allowed non-static data members; no typedefs, no member functions, et cetera. @@ -22219,8 +22207,8 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) parent_type = read_type_die (parent, cu); if (TYPE_DECLARED_CLASS (parent_type)) { - if (TYPE_TAG_NAME (parent_type) != NULL) - return TYPE_TAG_NAME (parent_type); + if (TYPE_NAME (parent_type) != NULL) + return TYPE_NAME (parent_type); return ""; } /* Fall through. */ |