#endif /* no BELIEVE_PCC_PROMOTION_TYPE. */
+ case 'R':
case 'P':
/* acc seems to use P to delare the prototypes of functions that
are referenced by this file. gdb is not prepared to deal
add_symbol_to_list (sym, &local_symbols);
break;
- case 'R':
case 'r':
/* Register variable (either global or local). */
SYMBOL_CLASS (sym) = LOC_REGISTER;
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
if (within_function)
- add_symbol_to_list (sym, &local_symbols);
+ {
+ /* Sun cc uses a pair of symbols, one 'p' and one 'r' with the same
+ name to represent an argument passed in a register.
+ GCC uses 'P' for the same case. So if we find such a symbol pair
+ we combine it into one 'P' symbol.
+ Note that this code illegally combines
+ main(argc) int argc; { register int argc = 1; }
+ but this case is considered pathological and causes a warning
+ from a decent compiler. */
+ if (local_symbols
+ && local_symbols->nsyms > 0)
+ {
+ struct symbol *prev_sym;
+ prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
+ if (SYMBOL_CLASS (prev_sym) == LOC_ARG
+ && STREQ (SYMBOL_NAME (prev_sym), SYMBOL_NAME(sym)))
+ {
+ SYMBOL_CLASS (prev_sym) = LOC_REGPARM;
+ SYMBOL_VALUE (prev_sym) = SYMBOL_VALUE (sym);
+ sym = prev_sym;
+ break;
+ }
+ }
+ add_symbol_to_list (sym, &local_symbols);
+ }
else
add_symbol_to_list (sym, &file_symbols);
break;
default:
error ("Invalid symbol data: unknown symbol-type code `%c' at symtab pos %d.", deftype, symnum);
}
+
+ /* When passing structures to a function, some systems sometimes pass
+ the address in a register, not the structure itself.
+
+ If REG_STRUCT_HAS_ADDR yields non-zero we have to convert LOC_REGPARM
+ to LOC_REGPARM_ADDR for structures and unions. */
+
+#if !defined (REG_STRUCT_HAS_ADDR)
+#define REG_STRUCT_HAS_ADDR(gcc_p) 0
+#endif
+
+ if (SYMBOL_CLASS (sym) == LOC_REGPARM
+ && REG_STRUCT_HAS_ADDR (processing_gcc_compilation)
+ && ( (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT)
+ || (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)))
+ SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
+
return sym;
}
if (TYPE_FLAGS (new_sublist -> fn_field.type) & TYPE_FLAG_STUB)
{
+ if (!TYPE_DOMAIN_TYPE (new_sublist -> fn_field.type))
+ TYPE_DOMAIN_TYPE (new_sublist -> fn_field.type) = type;
new_sublist -> fn_field.is_stub = 1;
}
new_sublist -> fn_field.physname = savestring (*pp, p - *pp);
member functions, attach them to the type, and then read any tilde
field (baseclass specifier for the class holding the main vtable). */
- if (!read_baseclasses (&fi, pp, type, objfile))
- {
- do_cleanups (back_to);
- return (error_type (pp));
- }
- if (!read_struct_fields (&fi, pp, type, objfile))
- {
- do_cleanups (back_to);
- return (error_type (pp));
- }
- if (!attach_fields_to_type (&fi, type, objfile))
- {
- do_cleanups (back_to);
- return (error_type (pp));
- }
- if (!read_member_functions (&fi, pp, type, objfile))
- {
- do_cleanups (back_to);
- return (error_type (pp));
- }
- if (!attach_fn_fields_to_type (&fi, type))
- {
- do_cleanups (back_to);
- return (error_type (pp));
- }
- if (!read_tilde_fields (&fi, pp, type, objfile))
+ if (!read_baseclasses (&fi, pp, type, objfile)
+ || !read_struct_fields (&fi, pp, type, objfile)
+ || !attach_fields_to_type (&fi, type, objfile)
+ || !read_member_functions (&fi, pp, type, objfile)
+ || !attach_fn_fields_to_type (&fi, type)
+ || !read_tilde_fields (&fi, pp, type, objfile))
{
do_cleanups (back_to);
return (error_type (pp));