aboutsummaryrefslogtreecommitdiff
path: root/gdb/buildsym.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-02-12 18:46:45 +0000
committerPer Bothner <per@bothner.com>1995-02-12 18:46:45 +0000
commit27202b6a4746af217ab914394a1ab9b111b1db3c (patch)
treef9ae67c6ffa2999f383a5da1abd94761b408d210 /gdb/buildsym.c
parentc44c67b5ae95c3e4201e0cbed7ebf429bc2d664a (diff)
downloadgdb-27202b6a4746af217ab914394a1ab9b111b1db3c.zip
gdb-27202b6a4746af217ab914394a1ab9b111b1db3c.tar.gz
gdb-27202b6a4746af217ab914394a1ab9b111b1db3c.tar.bz2
* 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.
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r--gdb/buildsym.c42
1 files changed, 42 insertions, 0 deletions
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 <string.h>
@@ -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
{