aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-04-17 13:51:24 -0600
committerTom Tromey <tom@tromey.com>2018-06-01 10:19:55 -0600
commite86ca25fd6cc06488c9dda936cf83f0fcdf6b58b (patch)
treee7cd08ab978fa972959ac445c3799e9ccbf0ebc0 /gdb
parentc1ec8cea7ff53eb76cb7c354b813c67fde755409 (diff)
downloadbinutils-e86ca25fd6cc06488c9dda936cf83f0fcdf6b58b.zip
binutils-e86ca25fd6cc06488c9dda936cf83f0fcdf6b58b.tar.gz
binutils-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')
-rw-r--r--gdb/ChangeLog48
-rw-r--r--gdb/ada-lang.c17
-rw-r--r--gdb/ax-gdb.c6
-rw-r--r--gdb/c-typeprint.c48
-rw-r--r--gdb/c-varobj.c3
-rw-r--r--gdb/coffread.c16
-rw-r--r--gdb/cp-support.c2
-rw-r--r--gdb/dwarf2read.c32
-rw-r--r--gdb/eval.c4
-rw-r--r--gdb/f-typeprint.c13
-rw-r--r--gdb/gdbtypes.c29
-rw-r--r--gdb/gdbtypes.h21
-rw-r--r--gdb/gnu-v3-abi.c4
-rw-r--r--gdb/go-lang.c4
-rw-r--r--gdb/guile/scm-type.c10
-rw-r--r--gdb/m2-typeprint.c22
-rw-r--r--gdb/mdebugread.c14
-rw-r--r--gdb/p-typeprint.c20
-rw-r--r--gdb/python/py-type.c10
-rw-r--r--gdb/rust-lang.c57
-rw-r--r--gdb/stabsread.c20
-rw-r--r--gdb/symmisc.c2
-rw-r--r--gdb/target-descriptions.c1
-rw-r--r--gdb/testsuite/ChangeLog9
-rw-r--r--gdb/testsuite/gdb.base/maint.exp2
-rw-r--r--gdb/testsuite/gdb.cp/typeid.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp1
-rw-r--r--gdb/testsuite/gdb.dwarf2/method-ptr.exp1
-rw-r--r--gdb/testsuite/gdb.xml/tdesc-regs.exp4
-rw-r--r--gdb/valarith.c2
-rw-r--r--gdb/valops.c6
31 files changed, 221 insertions, 209 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 918a467..7caa3af 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,53 @@
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.
+
+2018-06-01 Tom Tromey <tom@tromey.com>
+
* dwarf2read.c (dwarf2_compute_name): Pass CU's language to
c_print_type.
* c-typeprint.c (c_print_type_1): Add "language" parameter.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 64bddc2..ceabf64 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8111,18 +8111,15 @@ ada_prefer_type (struct type *type0, struct type *type1)
return 0;
}
-/* The name of TYPE, which is either its TYPE_NAME, or, if that is
- null, its TYPE_TAG_NAME. Null if TYPE is null. */
+/* The name of TYPE, which is its TYPE_NAME. Null if TYPE is
+ null. */
const char *
ada_type_name (struct type *type)
{
if (type == NULL)
return NULL;
- else if (TYPE_NAME (type) != NULL)
- return TYPE_NAME (type);
- else
- return TYPE_TAG_NAME (type);
+ return TYPE_NAME (type);
}
/* Search the list of "descriptive" types associated to TYPE for a type
@@ -8291,7 +8288,6 @@ empty_record (struct type *templ)
TYPE_FIELDS (type) = NULL;
INIT_CPLUS_SPECIFIC (type);
TYPE_NAME (type) = "<empty>";
- TYPE_TAG_NAME (type) = NULL;
TYPE_LENGTH (type) = 0;
return type;
}
@@ -8350,7 +8346,6 @@ ada_template_to_fixed_record_type_1 (struct type *type,
TYPE_ALLOC (rtype, nfields * sizeof (struct field));
memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
- TYPE_TAG_NAME (rtype) = NULL;
TYPE_FIXED_INSTANCE (rtype) = 1;
off = 0;
@@ -8627,7 +8622,6 @@ template_to_static_fixed_type (struct type *type0)
memcpy (TYPE_FIELDS (type), TYPE_FIELDS (type0),
sizeof (struct field) * nfields);
TYPE_NAME (type) = ada_type_name (type0);
- TYPE_TAG_NAME (type) = NULL;
TYPE_FIXED_INSTANCE (type) = 1;
TYPE_LENGTH (type) = 0;
}
@@ -8677,7 +8671,6 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
memcpy (TYPE_FIELDS (rtype), TYPE_FIELDS (type),
sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
- TYPE_TAG_NAME (rtype) = NULL;
TYPE_FIXED_INSTANCE (rtype) = 1;
TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
@@ -9288,11 +9281,11 @@ ada_check_typedef (struct type *type)
type = check_typedef (type);
if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM
|| !TYPE_STUB (type)
- || TYPE_TAG_NAME (type) == NULL)
+ || TYPE_NAME (type) == NULL)
return type;
else
{
- const char *name = TYPE_TAG_NAME (type);
+ const char *name = TYPE_NAME (type);
struct type *type1 = ada_find_any_type (name);
if (type1 == NULL)
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 9a44d4b..2468061 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1533,7 +1533,7 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value,
if (!found)
error (_("Couldn't find member named `%s' in struct/union/class `%s'"),
- field, TYPE_TAG_NAME (type));
+ field, TYPE_NAME (type));
}
static int
@@ -1629,7 +1629,7 @@ gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
if (!found)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_TAG_NAME (curtype));
+ name, TYPE_NAME (curtype));
return found;
}
@@ -1644,7 +1644,7 @@ static int
gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
const struct type *curtype, char *name)
{
- const char *namespace_name = TYPE_TAG_NAME (curtype);
+ const char *namespace_name = TYPE_NAME (curtype);
struct block_symbol sym;
sym = cp_lookup_symbol_namespace (namespace_name, name,
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 97f7aaa..6141950 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -1189,13 +1189,13 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
enum}" tag for unnamed struct/union/enum's, which we don't
want to print. */
- if (TYPE_TAG_NAME (type) != NULL
- && !startswith (TYPE_TAG_NAME (type), "{unnamed"))
+ if (TYPE_NAME (type) != NULL
+ && !startswith (TYPE_NAME (type), "{unnamed"))
{
/* When printing the tag name, we are still effectively
printing in the outer context, hence the use of FLAGS
here. */
- print_name_maybe_canonical (TYPE_TAG_NAME (type), flags, stream);
+ print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
if (show > 0)
fputs_filtered (" ", stream);
}
@@ -1204,10 +1204,10 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
{
/* If we just printed a tag name, no need to print anything
else. */
- if (TYPE_TAG_NAME (type) == NULL)
+ if (TYPE_NAME (type) == NULL)
fprintf_filtered (stream, "{...}");
}
- else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+ else if (show > 0 || TYPE_NAME (type) == NULL)
{
struct type *basetype;
int vptr_fieldno;
@@ -1620,15 +1620,33 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
/* When SHOW is zero or less, and there is a valid type name, then
always just print the type name directly from the type. */
- /* If we have "typedef struct foo {. . .} bar;" do we want to print
- it as "struct foo" or as "bar"? Pick the latter, because C++
- folk tend to expect things like "class5 *foo" rather than "struct
- class5 *foo". */
if (show <= 0
&& TYPE_NAME (type) != NULL)
{
c_type_print_modifier (type, stream, 0, 1);
+
+ /* If we have "typedef struct foo {. . .} bar;" do we want to
+ print it as "struct foo" or as "bar"? Pick the latter for
+ C++, because C++ folk tend to expect things like "class5
+ *foo" rather than "struct class5 *foo". We rather
+ arbitrarily choose to make language_minimal work in a C-like
+ way. */
+ if (language == language_c || language == language_minimal)
+ {
+ if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ fprintf_filtered (stream, "union ");
+ else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ {
+ if (TYPE_DECLARED_CLASS (type))
+ fprintf_filtered (stream, "class ");
+ else
+ fprintf_filtered (stream, "struct ");
+ }
+ else if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ fprintf_filtered (stream, "enum ");
+ }
+
print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
return;
}
@@ -1679,10 +1697,10 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
"{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
tag for unnamed struct/union/enum's, which we don't
want to print. */
- if (TYPE_TAG_NAME (type) != NULL
- && !startswith (TYPE_TAG_NAME (type), "{unnamed"))
+ if (TYPE_NAME (type) != NULL
+ && !startswith (TYPE_NAME (type), "{unnamed"))
{
- print_name_maybe_canonical (TYPE_TAG_NAME (type), flags, stream);
+ print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
if (show > 0)
fputs_filtered (" ", stream);
}
@@ -1692,10 +1710,10 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
{
/* If we just printed a tag name, no need to print anything
else. */
- if (TYPE_TAG_NAME (type) == NULL)
+ if (TYPE_NAME (type) == NULL)
fprintf_filtered (stream, "{...}");
}
- else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+ else if (show > 0 || TYPE_NAME (type) == NULL)
{
LONGEST lastval = 0;
@@ -1804,7 +1822,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_NAMESPACE:
fputs_filtered ("namespace ", stream);
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
break;
default:
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 03656c0..7f12989 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -145,8 +145,7 @@ c_is_path_expr_parent (const struct varobj *var)
/* Anonymous unions and structs are also not path_expr parents. */
if ((TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION)
- && TYPE_NAME (type) == NULL
- && TYPE_TAG_NAME (type) == NULL)
+ && TYPE_NAME (type) == NULL)
{
const struct varobj *parent = var->parent;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 5345fb7..bc266fb 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1781,11 +1781,11 @@ process_coff_symbol (struct coff_symbol *cs,
/* Some compilers try to be helpful by inventing "fake"
names for anonymous enums, structures, and unions, like
"~0fake" or ".0fake". Thanks, but no thanks... */
- if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
+ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
if (SYMBOL_LINKAGE_NAME (sym) != NULL
&& *SYMBOL_LINKAGE_NAME (sym) != '~'
&& *SYMBOL_LINKAGE_NAME (sym) != '.')
- TYPE_TAG_NAME (SYMBOL_TYPE (sym)) =
+ TYPE_NAME (SYMBOL_TYPE (sym)) =
concat (SYMBOL_LINKAGE_NAME (sym), (char *)NULL);
add_symbol_to_list (sym, &file_symbols);
@@ -1950,10 +1950,6 @@ decode_base_type (struct coff_symbol *cs,
type = coff_alloc_type (cs->c_symnum);
TYPE_CODE (type) = TYPE_CODE_STRUCT;
TYPE_NAME (type) = NULL;
- /* This used to set the tag to "<opaque>". But I think
- setting it to NULL is right, and the printing code can
- print it as "struct {...}". */
- TYPE_TAG_NAME (type) = NULL;
INIT_CPLUS_SPECIFIC (type);
TYPE_LENGTH (type) = 0;
TYPE_FIELDS (type) = 0;
@@ -1974,10 +1970,6 @@ decode_base_type (struct coff_symbol *cs,
/* Anonymous union type. */
type = coff_alloc_type (cs->c_symnum);
TYPE_NAME (type) = NULL;
- /* This used to set the tag to "<opaque>". But I think
- setting it to NULL is right, and the printing code can
- print it as "union {...}". */
- TYPE_TAG_NAME (type) = NULL;
INIT_CPLUS_SPECIFIC (type);
TYPE_LENGTH (type) = 0;
TYPE_FIELDS (type) = 0;
@@ -2000,10 +1992,6 @@ decode_base_type (struct coff_symbol *cs,
type = coff_alloc_type (cs->c_symnum);
TYPE_CODE (type) = TYPE_CODE_ENUM;
TYPE_NAME (type) = NULL;
- /* This used to set the tag to "<opaque>". But I think
- setting it to NULL is right, and the printing code can
- print it as "enum {...}". */
- TYPE_TAG_NAME (type) = NULL;
TYPE_LENGTH (type) = 0;
TYPE_FIELDS (type) = 0;
TYPE_NFIELDS (type) = 0;
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index cec4801..3ce5f60 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -199,7 +199,7 @@ inspect_type (struct demangle_parse_info *info,
&& strcmp (TYPE_NAME (type), name) == 0)
return 0;
- is_anon = (TYPE_TAG_NAME (type) == NULL
+ is_anon = (TYPE_NAME (type) == NULL
&& (TYPE_CODE (type) == TYPE_CODE_ENUM
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION));
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. */
diff --git a/gdb/eval.c b/gdb/eval.c
index 5bd6e2c..0fb59e8 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -990,13 +990,13 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
function_name = NULL;
if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
{
- function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type),
+ function = cp_lookup_symbol_namespace (TYPE_NAME (type),
name,
get_selected_block (0),
VAR_DOMAIN).symbol;
if (function == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_TAG_NAME (type));
+ name, TYPE_NAME (type));
tem = 1;
/* arg2 is left as NULL on purpose. */
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index f14f181..3f13c11 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -290,7 +290,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
if ((show <= 0) && (TYPE_NAME (type) != NULL))
{
- fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
+ const char *prefix = "";
+ if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ prefix = "Type, C_Union :: ";
+ else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ prefix = "Type ";
+ fprintfi_filtered (level, stream, "%s%s", prefix, TYPE_NAME (type));
return;
}
@@ -370,7 +375,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
fprintfi_filtered (level, stream, "Type, C_Union :: ");
else
fprintfi_filtered (level, stream, "Type ");
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
/* According to the definition,
we only print structure elements in case show > 0. */
if (show > 0)
@@ -387,12 +392,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
fputs_filtered ("\n", stream);
}
fprintfi_filtered (level, stream, "End Type ");
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
}
break;
case TYPE_CODE_MODULE:
- fprintfi_filtered (level, stream, "module %s", TYPE_TAG_NAME (type));
+ fprintfi_filtered (level, stream, "module %s", TYPE_NAME (type));
break;
default_case:
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 3d75c21..ecf70d7 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1469,12 +1469,6 @@ smash_to_method_type (struct type *type, struct type *self_type,
const char *
type_name_no_tag (const struct type *type)
{
- if (TYPE_TAG_NAME (type) != NULL)
- return TYPE_TAG_NAME (type);
-
- /* Is there code which expects this to return the name if there is
- no tag name? My guess is that this is mainly used for C++ in
- cases where the two will always be the same. */
return TYPE_NAME (type);
}
@@ -2445,10 +2439,8 @@ check_typedef (struct type *type)
return make_qualified_type (type, instance_flags, NULL);
name = type_name_no_tag (type);
- /* FIXME: shouldn't we separately check the TYPE_NAME and
- the TYPE_TAG_NAME, and look in STRUCT_DOMAIN and/or
- VAR_DOMAIN as appropriate? (this code was written before
- TYPE_NAME and TYPE_TAG_NAME were separate). */
+ /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or
+ VAR_DOMAIN as appropriate? */
if (name == NULL)
{
stub_noname_complaint ();
@@ -2534,10 +2526,8 @@ check_typedef (struct type *type)
else if (TYPE_STUB (type) && !currently_reading_symtab)
{
const char *name = type_name_no_tag (type);
- /* FIXME: shouldn't we separately check the TYPE_NAME and the
- TYPE_TAG_NAME, and look in STRUCT_DOMAIN and/or VAR_DOMAIN
- as appropriate? (this code was written before TYPE_NAME and
- TYPE_TAG_NAME were separate). */
+ /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN
+ as appropriate? */
struct symbol *sym;
if (name == NULL)
@@ -3669,8 +3659,7 @@ check_types_equal (struct type *type1, struct type *type2,
|| TYPE_NFIELDS (type1) != TYPE_NFIELDS (type2))
return false;
- if (!compare_maybe_null_strings (TYPE_TAG_NAME (type1),
- TYPE_TAG_NAME (type2)))
+ if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2)))
return false;
if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2)))
return false;
@@ -4530,10 +4519,6 @@ recursive_dump_type (struct type *type, int spaces)
TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
gdb_print_host_address (TYPE_NAME (type), gdb_stdout);
printf_filtered (")\n");
- printfi_filtered (spaces, "tagname '%s' (",
- TYPE_TAG_NAME (type) ? TYPE_TAG_NAME (type) : "<NULL>");
- gdb_print_host_address (TYPE_TAG_NAME (type), gdb_stdout);
- printf_filtered (")\n");
printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type));
switch (TYPE_CODE (type))
{
@@ -4917,8 +4902,6 @@ copy_type_recursive (struct objfile *objfile,
if (TYPE_NAME (type))
TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
- if (TYPE_TAG_NAME (type))
- TYPE_TAG_NAME (new_type) = xstrdup (TYPE_TAG_NAME (type));
TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
@@ -5256,7 +5239,7 @@ arch_composite_type (struct gdbarch *gdbarch, const char *name,
gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION);
t = arch_type (gdbarch, code, 0, NULL);
- TYPE_TAG_NAME (t) = name;
+ TYPE_NAME (t) = name;
INIT_CPLUS_SPECIFIC (t);
return t;
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2a1ed60..1399b8e 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -721,26 +721,12 @@ struct main_type
/* * Name of this type, or NULL if none.
- This is used for printing only, except by poorly designed C++
- code. For looking up a name, look for a symbol in the
- VAR_DOMAIN. This is generally allocated in the objfile's
- obstack. However coffread.c uses malloc. */
+ This is used for printing only. For looking up a name, look for
+ a symbol in the VAR_DOMAIN. This is generally allocated in the
+ objfile's obstack. However coffread.c uses malloc. */
const char *name;
- /* * Tag name for this type, or NULL if none. This means that the
- name of the type consists of a keyword followed by the tag name.
- Which keyword is determined by the type code ("struct" for
- TYPE_CODE_STRUCT, etc.). As far as I know C/C++ are the only
- languages with this feature.
-
- This is used for printing only, except by poorly designed C++ code.
- For looking up a name, look for a symbol in the STRUCT_DOMAIN.
- One more legitimate use is that if TYPE_STUB is set, this is
- the name to use to look for definitions in other files. */
-
- const char *tag_name;
-
/* * Every type is now associated with a particular objfile, and the
type is allocated on the objfile_obstack for that objfile. One
problem however, is that there are times when gdb allocates new
@@ -1293,7 +1279,6 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
#define TYPE_NAME(thistype) TYPE_MAIN_TYPE(thistype)->name
-#define TYPE_TAG_NAME(type) TYPE_MAIN_TYPE(type)->tag_name
#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index ddbec13..8fe7253 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -164,7 +164,7 @@ build_gdb_vtable_type (struct gdbarch *arch)
t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL);
TYPE_NFIELDS (t) = field - field_list;
TYPE_FIELDS (t) = field_list;
- TYPE_TAG_NAME (t) = "gdb_gnu_v3_abi_vtable";
+ TYPE_NAME (t) = "gdb_gnu_v3_abi_vtable";
INIT_CPLUS_SPECIFIC (t);
return make_type_with_address_space (t, TYPE_INSTANCE_FLAG_CODE_SPACE);
@@ -1028,7 +1028,7 @@ build_std_type_info_type (struct gdbarch *arch)
t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL);
TYPE_NFIELDS (t) = field - field_list;
TYPE_FIELDS (t) = field_list;
- TYPE_TAG_NAME (t) = "gdb_gnu_v3_type_info";
+ TYPE_NAME (t) = "gdb_gnu_v3_type_info";
INIT_CPLUS_SPECIFIC (t);
return t;
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index e9cba77..60ab2f3 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -106,8 +106,8 @@ static int
sixg_string_p (struct type *type)
{
if (TYPE_NFIELDS (type) == 2
- && TYPE_TAG_NAME (type) != NULL
- && strcmp (TYPE_TAG_NAME (type), "string") == 0)
+ && TYPE_NAME (type) != NULL
+ && strcmp (TYPE_NAME (type), "string") == 0)
return 1;
return 0;
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index f2e7be3..cc99756 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -576,10 +576,16 @@ gdbscm_type_tag (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ const char *tagname = nullptr;
- if (!TYPE_TAG_NAME (type))
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION
+ || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ tagname = TYPE_NAME (type);
+
+ if (tagname == nullptr)
return SCM_BOOL_F;
- return gdbscm_scm_from_c_string (TYPE_TAG_NAME (type));
+ return gdbscm_scm_from_c_string (tagname);
}
/* (type-name <gdb:type>) -> string
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 27e9429..7279ab5 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -439,22 +439,14 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
if (m2_is_long_set (type))
{
- if (TYPE_TAG_NAME (type) != NULL)
- {
- fputs_filtered (TYPE_TAG_NAME (type), stream);
- if (show == 0)
- return 1;
- }
- else if (TYPE_NAME (type) != NULL)
+ if (TYPE_NAME (type) != NULL)
{
fputs_filtered (TYPE_NAME (type), stream);
if (show == 0)
return 1;
+ fputs_filtered (" = ", stream);
}
- if (TYPE_TAG_NAME (type) != NULL || TYPE_NAME (type) != NULL)
- fputs_filtered (" = ", stream);
-
if (get_long_set_bounds (type, &low, &high))
{
fprintf_filtered(stream, "SET OF ");
@@ -537,11 +529,11 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
int level, const struct type_print_options *flags)
{
/* Print the tag if it exists. */
- if (TYPE_TAG_NAME (type) != NULL)
+ if (TYPE_NAME (type) != NULL)
{
- if (!startswith (TYPE_TAG_NAME (type), "$$"))
+ if (!startswith (TYPE_NAME (type), "$$"))
{
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
if (show > 0)
fprintf_filtered (stream, " = ");
}
@@ -601,10 +593,10 @@ m2_enum (struct type *type, struct ui_file *stream, int show, int level)
if (show < 0)
{
/* If we just printed a tag name, no need to print anything else. */
- if (TYPE_TAG_NAME (type) == NULL)
+ if (TYPE_NAME (type) == NULL)
fprintf_filtered (stream, "(...)");
}
- else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+ else if (show > 0 || TYPE_NAME (type) == NULL)
{
fprintf_filtered (stream, "(");
len = TYPE_NFIELDS (type);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index eeefb66..98f10b4 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1024,10 +1024,10 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
(.Fxx or .xxfake or empty) for unnamed struct/union/enums.
Alpha cc puts out an sh->iss of zero for those. */
if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
- TYPE_TAG_NAME (t) = NULL;
+ TYPE_NAME (t) = NULL;
else
- TYPE_TAG_NAME (t) = obconcat (&mdebugread_objfile->objfile_obstack,
- name, (char *) NULL);
+ TYPE_NAME (t) = obconcat (&mdebugread_objfile->objfile_obstack,
+ name, (char *) NULL);
TYPE_CODE (t) = type_code;
TYPE_LENGTH (t) = sh->value;
@@ -1687,10 +1687,10 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
/* Do not set the tag name if it is a compiler generated tag name
(.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
if (name[0] == '.' || name[0] == '\0')
- TYPE_TAG_NAME (tp) = NULL;
- else if (TYPE_TAG_NAME (tp) == NULL
- || strcmp (TYPE_TAG_NAME (tp), name) != 0)
- TYPE_TAG_NAME (tp)
+ TYPE_NAME (tp) = NULL;
+ else if (TYPE_NAME (tp) == NULL
+ || strcmp (TYPE_NAME (tp), name) != 0)
+ TYPE_NAME (tp)
= ((const char *)
obstack_copy0 (&mdebugread_objfile->objfile_obstack,
name, strlen (name)));
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index e35e0fb..f82a2bc 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -522,9 +522,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
only after args !! */
break;
case TYPE_CODE_STRUCT:
- if (TYPE_TAG_NAME (type) != NULL)
+ if (TYPE_NAME (type) != NULL)
{
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
fputs_filtered (" = ", stream);
}
if (HAVE_CPLUS_STRUCT (type))
@@ -538,9 +538,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
goto struct_union;
case TYPE_CODE_UNION:
- if (TYPE_TAG_NAME (type) != NULL)
+ if (TYPE_NAME (type) != NULL)
{
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
fputs_filtered (" = ", stream);
}
fprintf_filtered (stream, "case <?> of ");
@@ -550,10 +550,10 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if (show < 0)
{
/* If we just printed a tag name, no need to print anything else. */
- if (TYPE_TAG_NAME (type) == NULL)
+ if (TYPE_NAME (type) == NULL)
fprintf_filtered (stream, "{...}");
}
- else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+ else if (show > 0 || TYPE_NAME (type) == NULL)
{
pascal_type_print_derivation_info (stream, type);
@@ -740,9 +740,9 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
break;
case TYPE_CODE_ENUM:
- if (TYPE_TAG_NAME (type) != NULL)
+ if (TYPE_NAME (type) != NULL)
{
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
if (show > 0)
fputs_filtered (" ", stream);
}
@@ -753,10 +753,10 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
if (show < 0)
{
/* If we just printed a tag name, no need to print anything else. */
- if (TYPE_TAG_NAME (type) == NULL)
+ if (TYPE_NAME (type) == NULL)
fprintf_filtered (stream, "(...)");
}
- else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+ else if (show > 0 || TYPE_NAME (type) == NULL)
{
fprintf_filtered (stream, "(");
len = TYPE_NFIELDS (type);
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 80055b0..dd8c0aa 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -416,10 +416,16 @@ static PyObject *
typy_get_tag (PyObject *self, void *closure)
{
struct type *type = ((type_object *) self)->type;
+ const char *tagname = nullptr;
- if (!TYPE_TAG_NAME (type))
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION
+ || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ tagname = TYPE_NAME (type);
+
+ if (tagname == nullptr)
Py_RETURN_NONE;
- return PyString_FromString (TYPE_TAG_NAME (type));
+ return PyString_FromString (tagname);
}
/* Return the type, stripped of typedefs. */
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index ed03945..167f353 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -95,8 +95,8 @@ rust_tuple_type_p (struct type *type)
nothing else in the debuginfo to distinguish a tuple from a
struct. */
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
- && TYPE_TAG_NAME (type) != NULL
- && TYPE_TAG_NAME (type)[0] == '(');
+ && TYPE_NAME (type) != NULL
+ && TYPE_NAME (type)[0] == '(');
}
/* Return true if all non-static fields of a structlike type are in a
@@ -143,9 +143,9 @@ static bool
rust_slice_type_p (struct type *type)
{
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
- && TYPE_TAG_NAME (type) != NULL
- && (strncmp (TYPE_TAG_NAME (type), "&[", 2) == 0
- || strcmp (TYPE_TAG_NAME (type), "&str") == 0));
+ && TYPE_NAME (type) != NULL
+ && (strncmp (TYPE_NAME (type), "&[", 2) == 0
+ || strcmp (TYPE_NAME (type), "&str") == 0));
}
/* Return true if TYPE is a range type, otherwise false. */
@@ -157,8 +157,8 @@ rust_range_type_p (struct type *type)
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|| TYPE_NFIELDS (type) > 2
- || TYPE_TAG_NAME (type) == NULL
- || strstr (TYPE_TAG_NAME (type), "::Range") == NULL)
+ || TYPE_NAME (type) == NULL
+ || strstr (TYPE_NAME (type), "::Range") == NULL)
return false;
if (TYPE_NFIELDS (type) == 0)
@@ -187,8 +187,8 @@ rust_range_type_p (struct type *type)
static bool
rust_inclusive_range_type_p (struct type *type)
{
- return (strstr (TYPE_TAG_NAME (type), "::RangeInclusive") != NULL
- || strstr (TYPE_TAG_NAME (type), "::RangeToInclusive") != NULL);
+ return (strstr (TYPE_NAME (type), "::RangeInclusive") != NULL
+ || strstr (TYPE_NAME (type), "::RangeToInclusive") != NULL);
}
/* Return true if TYPE seems to be the type "u8", otherwise false. */
@@ -353,13 +353,13 @@ val_print_struct (struct type *type, int embedded_offset,
if (!is_tuple)
{
- if (TYPE_TAG_NAME (type) != NULL)
- fprintf_filtered (stream, "%s", TYPE_TAG_NAME (type));
+ if (TYPE_NAME (type) != NULL)
+ fprintf_filtered (stream, "%s", TYPE_NAME (type));
if (TYPE_NFIELDS (type) == 0)
return;
- if (TYPE_TAG_NAME (type) != NULL)
+ if (TYPE_NAME (type) != NULL)
fputs_filtered (" ", stream);
}
@@ -628,7 +628,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
/* Print a tuple type simply. */
if (rust_tuple_type_p (type))
{
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
return;
}
@@ -638,7 +638,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
/* Compute properties of TYPE here because, in the enum case, the
rest of the code ends up looking only at the variant part. */
- const char *tagname = TYPE_TAG_NAME (type);
+ const char *tagname = TYPE_NAME (type);
bool is_tuple_struct = rust_tuple_struct_type_p (type);
bool is_tuple = rust_tuple_type_p (type);
bool is_enum = rust_enum_p (type);
@@ -819,11 +819,11 @@ rust_internal_print_type (struct type *type, const char *varstring,
int i, len = 0;
fputs_filtered ("enum ", stream);
- if (TYPE_TAG_NAME (type) != NULL)
+ if (TYPE_NAME (type) != NULL)
{
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
fputs_filtered (" ", stream);
- len = strlen (TYPE_TAG_NAME (type));
+ len = strlen (TYPE_NAME (type));
}
fputs_filtered ("{\n", stream);
@@ -834,7 +834,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
QUIT;
if (len > 0
- && strncmp (name, TYPE_TAG_NAME (type), len) == 0
+ && strncmp (name, TYPE_NAME (type), len) == 0
&& name[len] == ':'
&& name[len + 1] == ':')
name += len + 2;
@@ -882,7 +882,6 @@ rust_composite_type (struct type *original,
TYPE_CODE (result) = TYPE_CODE_STRUCT;
TYPE_NAME (result) = name;
- TYPE_TAG_NAME (result) = name;
TYPE_NFIELDS (result) = nfields;
TYPE_FIELDS (result)
@@ -1060,10 +1059,10 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
&& TYPE_CODE (type) != TYPE_CODE_ENUM)
|| rust_tuple_type_p (type))
error (_("Method calls only supported on struct or enum types"));
- if (TYPE_TAG_NAME (type) == NULL)
+ if (TYPE_NAME (type) == NULL)
error (_("Method call on nameless type"));
- std::string name = std::string (TYPE_TAG_NAME (type)) + "::" + method;
+ std::string name = std::string (TYPE_NAME (type)) + "::" + method;
block = get_selected_block (0);
sym = lookup_symbol (name.c_str (), block, VAR_DOMAIN, NULL);
@@ -1583,13 +1582,13 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
if (outer_type != NULL)
error(_("Cannot access field %d of variant %s::%s, "
"there are only %d fields"),
- field_number, TYPE_TAG_NAME (outer_type),
- rust_last_path_segment (TYPE_TAG_NAME (type)),
+ field_number, TYPE_NAME (outer_type),
+ rust_last_path_segment (TYPE_NAME (type)),
nfields);
else
error(_("Cannot access field %d of %s, "
"there are only %d fields"),
- field_number, TYPE_TAG_NAME (type), nfields);
+ field_number, TYPE_NAME (type), nfields);
}
/* Tuples are tuple structs too. */
@@ -1597,13 +1596,13 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
{
if (outer_type != NULL)
error(_("Variant %s::%s is not a tuple variant"),
- TYPE_TAG_NAME (outer_type),
- rust_last_path_segment (TYPE_TAG_NAME (type)));
+ TYPE_NAME (outer_type),
+ rust_last_path_segment (TYPE_NAME (type)));
else
error(_("Attempting to access anonymous field %d "
"of %s, which is not a tuple, tuple struct, or "
"tuple-like variant"),
- field_number, TYPE_TAG_NAME (type));
+ field_number, TYPE_NAME (type));
}
result = value_primitive_field (lhs, 0, field_number, type);
@@ -1645,7 +1644,7 @@ tuple structs, and tuple-like enum variants"));
if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type))
error (_("Attempting to access named field foo of tuple "
"variant %s::%s, which has only anonymous fields"),
- TYPE_TAG_NAME (outer_type),
+ TYPE_NAME (outer_type),
rust_last_path_segment (TYPE_NAME (type)));
TRY
@@ -1656,7 +1655,7 @@ tuple structs, and tuple-like enum variants"));
CATCH (except, RETURN_MASK_ERROR)
{
error (_("Could not find field %s of struct variant %s::%s"),
- field_name, TYPE_TAG_NAME (outer_type),
+ field_name, TYPE_NAME (outer_type),
rust_last_path_segment (TYPE_NAME (type)));
}
END_CATCH
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 366b07d..68feabd 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1343,8 +1343,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
- if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
- TYPE_TAG_NAME (SYMBOL_TYPE (sym))
+ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+ TYPE_NAME (SYMBOL_TYPE (sym))
= obconcat (&objfile->objfile_obstack,
SYMBOL_LINKAGE_NAME (sym),
(char *) NULL);
@@ -1699,7 +1699,7 @@ again:
type. */
type = dbx_alloc_type (typenums, objfile);
TYPE_CODE (type) = code;
- TYPE_TAG_NAME (type) = type_name;
+ TYPE_NAME (type) = type_name;
INIT_CPLUS_SPECIFIC (type);
TYPE_STUB (type) = 1;
@@ -1764,7 +1764,6 @@ again:
copies of a type otherwise. */
replace_type (type, xtype);
TYPE_NAME (type) = NULL;
- TYPE_TAG_NAME (type) = NULL;
}
else
{
@@ -3413,9 +3412,9 @@ complain_about_struct_wipeout (struct type *type)
const char *name = "";
const char *kind = "";
- if (TYPE_TAG_NAME (type))
+ if (TYPE_NAME (type))
{
- name = TYPE_TAG_NAME (type);
+ name = TYPE_NAME (type);
switch (TYPE_CODE (type))
{
case TYPE_CODE_STRUCT: kind = "struct "; break;
@@ -3424,11 +3423,6 @@ complain_about_struct_wipeout (struct type *type)
default: kind = "";
}
}
- else if (TYPE_NAME (type))
- {
- name = TYPE_NAME (type);
- kind = "";
- }
else
{
name = "<unknown>";
@@ -4458,7 +4452,7 @@ add_undefined_type_1 (struct type *type)
static void
add_undefined_type (struct type *type, int typenums[2])
{
- if (TYPE_TAG_NAME (type) == NULL)
+ if (TYPE_NAME (type) == NULL)
add_undefined_type_noname (type, typenums);
else
add_undefined_type_1 (type);
@@ -4543,7 +4537,7 @@ cleanup_undefined_types_1 (void)
struct pending *ppt;
int i;
/* Name of the type, without "struct" or "union". */
- const char *type_name = TYPE_TAG_NAME (*type);
+ const char *type_name = TYPE_NAME (*type);
if (type_name == NULL)
{
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 91ddc57..d30a354 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -541,7 +541,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
if (SYMBOL_DOMAIN (symbol) == STRUCT_DOMAIN)
{
- if (TYPE_TAG_NAME (SYMBOL_TYPE (symbol)))
+ if (TYPE_NAME (SYMBOL_TYPE (symbol)))
{
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
&type_print_raw_options);
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 83a6f6c..d4db825 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -189,7 +189,6 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
{
m_type = arch_composite_type (m_gdbarch, NULL, TYPE_CODE_STRUCT);
TYPE_NAME (m_type) = xstrdup (e->name.c_str ());
- TYPE_TAG_NAME (m_type) = TYPE_NAME (m_type);
for (const tdesc_type_field &f : e->fields)
{
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c303d80..9fb10b5 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2018-05-31 Maciej W. Rozycki <macro@mips.com>
* gdb.base/endian.exp: New test.
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index aefaeb0..92086ee 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -360,7 +360,7 @@ foreach { test_name command } $test_list {
set msg "maint print type"
gdb_test_multiple "maint print type argc" $msg {
- -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags\r\nnfields 0 $hex\r\n$gdb_prompt $" {
+ -re "type node $hex\r\nname .int. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags\r\nnfields 0 $hex\r\n$gdb_prompt $" {
pass $msg
}
}
diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp
index 4378dcb..1731b78 100644
--- a/gdb/testsuite/gdb.cp/typeid.exp
+++ b/gdb/testsuite/gdb.cp/typeid.exp
@@ -27,7 +27,7 @@ proc do_typeid_tests {started} {
global hex
# We might see the standard type or gdb's internal type.
- set type_re "(std::type_info|struct gdb_gnu_v3_type_info)"
+ set type_re "(std::type_info|gdb_gnu_v3_type_info)"
foreach simple_var {i cp ccp ca b} {
diff --git a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
index 41eff92..31707bb 100644
--- a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
+++ b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
@@ -38,4 +38,5 @@ gdb_test "show cp-abi" {The currently selected C\+\+ ABI is "gnu-v3".*}
gdb_load ${binfile}
+gdb_test_no_output "set language c++"
gdb_test "ptype c" "type = struct C {\[\r\n \t\]*private:\[\r\n \t\]*int \\(C::\\*fp\\)\\(C \\*( const)?\\);\[\r\n \t\]*}"
diff --git a/gdb/testsuite/gdb.dwarf2/method-ptr.exp b/gdb/testsuite/gdb.dwarf2/method-ptr.exp
index 5a4f053..7fe755c 100644
--- a/gdb/testsuite/gdb.dwarf2/method-ptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/method-ptr.exp
@@ -82,5 +82,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
+gdb_test_no_output "set language c++"
gdb_test "ptype the_typedef" \
"type = int \\(S::\\*\\)\\(S \\* const, float\\)"
diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp
index bb7b9be..94d4007 100644
--- a/gdb/testsuite/gdb.xml/tdesc-regs.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp
@@ -179,7 +179,7 @@ gdb_test "ptype \$extrareg" "type = (int|long|long long)"
gdb_test "ptype \$uintreg" "type = uint32_t"
gdb_test "ptype \$vecreg" "type = int8_t __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
gdb_test "ptype \$unionreg" \
- "type = union {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
+ "type = union vecint {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
gdb_test "ptype \$unionreg.v4" "type = int8_t __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
gdb_test "ptype \$structreg" \
"type = struct struct1 {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
@@ -189,7 +189,7 @@ gdb_test "ptype \$bitfields" \
gdb_test "ptype \$flags" \
"type = flag flags {\r\n *bool X @0;\r\n *uint32_t Y @2;\r\n}"
gdb_test "ptype \$mixed_flags" \
- "type = flag mixed_flags {\r\n *bool A @0;\r\n *uint32_t B @1-3;\r\n *bool C @4;\r\n *uint32_t D @5;\r\n *uint32_t @6-7;\r\n *enum {yes = 1, no = 0, maybe = 2, so} Z @8-9;\r\n}"
+ "type = flag mixed_flags {\r\n *bool A @0;\r\n *uint32_t B @1-3;\r\n *bool C @4;\r\n *uint32_t D @5;\r\n *uint32_t @6-7;\r\n *enum Z_values {yes = 1, no = 0, maybe = 2, so} Z @8-9;\r\n}"
# Reggroups should have at least general and the extra foo group
gdb_test "maintenance print reggroups" \
" Group\[ \t\]+Type\[ \t\]+\r\n.* general\[ \t\]+user\[ \t\]+\r\n.* foo\[ \t\]+user\[ \t\]+"
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 58e3a09..d2dd590 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -61,8 +61,6 @@ find_size_for_pointer_math (struct type *ptr_type)
name = TYPE_NAME (ptr_target);
if (name == NULL)
- name = TYPE_TAG_NAME (ptr_target);
- if (name == NULL)
error (_("Cannot perform pointer math on incomplete types, "
"try casting to a known type, or void *."));
else
diff --git a/gdb/valops.c b/gdb/valops.c
index 62a86c0..ed8019c 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3243,7 +3243,7 @@ enum_constant_from_type (struct type *type, const char *name)
}
error (_("no constant named \"%s\" in enum \"%s\""),
- name, TYPE_TAG_NAME (type));
+ name, TYPE_NAME (type));
}
/* C++: Given an aggregate type CURTYPE, and a member name NAME,
@@ -3581,7 +3581,7 @@ value_namespace_elt (const struct type *curtype,
if (retval == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_TAG_NAME (curtype));
+ name, TYPE_NAME (curtype));
return retval;
}
@@ -3597,7 +3597,7 @@ value_maybe_namespace_elt (const struct type *curtype,
const char *name, int want_address,
enum noside noside)
{
- const char *namespace_name = TYPE_TAG_NAME (curtype);
+ const char *namespace_name = TYPE_NAME (curtype);
struct block_symbol sym;
struct value *result;