* alpha-tdep.c, c-exp.y, h8500-tdep.c, f-exp.y, f-valprint.c,
findvar.c, hppa-tdep.c, infcmd.c, language.c, printcmd.c, rs6000-tdep.c, symmisc.c, symtab.c: Add check_typedef/CHECK_TYPEDEF as needed.
This commit is contained in:
parent
d1f4065e64
commit
940d596798
@ -23,6 +23,11 @@ Wed Nov 29 13:35:18 1995 Per Bothner <bothner@kalessin.cygnus.com>
|
||||
* gdbtypes.c, ch-lang.c, ch-typeprint.c (numerous places):
|
||||
Add check_typedef/CHECK_TYPEDEF as needed.
|
||||
|
||||
* alpha-tdep.c, c-exp.y, h8500-tdep.c, f-exp.y, f-valprint.c,
|
||||
findvar.c, hppa-tdep.c, infcmd.c, language.c, printcmd.c,
|
||||
rs6000-tdep.c, symmisc.c, symtab.c:
|
||||
Add check_typedef/CHECK_TYPEDEF as needed.
|
||||
|
||||
* top.c (command_line_input): Only strip out an initial #-comment.
|
||||
Looking for internal comments is language-specific (breaks Scheme).
|
||||
|
||||
|
@ -729,21 +729,25 @@ alpha_push_arguments (nargs, args, sp, struct_return, struct_addr)
|
||||
for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++)
|
||||
{
|
||||
value_ptr arg = args[i];
|
||||
struct type *arg_type = check_typedef (VALUE_TYPE (arg));
|
||||
/* Cast argument to long if necessary as the compiler does it too. */
|
||||
switch (TYPE_CODE (VALUE_TYPE (arg)))
|
||||
switch (TYPE_CODE (arg_type))
|
||||
{
|
||||
case TYPE_CODE_INT:
|
||||
case TYPE_CODE_BOOL:
|
||||
case TYPE_CODE_CHAR:
|
||||
case TYPE_CODE_RANGE:
|
||||
case TYPE_CODE_ENUM:
|
||||
if (TYPE_LENGTH (VALUE_TYPE (arg)) < TYPE_LENGTH (builtin_type_long))
|
||||
arg = value_cast (builtin_type_long, arg);
|
||||
if (TYPE_LENGTH (arg_type) < TYPE_LENGTH (builtin_type_long))
|
||||
{
|
||||
arg_type = builtin_type_long;
|
||||
arg = value_cast (arg_type, arg);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_arg->len = TYPE_LENGTH (VALUE_TYPE (arg));
|
||||
m_arg->len = TYPE_LENGTH (arg_type);
|
||||
m_arg->offset = accumulate_size;
|
||||
accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
|
||||
m_arg->contents = VALUE_CONTENTS(arg);
|
||||
|
@ -497,6 +497,7 @@ exp : VARIABLE
|
||||
exp : SIZEOF '(' type ')' %prec UNARY
|
||||
{ write_exp_elt_opcode (OP_LONG);
|
||||
write_exp_elt_type (builtin_type_int);
|
||||
CHECK_TYPEDEF ($3);
|
||||
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
|
||||
write_exp_elt_opcode (OP_LONG); }
|
||||
;
|
||||
|
@ -418,6 +418,7 @@ exp : VARIABLE
|
||||
exp : SIZEOF '(' type ')' %prec UNARY
|
||||
{ write_exp_elt_opcode (OP_LONG);
|
||||
write_exp_elt_type (builtin_type_f_integer);
|
||||
CHECK_TYPEDEF ($3);
|
||||
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
|
||||
write_exp_elt_opcode (OP_LONG); }
|
||||
;
|
||||
|
@ -211,7 +211,7 @@ f77_get_dynamic_length_of_aggregate (type)
|
||||
/* Patch in a valid length value. */
|
||||
|
||||
TYPE_LENGTH (type) =
|
||||
(upper_bound - lower_bound + 1) * TYPE_LENGTH (TYPE_TARGET_TYPE (type));
|
||||
(upper_bound - lower_bound + 1) * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type)));
|
||||
}
|
||||
|
||||
/* Function that sets up the array offset,size table for the array
|
||||
@ -376,6 +376,7 @@ f_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
|
||||
LONGEST val;
|
||||
CORE_ADDR addr;
|
||||
|
||||
CHECK_TYPEDEF (type);
|
||||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_STRING:
|
||||
@ -403,7 +404,7 @@ f_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
|
||||
else
|
||||
{
|
||||
addr = unpack_pointer (type, valaddr);
|
||||
elttype = TYPE_TARGET_TYPE (type);
|
||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||
|
||||
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
||||
{
|
||||
|
@ -572,14 +572,14 @@ h8500_set_trapped_internalvar (var, newval, bitpos, bitsize, offset)
|
||||
struct type *type;
|
||||
enum type_code newval_type_code;
|
||||
|
||||
type = VALUE_TYPE (newval);
|
||||
type = check_typedef (VALUE_TYPE (newval));
|
||||
newval_type_code = TYPE_CODE (type);
|
||||
|
||||
if ((newval_type_code != TYPE_CODE_INT
|
||||
&& newval_type_code != TYPE_CODE_PTR)
|
||||
|| TYPE_LENGTH (type) != sizeof (new_regval))
|
||||
error ("Illegal type (%s) for assignment to $%s\n",
|
||||
TYPE_NAME (type), var->name);
|
||||
TYPE_NAME (VALUE_TYPE (newval)), var->name);
|
||||
|
||||
new_regval = *(long *) VALUE_CONTENTS_RAW (newval);
|
||||
|
||||
|
@ -1729,27 +1729,28 @@ target_write_pc (v, pid)
|
||||
alignment required by their fields. */
|
||||
|
||||
static int
|
||||
hppa_alignof (arg)
|
||||
struct type *arg;
|
||||
hppa_alignof (type)
|
||||
struct type *type;
|
||||
{
|
||||
int max_align, align, i;
|
||||
switch (TYPE_CODE (arg))
|
||||
CHECK_TYPEDEf (type);
|
||||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_PTR:
|
||||
case TYPE_CODE_INT:
|
||||
case TYPE_CODE_FLT:
|
||||
return TYPE_LENGTH (arg);
|
||||
return TYPE_LENGTH (type);
|
||||
case TYPE_CODE_ARRAY:
|
||||
return hppa_alignof (TYPE_FIELD_TYPE (arg, 0));
|
||||
return hppa_alignof (TYPE_FIELD_TYPE (type, 0));
|
||||
case TYPE_CODE_STRUCT:
|
||||
case TYPE_CODE_UNION:
|
||||
max_align = 2;
|
||||
for (i = 0; i < TYPE_NFIELDS (arg); i++)
|
||||
for (i = 0; i < TYPE_NFIELDS (type); i++)
|
||||
{
|
||||
/* Bit fields have no real alignment. */
|
||||
if (!TYPE_FIELD_BITPOS (arg, i))
|
||||
if (!TYPE_FIELD_BITPOS (type, i))
|
||||
{
|
||||
align = hppa_alignof (TYPE_FIELD_TYPE (arg, i));
|
||||
align = hppa_alignof (TYPE_FIELD_TYPE (type, i));
|
||||
max_align = max (max_align, align);
|
||||
}
|
||||
}
|
||||
|
@ -436,24 +436,26 @@ struct type *
|
||||
binop_result_type (v1, v2)
|
||||
value_ptr v1, v2;
|
||||
{
|
||||
int l1,l2,size,uns;
|
||||
int size,uns;
|
||||
struct type *t1 = check_typedef (VALUE_TYPE (v1));
|
||||
struct type *t2 = check_typedef (VALUE_TYPE (v2));
|
||||
|
||||
l1 = TYPE_LENGTH(VALUE_TYPE(v1));
|
||||
l2 = TYPE_LENGTH(VALUE_TYPE(v2));
|
||||
int l1 = TYPE_LENGTH (t1);
|
||||
int l2 = TYPE_LENGTH (t2);
|
||||
|
||||
switch(current_language->la_language)
|
||||
{
|
||||
case language_c:
|
||||
case language_cplus:
|
||||
if (TYPE_CODE(VALUE_TYPE(v1))==TYPE_CODE_FLT)
|
||||
return TYPE_CODE(VALUE_TYPE(v2)) == TYPE_CODE_FLT && l2 > l1 ?
|
||||
if (TYPE_CODE (t1)==TYPE_CODE_FLT)
|
||||
return TYPE_CODE(t2) == TYPE_CODE_FLT && l2 > l1 ?
|
||||
VALUE_TYPE(v2) : VALUE_TYPE(v1);
|
||||
else if (TYPE_CODE(VALUE_TYPE(v2))==TYPE_CODE_FLT)
|
||||
return TYPE_CODE(VALUE_TYPE(v1)) == TYPE_CODE_FLT && l1 > l2 ?
|
||||
else if (TYPE_CODE(t2)==TYPE_CODE_FLT)
|
||||
return TYPE_CODE(t1)) == TYPE_CODE_FLT && l1 > l2 ?
|
||||
VALUE_TYPE(v1) : VALUE_TYPE(v2);
|
||||
else if (TYPE_UNSIGNED(VALUE_TYPE(v1)) && l1 > l2)
|
||||
else if (TYPE_UNSIGNED(t1) && l1 > l2)
|
||||
return VALUE_TYPE(v1);
|
||||
else if (TYPE_UNSIGNED(VALUE_TYPE(v2)) && l2 > l1)
|
||||
else if (TYPE_UNSIGNED(t2) && l2 > l1)
|
||||
return VALUE_TYPE(v2);
|
||||
else /* Both are signed. Result is the longer type */
|
||||
return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2);
|
||||
@ -548,6 +550,7 @@ local_decimal_format_custom(pre)
|
||||
return form;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* This page contains functions that are used in type/range checking.
|
||||
They all return zero if the type/range check fails.
|
||||
|
||||
@ -569,6 +572,7 @@ int
|
||||
simple_type(type)
|
||||
struct type *type;
|
||||
{
|
||||
CHECK_TYPEDEF (type);
|
||||
switch (TYPE_CODE (type)) {
|
||||
case TYPE_CODE_INT:
|
||||
case TYPE_CODE_CHAR:
|
||||
@ -591,6 +595,7 @@ int
|
||||
ordered_type (type)
|
||||
struct type *type;
|
||||
{
|
||||
CHECK_TYPEDEF (type);
|
||||
switch (TYPE_CODE (type)) {
|
||||
case TYPE_CODE_INT:
|
||||
case TYPE_CODE_CHAR:
|
||||
@ -609,6 +614,7 @@ int
|
||||
same_type (arg1, arg2)
|
||||
struct type *arg1, *arg2;
|
||||
{
|
||||
CHECK_TYPEDEF (type);
|
||||
if (structured_type(arg1) ? !structured_type(arg2) : structured_type(arg2))
|
||||
/* One is structured and one isn't */
|
||||
return 0;
|
||||
@ -627,6 +633,7 @@ int
|
||||
integral_type (type)
|
||||
struct type *type;
|
||||
{
|
||||
CHECK_TYPEDEF (type);
|
||||
switch(current_language->la_language)
|
||||
{
|
||||
case language_c:
|
||||
@ -647,6 +654,7 @@ int
|
||||
numeric_type (type)
|
||||
struct type *type;
|
||||
{
|
||||
CHECK_TYPEDEF (type);
|
||||
switch (TYPE_CODE (type)) {
|
||||
case TYPE_CODE_INT:
|
||||
case TYPE_CODE_FLT:
|
||||
@ -662,7 +670,8 @@ int
|
||||
character_type (type)
|
||||
struct type *type;
|
||||
{
|
||||
switch(current_language->la_language)
|
||||
CHECK_TYPEDEF (type);
|
||||
switch(current_language->la_language)
|
||||
{
|
||||
case language_chill:
|
||||
case language_m2:
|
||||
@ -683,7 +692,8 @@ int
|
||||
string_type (type)
|
||||
struct type *type;
|
||||
{
|
||||
switch(current_language->la_language)
|
||||
CHECK_TYPEDEF (type);
|
||||
switch(current_language->la_language)
|
||||
{
|
||||
case language_chill:
|
||||
case language_m2:
|
||||
@ -703,6 +713,7 @@ int
|
||||
boolean_type (type)
|
||||
struct type *type;
|
||||
{
|
||||
CHECK_TYPEDEF (type);
|
||||
if (TYPE_CODE (type) == TYPE_CODE_BOOL)
|
||||
return 1;
|
||||
switch(current_language->la_language)
|
||||
@ -724,7 +735,8 @@ int
|
||||
float_type (type)
|
||||
struct type *type;
|
||||
{
|
||||
return TYPE_CODE(type) == TYPE_CODE_FLT;
|
||||
CHECK_TYPEDEF (type);
|
||||
return TYPE_CODE(type) == TYPE_CODE_FLT;
|
||||
}
|
||||
|
||||
/* Returns non-zero if the value is a pointer type */
|
||||
@ -741,6 +753,7 @@ int
|
||||
structured_type(type)
|
||||
struct type *type;
|
||||
{
|
||||
CHECK_TYPEDEF (type);
|
||||
switch(current_language->la_language)
|
||||
{
|
||||
case language_c:
|
||||
@ -758,6 +771,7 @@ structured_type(type)
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This page contains functions that return info about
|
||||
(struct value) values used in GDB. */
|
||||
|
@ -694,8 +694,9 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
|
||||
int argno; /* current argument number */
|
||||
int argbytes; /* current argument byte */
|
||||
char tmp_buffer [50];
|
||||
value_ptr arg;
|
||||
int f_argno = 0; /* current floating point argno */
|
||||
value_ptr arg;
|
||||
struct type *type;
|
||||
|
||||
CORE_ADDR saved_sp, pc;
|
||||
|
||||
@ -715,9 +716,10 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
|
||||
for (argno=0, argbytes=0; argno < nargs && ii<8; ++ii) {
|
||||
|
||||
arg = args[argno];
|
||||
len = TYPE_LENGTH (VALUE_TYPE (arg));
|
||||
type = check_typedef (VALUE_TYPE (arg);
|
||||
len = TYPE_LENGTH (type);
|
||||
|
||||
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT) {
|
||||
if (TYPE_CODE (type) == TYPE_CODE_FLT) {
|
||||
|
||||
/* floating point arguments are passed in fpr's, as well as gpr's.
|
||||
There are 13 fpr's reserved for passing parameters. At this point
|
||||
@ -769,7 +771,6 @@ ran_out_of_registers_for_arguments:
|
||||
|
||||
if ((argno < nargs) || argbytes) {
|
||||
int space = 0, jj;
|
||||
value_ptr val;
|
||||
|
||||
if (argbytes) {
|
||||
space += ((len - argbytes + 3) & -4);
|
||||
@ -779,7 +780,7 @@ ran_out_of_registers_for_arguments:
|
||||
jj = argno;
|
||||
|
||||
for (; jj < nargs; ++jj) {
|
||||
val = args[jj];
|
||||
value_ptr val = args[jj];
|
||||
space += ((TYPE_LENGTH (VALUE_TYPE (val))) + 3) & -4;
|
||||
}
|
||||
|
||||
@ -808,11 +809,12 @@ ran_out_of_registers_for_arguments:
|
||||
for (; argno < nargs; ++argno) {
|
||||
|
||||
arg = args[argno];
|
||||
len = TYPE_LENGTH (VALUE_TYPE (arg));
|
||||
type = check_typedef (VALUE_TYPE (arg));
|
||||
len = TYPE_LENGTH (type);
|
||||
|
||||
|
||||
/* float types should be passed in fpr's, as well as in the stack. */
|
||||
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT && f_argno < 13) {
|
||||
if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13) {
|
||||
|
||||
if (len > 8)
|
||||
printf_unfiltered (
|
||||
|
10
gdb/symtab.c
10
gdb/symtab.c
@ -1636,7 +1636,7 @@ total_number_of_methods (type)
|
||||
int n;
|
||||
int count;
|
||||
|
||||
check_stub_type (type);
|
||||
CHECK_TYPEDEF (type);
|
||||
count = TYPE_NFN_FIELDS_TOTAL (type);
|
||||
|
||||
for (n = 0; n < TYPE_N_BASECLASSES (type); n++)
|
||||
@ -1673,7 +1673,7 @@ find_methods (t, name, sym_arr)
|
||||
(struct symtab **)NULL)))
|
||||
{
|
||||
int method_counter;
|
||||
/* FIXME: Shouldn't this just be check_stub_type (t)? */
|
||||
/* FIXME: Shouldn't this just be CHECK_TYPEDEF (t)? */
|
||||
t = SYMBOL_TYPE (sym_class);
|
||||
for (method_counter = TYPE_NFN_FIELDS (t) - 1;
|
||||
method_counter >= 0;
|
||||
@ -1960,8 +1960,9 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
|
||||
(struct symtab **)NULL);
|
||||
|
||||
if (sym_class &&
|
||||
( TYPE_CODE (SYMBOL_TYPE (sym_class)) == TYPE_CODE_STRUCT
|
||||
|| TYPE_CODE (SYMBOL_TYPE (sym_class)) == TYPE_CODE_UNION))
|
||||
(t = check_typedef (SYMBOL_TYPE (sym_class)),
|
||||
(TYPE_CODE (t) == TYPE_CODE_STRUCT
|
||||
|| TYPE_CODE (t) == TYPE_CODE_UNION)))
|
||||
{
|
||||
/* Arg token is not digits => try it as a function name
|
||||
Find the next token(everything up to end or next blank). */
|
||||
@ -2015,7 +2016,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
|
||||
|
||||
sym = 0;
|
||||
i1 = 0; /* counter for the symbol array */
|
||||
t = SYMBOL_TYPE (sym_class);
|
||||
sym_arr = (struct symbol **) alloca(total_number_of_methods (t)
|
||||
* sizeof(struct symbol *));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user