From 5c26250b95bae82df80cab9985c6857203c9b93b Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 18 Mar 1995 13:16:51 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 12 ++++++++++++ gdb/mdebugread.c | 44 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 616b2e4455d..22e0a82e6fb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +Sat Mar 18 02:02:24 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * 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. + +Thu Mar 16 16:38:03 1995 Jim Kingdon (kingdon@lioth.cygnus.com) + + * xcoffread.c (process_linenos): Make sure filename we pass to + start_subfile will cause deduce_language_from_filename to return + the correct thing. Reindent function to GNU standards. + Thu Mar 16 15:54:00 1995 J.T. Conklin * nlm/gdbserve.c (handle_exception): #if out call to StopBell, diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 946ba431bba..4313b480346 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) { -- 2.30.2