From 27202b6a4746af217ab914394a1ab9b111b1db3c Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Sun, 12 Feb 1995 18:46:45 +0000 Subject: * buildsym.c (finish_block): If finishing a function without known parameter type info, set that from parameter symbols. * c-typeprint.c (c_type_print_varspec_suffix): For TYPE_CODE_FUNC, print parameter types, if available. * ch-typeprint.c (chill_type_print_base): Likewise. * gdbtypes.h (struct type): Remove function type field. (TYPE_FUNCTION_TYPE): Remove macro. We can't as simply re-use function types now that we're also storing parameter types. And the payoff is much less. * gdbtypes.c (make_function_type): Don't use/set TYPE_FUNCTION_TYPE. (recursive_dump_type): Don't print TYPE_FUNCTION_TYPE. * dwarfread.c (read_subroutine_type): Don't set TYPE_FUNCTION_TYPE. --- gdb/buildsym.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'gdb/buildsym.c') diff --git a/gdb/buildsym.c b/gdb/buildsym.c index fc03378..45ee77a 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -31,6 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "symtab.h" #include "symfile.h" /* Needed for "struct complaint" */ #include "objfiles.h" +#include "gdbtypes.h" #include "complaints.h" #include @@ -226,8 +227,49 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile) if (symbol) { + struct type *ftype = SYMBOL_TYPE (symbol); SYMBOL_BLOCK_VALUE (symbol) = block; BLOCK_FUNCTION (block) = symbol; + + if (TYPE_NFIELDS (ftype) <= 0) + { + /* No parameter type information is recorded with the function's + type. Set that from the type of the parameter symbols. */ + int nparams = 0, iparams; + struct symbol *sym; + for (i = 0; i < BLOCK_NSYMS (block); i++) + { + sym = BLOCK_SYM (block, i); + switch (SYMBOL_CLASS (sym)) + { + case LOC_ARG: + case LOC_REF_ARG: + case LOC_REGPARM: + case LOC_REGPARM_ADDR: + nparams++; + } + } + if (nparams > 0) + { + TYPE_NFIELDS (ftype) = nparams; + TYPE_FIELDS (ftype) = (struct field *) + TYPE_ALLOC (ftype, nparams * sizeof (struct field)); + + for (i = iparams = 0; iparams < nparams; i++) + { + sym = BLOCK_SYM (block, i); + switch (SYMBOL_CLASS (sym)) + { + case LOC_ARG: + case LOC_REF_ARG: + case LOC_REGPARM: + case LOC_REGPARM_ADDR: + TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym); + iparams++; + } + } + } + } } else { -- cgit v1.1