+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
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
TYPE_FIELDS (type) = NULL;
INIT_CPLUS_SPECIFIC (type);
TYPE_NAME (type) = "<empty>";
- TYPE_TAG_NAME (type) = NULL;
TYPE_LENGTH (type) = 0;
return 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;
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;
}
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);
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)
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
if (!found)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_TAG_NAME (curtype));
+ name, TYPE_NAME (curtype));
return found;
}
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,
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);
}
{
/* 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;
/* 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;
}
"{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);
}
{
/* 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;
case TYPE_CODE_NAMESPACE:
fputs_filtered ("namespace ", stream);
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
break;
default:
/* 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;
/* 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);
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;
/* 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;
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;
&& 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));
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,
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;
}
}
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
{
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)
/* 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);
}
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);
}
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.
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. */
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. */
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;
}
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)
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:
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);
}
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 ();
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)
|| 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;
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))
{
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);
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;
}
/* * 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
#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
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);
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;
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;
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
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 ");
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, " = ");
}
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);
(.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;
/* 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)));
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))
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 ");
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);
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);
}
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);
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. */
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
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. */
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)
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. */
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);
}
/* 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;
}
/* 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);
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);
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;
TYPE_CODE (result) = TYPE_CODE_STRUCT;
TYPE_NAME (result) = name;
- TYPE_TAG_NAME (result) = name;
TYPE_NFIELDS (result) = nfields;
TYPE_FIELDS (result)
&& 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);
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. */
{
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);
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
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
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);
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;
copies of a type otherwise. */
replace_type (type, xtype);
TYPE_NAME (type) = NULL;
- TYPE_TAG_NAME (type) = NULL;
}
else
{
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;
default: kind = "";
}
}
- else if (TYPE_NAME (type))
- {
- name = TYPE_NAME (type);
- kind = "";
- }
else
{
name = "<unknown>";
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);
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)
{
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);
{
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)
{
+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.
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
}
}
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} {
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\]*}"
return -1
}
+gdb_test_no_output "set language c++"
gdb_test "ptype the_typedef" \
"type = int \\(S::\\*\\)\\(S \\* const, float\\)"
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}"
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\]+"
const char *name;
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 *."));
}
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,
if (retval == NULL)
error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, TYPE_TAG_NAME (curtype));
+ name, TYPE_NAME (curtype));
return retval;
}
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;