* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / buildsym.c
index fc03378844735fa163ccf4b1b46c654155f30da8..d62d2ee21622b7e61e272ebce3ba44f1ff050182 100644 (file)
@@ -1,5 +1,5 @@
 /* Support routines for building symbol tables in GDB's internal format.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1995
              Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -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
     {
@@ -484,6 +526,7 @@ patch_subfile_names (subfile, name)
     {
       subfile->dirname = subfile->name;
       subfile->name = savestring (name, strlen (name));
+      last_source_file = name;
 
       /* Default the source language to whatever can be deduced from
         the filename.  If nothing can be deduced (such as for a C/C++
This page took 0.023698 seconds and 4 git commands to generate.