diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1995-03-18 13:16:51 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1995-03-18 13:16:51 +0000 |
commit | 5c26250b95bae82df80cab9985c6857203c9b93b (patch) | |
tree | a66d3a9ccc1abee7df2e642d557aa876537d87e4 /gdb/mdebugread.c | |
parent | 4da1dceac57929f8efdd30accc7db805c869f469 (diff) | |
download | gdb-5c26250b95bae82df80cab9985c6857203c9b93b.zip gdb-5c26250b95bae82df80cab9985c6857203c9b93b.tar.gz gdb-5c26250b95bae82df80cab9985c6857203c9b93b.tar.bz2 |
* mdebugread.c (parse_symbol): If finishing a function without
known parameter type info, set that from parameter symbols.
Remove commented-out add_param_to_type support.
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r-- | gdb/mdebugread.c | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 946ba43..4313b48 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1,5 +1,5 @@ /* Read a symbol table in ECOFF format (Third-Eye). - Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994 + Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Original version contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor @@ -825,15 +825,7 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets) add_symbol (s, b); /* Make a type for the procedure itself */ -#if 0 - /* FIXME: This has not been tested yet! See dbxread.c */ - /* Generate a template for the type of this function. The - types of the arguments will be added as we read the symbol - table. */ - memcpy (lookup_function_type (t), SYMBOL_TYPE (s), sizeof (struct type)); -#else SYMBOL_TYPE (s) = lookup_function_type (t); -#endif /* Create and enter a new lexical context */ b = new_block (top_stack->maxsyms); @@ -1145,6 +1137,7 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets) struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st); struct mips_extra_func_info *e; struct block *b; + struct type *ftype = top_stack->cur_type; int i; BLOCK_END (top_stack->cur_block) += sh->value; /* size */ @@ -1178,6 +1171,39 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets) BLOCK_END (b_bad) = BLOCK_END (b); } } + + 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 = top_stack->numargs; + int iparams; + struct symbol *sym; + + 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 (b, 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++; + break; + default: + break; + } + } + } + } } else if (sh->sc == scText && top_stack->blocktype == stBlock) { |