#include "demangle.h"
#include "complaints.h"
#include "gdbcmd.h"
+#include "wrapper.h"
/* These variables point to the objects
representing the predefined C data types. */
struct type *builtin_type_int64;
struct type *builtin_type_uint64;
struct type *builtin_type_bool;
+struct type *builtin_type_v4sf;
+struct type *builtin_type_v4si;
+struct type *builtin_type_v8qi;
+struct type *builtin_type_v4hi;
+struct type *builtin_type_v2si;
+struct type *builtin_type_ptr;
+struct type *builtin_type_CORE_ADDR;
+struct type *builtin_type_bfd_vma;
int opaque_type_resolution = 1;
-
+int overload_debug = 0;
struct extra
{
char str[128];
int len;
- }; /* maximum extention is 128! FIXME */
+ }; /* maximum extension is 128! FIXME */
-static void add_name PARAMS ((struct extra *, char *));
-static void add_mangled_type PARAMS ((struct extra *, struct type *));
+static void add_name (struct extra *, char *);
+static void add_mangled_type (struct extra *, struct type *);
#if 0
-static void cfront_mangle_name PARAMS ((struct type *, int, int));
+static void cfront_mangle_name (struct type *, int, int);
#endif
-static void print_bit_vector PARAMS ((B_TYPE *, int));
-static void print_arg_types PARAMS ((struct type **, int));
-static void dump_fn_fieldlists PARAMS ((struct type *, int));
-static void print_cplus_stuff PARAMS ((struct type *, int));
-static void virtual_base_list_aux PARAMS ((struct type * dclass));
+static void print_bit_vector (B_TYPE *, int);
+static void print_arg_types (struct type **, int);
+static void dump_fn_fieldlists (struct type *, int);
+static void print_cplus_stuff (struct type *, int);
+static void virtual_base_list_aux (struct type *dclass);
/* Alloc a new type structure and fill it with some defaults. If
in that objfile's type_obstack. */
struct type *
-alloc_type (objfile)
- struct objfile *objfile;
+alloc_type (struct objfile *objfile)
{
register struct type *type;
We allocate new memory if needed. */
struct type *
-make_pointer_type (type, typeptr)
- struct type *type;
- struct type **typeptr;
+make_pointer_type (struct type *type, struct type **typeptr)
{
register struct type *ntype; /* New type */
struct objfile *objfile;
TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
TYPE_CODE (ntype) = TYPE_CODE_PTR;
- /* pointers are unsigned */
+ /* Mark pointers as unsigned. The target converts between pointers
+ and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and
+ ADDRESS_TO_POINTER(). */
TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED;
if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */
May need to construct such a type if this is the first use. */
struct type *
-lookup_pointer_type (type)
- struct type *type;
+lookup_pointer_type (struct type *type)
{
return make_pointer_type (type, (struct type **) 0);
}
We allocate new memory if needed. */
struct type *
-make_reference_type (type, typeptr)
- struct type *type;
- struct type **typeptr;
+make_reference_type (struct type *type, struct type **typeptr)
{
register struct type *ntype; /* New type */
struct objfile *objfile;
/* Same as above, but caller doesn't care about memory allocation details. */
struct type *
-lookup_reference_type (type)
- struct type *type;
+lookup_reference_type (struct type *type)
{
return make_reference_type (type, (struct type **) 0);
}
We allocate new memory if needed. */
struct type *
-make_function_type (type, typeptr)
- struct type *type;
- struct type **typeptr;
+make_function_type (struct type *type, struct type **typeptr)
{
register struct type *ntype; /* New type */
struct objfile *objfile;
May need to construct such a type if this is the first use. */
struct type *
-lookup_function_type (type)
- struct type *type;
+lookup_function_type (struct type *type)
{
return make_function_type (type, (struct type **) 0);
}
We allocate new memory if needed. */
struct type *
-make_cv_type (cnst, voltl, type, typeptr)
- int cnst;
- int voltl;
- struct type *type;
- struct type **typeptr;
+make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
{
register struct type *ntype; /* New type */
register struct type *tmp_type = type; /* tmp type */
of the aggregate that the member belongs to. */
struct type *
-lookup_member_type (type, domain)
- struct type *type;
- struct type *domain;
+lookup_member_type (struct type *type, struct type *domain)
{
register struct type *mtype;
This always returns a fresh type. */
struct type *
-allocate_stub_method (type)
- struct type *type;
+allocate_stub_method (struct type *type)
{
struct type *mtype;
sure it is TYPE_CODE_UNDEF before we bash it into a range type? */
struct type *
-create_range_type (result_type, index_type, low_bound, high_bound)
- struct type *result_type;
- struct type *index_type;
- int low_bound;
- int high_bound;
+create_range_type (struct type *result_type, struct type *index_type,
+ int low_bound, int high_bound)
{
if (result_type == NULL)
{
will fit in LONGEST), or -1 otherwise. */
int
-get_discrete_bounds (type, lowp, highp)
- struct type *type;
- LONGEST *lowp, *highp;
+get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
{
CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
sure it is TYPE_CODE_UNDEF before we bash it into an array type? */
struct type *
-create_array_type (result_type, element_type, range_type)
- struct type *result_type;
- struct type *element_type;
- struct type *range_type;
+create_array_type (struct type *result_type, struct type *element_type,
+ struct type *range_type)
{
LONGEST low_bound, high_bound;
sure it is TYPE_CODE_UNDEF before we bash it into a string type? */
struct type *
-create_string_type (result_type, range_type)
- struct type *result_type;
- struct type *range_type;
+create_string_type (struct type *result_type, struct type *range_type)
{
result_type = create_array_type (result_type,
*current_language->string_char_type,
}
struct type *
-create_set_type (result_type, domain_type)
- struct type *result_type;
- struct type *domain_type;
+create_set_type (struct type *result_type, struct type *domain_type)
{
LONGEST low_bound, high_bound, bit_length;
if (result_type == NULL)
return (result_type);
}
+
+/* Construct and return a type of the form:
+ struct NAME { ELT_TYPE ELT_NAME[N]; }
+ We use these types for SIMD registers. For example, the type of
+ the SSE registers on the late x86-family processors is:
+ struct __builtin_v4sf { float f[4]; }
+ built by the function call:
+ init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4)
+ The type returned is a permanent type, allocated using malloc; it
+ doesn't live in any objfile's obstack. */
+static struct type *
+init_simd_type (char *name,
+ struct type *elt_type,
+ char *elt_name,
+ int n)
+{
+ struct type *t;
+ struct field *f;
+
+ /* Build the field structure. */
+ f = xmalloc (sizeof (*f));
+ memset (f, 0, sizeof (*f));
+ f->loc.bitpos = 0;
+ f->type = create_array_type (0, elt_type,
+ create_range_type (0, builtin_type_int,
+ 0, n-1));
+ f->name = elt_name;
+
+ /* Build a struct type with that field. */
+ t = init_type (TYPE_CODE_STRUCT, n * TYPE_LENGTH (elt_type), 0, 0, 0);
+ t->nfields = 1;
+ t->fields = f;
+ t->tag_name = name;
+
+ return t;
+}
+
+
/* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
A MEMBER is a wierd thing -- it amounts to a typed offset into
a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
allocated. */
void
-smash_to_member_type (type, domain, to_type)
- struct type *type;
- struct type *domain;
- struct type *to_type;
+smash_to_member_type (struct type *type, struct type *domain,
+ struct type *to_type)
{
struct objfile *objfile;
allocated. */
void
-smash_to_method_type (type, domain, to_type, args)
- struct type *type;
- struct type *domain;
- struct type *to_type;
- struct type **args;
+smash_to_method_type (struct type *type, struct type *domain,
+ struct type *to_type, struct type **args)
{
struct objfile *objfile;
"union ", or "enum ". If the type has a NULL name, return NULL. */
char *
-type_name_no_tag (type)
- register const struct type *type;
+type_name_no_tag (register const struct type *type)
{
if (TYPE_TAG_NAME (type) != NULL)
return TYPE_TAG_NAME (type);
Return zero if NAME is not a primitive type. */
struct type *
-lookup_primitive_typename (name)
- char *name;
+lookup_primitive_typename (char *name)
{
struct type **const *p;
If NOERR is nonzero, return zero if NAME is not suitably defined. */
struct type *
-lookup_typename (name, block, noerr)
- char *name;
- struct block *block;
- int noerr;
+lookup_typename (char *name, struct block *block, int noerr)
{
register struct symbol *sym;
register struct type *tmp;
}
struct type *
-lookup_unsigned_typename (name)
- char *name;
+lookup_unsigned_typename (char *name)
{
char *uns = alloca (strlen (name) + 10);
}
struct type *
-lookup_signed_typename (name)
- char *name;
+lookup_signed_typename (char *name)
{
struct type *t;
char *uns = alloca (strlen (name) + 8);
visible in lexical block BLOCK. */
struct type *
-lookup_struct (name, block)
- char *name;
- struct block *block;
+lookup_struct (char *name, struct block *block)
{
register struct symbol *sym;
visible in lexical block BLOCK. */
struct type *
-lookup_union (name, block)
- char *name;
- struct block *block;
+lookup_union (char *name, struct block *block)
{
register struct symbol *sym;
struct type *t;
visible in lexical block BLOCK. */
struct type *
-lookup_enum (name, block)
- char *name;
- struct block *block;
+lookup_enum (char *name, struct block *block)
{
register struct symbol *sym;
visible in lexical block BLOCK. */
struct type *
-lookup_template_type (name, type, block)
- char *name;
- struct type *type;
- struct block *block;
+lookup_template_type (char *name, struct type *type, struct block *block)
{
struct symbol *sym;
char *nam = (char *) alloca (strlen (name) + strlen (type->name) + 4);
If NAME is the name of a baseclass type, return that type. */
struct type *
-lookup_struct_elt_type (type, name, noerr)
- struct type *type;
- char *name;
- int noerr;
+lookup_struct_elt_type (struct type *type, char *name, int noerr)
{
int i;
{
char *t_field_name = TYPE_FIELD_NAME (type, i);
- if (t_field_name && STREQ (t_field_name, name))
+ if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
return TYPE_FIELD_TYPE (type, i);
}
will remain NULL. */
void
-fill_in_vptr_fieldno (type)
- struct type *type;
+fill_in_vptr_fieldno (struct type *type)
{
CHECK_TYPEDEF (type);
Return 1 if the destructor was found, otherwise, return 0. */
int
-get_destructor_fn_field (t, method_indexp, field_indexp)
- struct type *t;
- int *method_indexp;
- int *field_indexp;
+get_destructor_fn_field (struct type *t, int *method_indexp, int *field_indexp)
{
int i;
{"stub type has NULL name", 0, 0};
struct type *
-check_typedef (type)
- register struct type *type;
+check_typedef (register struct type *type)
{
struct type *orig_type = type;
while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
#define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
static void
-add_name (pextras, n)
- struct extra *pextras;
- char *n;
+add_name (struct extra *pextras, char *n)
{
int nlen;
}
static void
-add_mangled_type (pextras, t)
- struct extra *pextras;
- struct type *t;
+add_mangled_type (struct extra *pextras, struct type *t)
{
enum type_code tcode;
int tlen, tflags;
#if 0
void
-cfront_mangle_name (type, i, j)
- struct type *type;
- int i;
- int j;
+cfront_mangle_name (struct type *type, int i, int j)
{
struct fn_field *f;
char *mangled_name = gdb_mangle_name (type, i, j);
#undef ADD_EXTRA
/* End of new code added to support parsing of Cfront stabs strings */
+/* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
+ silently return builtin_type_void. */
+
+struct type *
+safe_parse_type (char *p, int length)
+{
+ struct ui_file *saved_gdb_stderr;
+ struct type *type;
+
+ /* Suppress error messages. */
+ saved_gdb_stderr = gdb_stderr;
+ gdb_stderr = ui_file_new ();
+
+ /* Call parse_and_eval_type() without fear of longjmp()s. */
+ if (!gdb_parse_and_eval_type (p, length, &type))
+ type = builtin_type_void;
+
+ /* Stop suppressing error messages. */
+ ui_file_delete (gdb_stderr);
+ gdb_stderr = saved_gdb_stderr;
+
+ return type;
+}
+
/* Ugly hack to convert method stubs into method types.
He ain't kiddin'. This demangles the name of the method into a string
the space required for them. */
void
-check_stub_method (type, method_id, signature_id)
- struct type *type;
- int method_id;
- int signature_id;
+check_stub_method (struct type *type, int method_id, int signature_id)
{
struct fn_field *f;
char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
argtypetext = p;
while (*p)
{
- if (*p == '(')
+ if (*p == '(' || *p == '<')
{
depth += 1;
}
- else if (*p == ')')
+ else if (*p == ')' || *p == '>')
{
depth -= 1;
}
if (strncmp (argtypetext, "...", p - argtypetext) != 0)
{
argtypes[argcount] =
- parse_and_eval_type (argtypetext, p - argtypetext);
+ safe_parse_type (argtypetext, p - argtypetext);
argcount += 1;
}
argtypetext = p + 1;
}
- if (*p == '(')
+ if (*p == '(' || *p == '<')
{
depth += 1;
}
- else if (*p == ')')
+ else if (*p == ')' || *p == '>')
{
depth -= 1;
}
const struct cplus_struct_type cplus_struct_default;
void
-allocate_cplus_struct_type (type)
- struct type *type;
+allocate_cplus_struct_type (struct type *type)
{
if (!HAVE_CPLUS_STRUCT (type))
{
in particular, where init_type is called with a NULL value for NAME). */
struct type *
-init_type (code, length, flags, name, objfile)
- enum type_code code;
- int length;
- int flags;
- char *name;
- struct objfile *objfile;
+init_type (enum type_code code, int length, int flags, char *name,
+ struct objfile *objfile)
{
register struct type *type;
struct type *
-lookup_fundamental_type (objfile, typeid)
- struct objfile *objfile;
- int typeid;
+lookup_fundamental_type (struct objfile *objfile, int typeid)
{
register struct type **typep;
register int nbytes;
}
int
-can_dereference (t)
- struct type *t;
+can_dereference (struct type *t)
{
/* FIXME: Should we return true for references as well as pointers? */
CHECK_TYPEDEF (t);
&& TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID);
}
+int
+is_integral_type (struct type *t)
+{
+ CHECK_TYPEDEF (t);
+ return
+ ((t != NULL)
+ && ((TYPE_CODE (t) == TYPE_CODE_INT)
+ || (TYPE_CODE (t) == TYPE_CODE_ENUM)
+ || (TYPE_CODE (t) == TYPE_CODE_CHAR)
+ || (TYPE_CODE (t) == TYPE_CODE_RANGE)
+ || (TYPE_CODE (t) == TYPE_CODE_BOOL)));
+}
+
/* Chill varying string and arrays are represented as follows:
struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
Return true if TYPE is such a Chill varying type. */
int
-chill_varying_type (type)
- struct type *type;
+chill_varying_type (struct type *type)
{
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|| TYPE_NFIELDS (type) != 2
the ancestor relationship even if they're identical */
int
-is_ancestor (base, dclass)
- struct type *base;
- struct type *dclass;
+is_ancestor (struct type *base, struct type *dclass)
{
int i;
if (base == dclass)
return 1;
+ if (TYPE_NAME (base) && TYPE_NAME (dclass) &&
+ !strcmp (TYPE_NAME (base), TYPE_NAME (dclass)))
+ return 1;
for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
if (is_ancestor (base, TYPE_BASECLASS (dclass, i)))
runtime models. Return 1 => Yes, 0 => No. */
int
-has_vtable (dclass)
- struct type *dclass;
+has_vtable (struct type *dclass)
{
/* In the HP ANSI C++ runtime model, a class has a vtable only if it
has virtual functions or virtual bases. */
and may not work with other runtime models. */
struct type *
-primary_base_class (dclass)
- struct type *dclass;
+primary_base_class (struct type *dclass)
{
/* In HP ANSI C++'s runtime model, a "primary base class" of a class
is the first directly inherited, non-virtual base class that
copies the items out in reverse order. */
static void
-virtual_base_list_aux (dclass)
- struct type *dclass;
+virtual_base_list_aux (struct type *dclass)
{
struct vbase *tmp_vbase;
register int i;
and then copies the result into an array to save space. */
struct type **
-virtual_base_list (dclass)
- struct type *dclass;
+virtual_base_list (struct type *dclass)
{
register struct vbase *tmp_vbase;
register struct vbase *tmp_vbase_2;
/* Return the length of the virtual base list of the type DCLASS. */
int
-virtual_base_list_length (dclass)
- struct type *dclass;
+virtual_base_list_length (struct type *dclass)
{
register int i;
register struct vbase *tmp_vbase;
primary base, recursively). */
int
-virtual_base_list_length_skip_primaries (dclass)
- struct type *dclass;
+virtual_base_list_length_skip_primaries (struct type *dclass)
{
register int i;
register struct vbase *tmp_vbase;
indicates "not found" or a problem. */
int
-virtual_base_index (base, dclass)
- struct type *base;
- struct type *dclass;
+virtual_base_index (struct type *base, struct type *dclass)
{
register struct type *vbase;
register int i;
found" or a problem. */
int
-virtual_base_index_skip_primaries (base, dclass)
- struct type *base;
- struct type *dclass;
+virtual_base_index_skip_primaries (struct type *base, struct type *dclass)
{
register struct type *vbase;
register int i, j;
* Position returned is 0-based. */
int
-class_index_in_primary_list (dclass)
- struct type *dclass;
+class_index_in_primary_list (struct type *dclass)
{
struct type *pbc; /* primary base class */
*/
int
-count_virtual_fns (dclass)
- struct type *dclass;
+count_virtual_fns (struct type *dclass)
{
- int base; /* index for base classes */
int fn, oi; /* function and overloaded instance indices */
-
int vfuncs; /* count to return */
/* recurse on bases that can share virtual table */
* 3 => A is worse than B */
int
-compare_badness (a, b)
- struct badness_vector *a;
- struct badness_vector *b;
+compare_badness (struct badness_vector *a, struct badness_vector *b)
{
int i;
int tmp;
* Return a pointer to a badness vector. This has NARGS + 1 entries. */
struct badness_vector *
-rank_function (parms, nparms, args, nargs)
- struct type **parms;
- int nparms;
- struct type **args;
- int nargs;
+rank_function (struct type **parms, int nparms, struct type **args, int nargs)
{
int i;
struct badness_vector *bv;
/* Now rank all the parameters of the candidate function */
for (i = 1; i <= min_len; i++)
- bv->rank[i] = rank_one_type (parms[i - 1], args[i - 1]);
+ bv->rank[i] = rank_one_type (parms[i-1], args[i-1]);
/* If more arguments than parameters, add dummy entries */
for (i = min_len + 1; i <= nargs; i++)
* Generally the "bad" conversions are all uniformly assigned a 100 */
int
-rank_one_type (parm, arg)
- struct type *parm;
- struct type *arg;
+rank_one_type (struct type *parm, struct type *arg)
{
/* Identical type pointers */
/* However, this still doesn't catch all cases of same type for arg
if (TYPE_CODE (arg) == TYPE_CODE_TYPEDEF)
arg = check_typedef (arg);
+ /*
+ Well, damnit, if the names are exactly the same,
+ i'll say they are exactly the same. This happens when we generate
+ method stubs. The types won't point to the same address, but they
+ really are the same.
+ */
+
+ if (TYPE_NAME (parm) && TYPE_NAME (arg) &&
+ !strcmp (TYPE_NAME (parm), TYPE_NAME (arg)))
+ return 0;
+
/* Check if identical after resolving typedefs */
if (parm == arg)
return 0;
-#if 0
- /* Debugging only */
- printf ("------ Arg is %s [%d], parm is %s [%d]\n",
- TYPE_NAME (arg), TYPE_CODE (arg), TYPE_NAME (parm), TYPE_CODE (parm));
-#endif
+ /* See through references, since we can almost make non-references
+ references. */
+ if (TYPE_CODE (arg) == TYPE_CODE_REF)
+ return (rank_one_type (parm, TYPE_TARGET_TYPE (arg))
+ + REFERENCE_CONVERSION_BADNESS);
+ if (TYPE_CODE (parm) == TYPE_CODE_REF)
+ return (rank_one_type (TYPE_TARGET_TYPE (parm), arg)
+ + REFERENCE_CONVERSION_BADNESS);
+ if (overload_debug)
+ /* Debugging only. */
+ fprintf_filtered (gdb_stderr,"------ Arg is %s [%d], parm is %s [%d]\n",
+ TYPE_NAME (arg), TYPE_CODE (arg), TYPE_NAME (parm), TYPE_CODE (parm));
/* x -> y means arg of type x being supplied for parameter of type y */
{
if (TYPE_UNSIGNED (arg))
{
- if (!strcmp (TYPE_NAME (parm), TYPE_NAME (arg)))
+ if (!strcmp_iw (TYPE_NAME (parm), TYPE_NAME (arg)))
return 0; /* unsigned int -> unsigned int, or unsigned long -> unsigned long */
- else if (!strcmp (TYPE_NAME (arg), "int") && !strcmp (TYPE_NAME (parm), "long"))
+ else if (!strcmp_iw (TYPE_NAME (arg), "int") && !strcmp_iw (TYPE_NAME (parm), "long"))
return INTEGER_PROMOTION_BADNESS; /* unsigned int -> unsigned long */
else
return INTEGER_COERCION_BADNESS; /* unsigned long -> unsigned int */
}
else
{
- if (!strcmp (TYPE_NAME (arg), "long") && !strcmp (TYPE_NAME (parm), "int"))
+ if (!strcmp_iw (TYPE_NAME (arg), "long") && !strcmp_iw (TYPE_NAME (parm), "int"))
return INTEGER_COERCION_BADNESS; /* signed long -> unsigned int */
else
return INTEGER_CONVERSION_BADNESS; /* signed int/long -> unsigned int/long */
}
else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
{
- if (!strcmp (TYPE_NAME (parm), TYPE_NAME (arg)))
+ if (!strcmp_iw (TYPE_NAME (parm), TYPE_NAME (arg)))
return 0;
- else if (!strcmp (TYPE_NAME (arg), "int") && !strcmp (TYPE_NAME (parm), "long"))
+ else if (!strcmp_iw (TYPE_NAME (arg), "int") && !strcmp_iw (TYPE_NAME (parm), "long"))
return INTEGER_PROMOTION_BADNESS;
else
return INTEGER_COERCION_BADNESS;
/* End of functions for overload resolution */
static void
-print_bit_vector (bits, nbits)
- B_TYPE *bits;
- int nbits;
+print_bit_vector (B_TYPE *bits, int nbits)
{
int bitno;
include it since we may get into a infinitely recursive situation. */
static void
-print_arg_types (args, spaces)
- struct type **args;
- int spaces;
+print_arg_types (struct type **args, int spaces)
{
if (args != NULL)
{
}
static void
-dump_fn_fieldlists (type, spaces)
- struct type *type;
- int spaces;
+dump_fn_fieldlists (struct type *type, int spaces)
{
int method_idx;
int overload_idx;
struct fn_field *f;
printfi_filtered (spaces, "fn_fieldlists ");
- gdb_print_address (TYPE_FN_FIELDLISTS (type), gdb_stdout);
+ gdb_print_host_address (TYPE_FN_FIELDLISTS (type), gdb_stdout);
printf_filtered ("\n");
for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++)
{
printfi_filtered (spaces + 2, "[%d] name '%s' (",
method_idx,
TYPE_FN_FIELDLIST_NAME (type, method_idx));
- gdb_print_address (TYPE_FN_FIELDLIST_NAME (type, method_idx),
- gdb_stdout);
+ gdb_print_host_address (TYPE_FN_FIELDLIST_NAME (type, method_idx),
+ gdb_stdout);
printf_filtered (") length %d\n",
TYPE_FN_FIELDLIST_LENGTH (type, method_idx));
for (overload_idx = 0;
printfi_filtered (spaces + 4, "[%d] physname '%s' (",
overload_idx,
TYPE_FN_FIELD_PHYSNAME (f, overload_idx));
- gdb_print_address (TYPE_FN_FIELD_PHYSNAME (f, overload_idx),
- gdb_stdout);
+ gdb_print_host_address (TYPE_FN_FIELD_PHYSNAME (f, overload_idx),
+ gdb_stdout);
printf_filtered (")\n");
printfi_filtered (spaces + 8, "type ");
- gdb_print_address (TYPE_FN_FIELD_TYPE (f, overload_idx), gdb_stdout);
+ gdb_print_host_address (TYPE_FN_FIELD_TYPE (f, overload_idx), gdb_stdout);
printf_filtered ("\n");
recursive_dump_type (TYPE_FN_FIELD_TYPE (f, overload_idx),
spaces + 8 + 2);
printfi_filtered (spaces + 8, "args ");
- gdb_print_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout);
+ gdb_print_host_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout);
printf_filtered ("\n");
print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces);
printfi_filtered (spaces + 8, "fcontext ");
- gdb_print_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
- gdb_stdout);
+ gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
+ gdb_stdout);
printf_filtered ("\n");
printfi_filtered (spaces + 8, "is_const %d\n",
}
static void
-print_cplus_stuff (type, spaces)
- struct type *type;
- int spaces;
+print_cplus_stuff (struct type *type, int spaces)
{
printfi_filtered (spaces, "n_baseclasses %d\n",
TYPE_N_BASECLASSES (type));
{
printfi_filtered (spaces, "virtual_field_bits (%d bits at *",
TYPE_N_BASECLASSES (type));
- gdb_print_address (TYPE_FIELD_VIRTUAL_BITS (type), gdb_stdout);
+ gdb_print_host_address (TYPE_FIELD_VIRTUAL_BITS (type), gdb_stdout);
printf_filtered (")");
print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type),
{
printfi_filtered (spaces, "private_field_bits (%d bits at *",
TYPE_NFIELDS (type));
- gdb_print_address (TYPE_FIELD_PRIVATE_BITS (type), gdb_stdout);
+ gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type), gdb_stdout);
printf_filtered (")");
print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type),
TYPE_NFIELDS (type));
{
printfi_filtered (spaces, "protected_field_bits (%d bits at *",
TYPE_NFIELDS (type));
- gdb_print_address (TYPE_FIELD_PROTECTED_BITS (type), gdb_stdout);
+ gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type), gdb_stdout);
printf_filtered (")");
print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type),
TYPE_NFIELDS (type));
static struct obstack dont_print_type_obstack;
void
-recursive_dump_type (type, spaces)
- struct type *type;
- int spaces;
+recursive_dump_type (struct type *type, int spaces)
{
int idx;
if (type == first_dont_print[i])
{
printfi_filtered (spaces, "type node ");
- gdb_print_address (type, gdb_stdout);
+ gdb_print_host_address (type, gdb_stdout);
printf_filtered (" <same as already seen type>\n");
return;
}
}
printfi_filtered (spaces, "type node ");
- gdb_print_address (type, gdb_stdout);
+ gdb_print_host_address (type, gdb_stdout);
printf_filtered ("\n");
printfi_filtered (spaces, "name '%s' (",
TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
- gdb_print_address (TYPE_NAME (type), gdb_stdout);
+ gdb_print_host_address (TYPE_NAME (type), gdb_stdout);
printf_filtered (")\n");
if (TYPE_TAG_NAME (type) != NULL)
{
printfi_filtered (spaces, "tagname '%s' (",
TYPE_TAG_NAME (type));
- gdb_print_address (TYPE_TAG_NAME (type), gdb_stdout);
+ gdb_print_host_address (TYPE_TAG_NAME (type), gdb_stdout);
printf_filtered (")\n");
}
printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type));
puts_filtered ("\n");
printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
printfi_filtered (spaces, "objfile ");
- gdb_print_address (TYPE_OBJFILE (type), gdb_stdout);
+ gdb_print_host_address (TYPE_OBJFILE (type), gdb_stdout);
printf_filtered ("\n");
printfi_filtered (spaces, "target_type ");
- gdb_print_address (TYPE_TARGET_TYPE (type), gdb_stdout);
+ gdb_print_host_address (TYPE_TARGET_TYPE (type), gdb_stdout);
printf_filtered ("\n");
if (TYPE_TARGET_TYPE (type) != NULL)
{
recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2);
}
printfi_filtered (spaces, "pointer_type ");
- gdb_print_address (TYPE_POINTER_TYPE (type), gdb_stdout);
+ gdb_print_host_address (TYPE_POINTER_TYPE (type), gdb_stdout);
printf_filtered ("\n");
printfi_filtered (spaces, "reference_type ");
- gdb_print_address (TYPE_REFERENCE_TYPE (type), gdb_stdout);
+ gdb_print_host_address (TYPE_REFERENCE_TYPE (type), gdb_stdout);
printf_filtered ("\n");
printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
if (TYPE_FLAGS (type) & TYPE_FLAG_UNSIGNED)
}
puts_filtered ("\n");
printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type));
- gdb_print_address (TYPE_FIELDS (type), gdb_stdout);
+ gdb_print_host_address (TYPE_FIELDS (type), gdb_stdout);
puts_filtered ("\n");
for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
{
"[%d] bitpos %d bitsize %d type ",
idx, TYPE_FIELD_BITPOS (type, idx),
TYPE_FIELD_BITSIZE (type, idx));
- gdb_print_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
+ gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
printf_filtered (" name '%s' (",
TYPE_FIELD_NAME (type, idx) != NULL
? TYPE_FIELD_NAME (type, idx)
: "<NULL>");
- gdb_print_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
+ gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
printf_filtered (")\n");
if (TYPE_FIELD_TYPE (type, idx) != NULL)
{
}
}
printfi_filtered (spaces, "vptr_basetype ");
- gdb_print_address (TYPE_VPTR_BASETYPE (type), gdb_stdout);
+ gdb_print_host_address (TYPE_VPTR_BASETYPE (type), gdb_stdout);
puts_filtered ("\n");
if (TYPE_VPTR_BASETYPE (type) != NULL)
{
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
printfi_filtered (spaces, "arg_types ");
- gdb_print_address (TYPE_ARG_TYPES (type), gdb_stdout);
+ gdb_print_host_address (TYPE_ARG_TYPES (type), gdb_stdout);
puts_filtered ("\n");
print_arg_types (TYPE_ARG_TYPES (type), spaces);
break;
case TYPE_CODE_STRUCT:
printfi_filtered (spaces, "cplus_stuff ");
- gdb_print_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout);
+ gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout);
puts_filtered ("\n");
print_cplus_stuff (type, spaces);
break;
the value. Pick cplus_struct_type, even though we know it isn't
any particular one. */
printfi_filtered (spaces, "type_specific ");
- gdb_print_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout);
+ gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout);
if (TYPE_CPLUS_SPECIFIC (type) != NULL)
{
printf_filtered (" (unknown data form)");
obstack_free (&dont_print_type_obstack, NULL);
}
-static void build_gdbtypes PARAMS ((void));
+static void build_gdbtypes (void);
static void
-build_gdbtypes ()
+build_gdbtypes (void)
{
builtin_type_void =
init_type (TYPE_CODE_VOID, 1,
&showlist);
opaque_type_resolution = 1;
+
+ /* Build SIMD types. */
+ builtin_type_v4sf
+ = init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4);
+ builtin_type_v4si
+ = init_simd_type ("__builtin_v4si", builtin_type_int32, "f", 4);
+ builtin_type_v8qi
+ = init_simd_type ("__builtin_v8qi", builtin_type_int8, "f", 8);
+ builtin_type_v4hi
+ = init_simd_type ("__builtin_v4hi", builtin_type_int16, "f", 4);
+ builtin_type_v2si
+ = init_simd_type ("__builtin_v2si", builtin_type_int32, "f", 2);
+
+ /* Pointer/Address types. */
+ /* NOTE: At present there is no way of differentiating between at
+ target address and the target C language pointer type type even
+ though the two can be different (cf d10v) */
+ builtin_type_ptr = make_pointer_type (builtin_type_void, NULL);
+ builtin_type_CORE_ADDR =
+ init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
+ TYPE_FLAG_UNSIGNED,
+ "__CORE_ADDR", (struct objfile *) NULL);
+ builtin_type_bfd_vma =
+ init_type (TYPE_CODE_INT, TARGET_BFD_VMA_BIT / 8,
+ TYPE_FLAG_UNSIGNED,
+ "__bfd_vma", (struct objfile *) NULL);
}
-extern void _initialize_gdbtypes PARAMS ((void));
+extern void _initialize_gdbtypes (void);
void
-_initialize_gdbtypes ()
+_initialize_gdbtypes (void)
{
+ struct cmd_list_element *c;
build_gdbtypes ();
/* FIXME - For the moment, handle types by swapping them in and out.
register_gdbarch_swap (&builtin_type_uint32, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_int64, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_uint64, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_v4sf, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_v4si, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_v8qi, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_v4hi, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_v2si, sizeof (struct type *), NULL);
+ REGISTER_GDBARCH_SWAP (builtin_type_ptr);
+ REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR);
+ REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma);
register_gdbarch_swap (NULL, 0, build_gdbtypes);
+
+ add_show_from_set (
+ add_set_cmd ("overload", no_class, var_zinteger, (char *) &overload_debug,
+ "Set debugging of C++ overloading.\n\
+ When enabled, ranking of the functions\n\
+ is displayed.", &setdebuglist),
+ &showdebuglist);
}