From: Eberhard Mattes <mattes@azu.informatik.uni-stuttgart.de>
[deliverable/binutils-gdb.git] / gdb / buildsym.c
index fa31e6243d47355d5efa3c32db2e18889cd26de8..e0b30f02c147fadb6d7084e97cc0b40a718a75dd 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, 1995
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1995, 1996
              Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -16,7 +16,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This module provides subroutines used for creating and adding to
    the symbol table.  These routines are called from various symbol-
@@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "objfiles.h"
 #include "gdbtypes.h"
 #include "complaints.h"
-#include <string.h>
+#include "gdb_string.h"
 
 /* Ask buildsym.h to define the vars it normally declares `extern'.  */
 #define        EXTERN  /**/
@@ -260,6 +260,7 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile)
                case LOC_LOCAL_ARG:
                case LOC_BASEREG:
                case LOC_BASEREG_ARG:
+               case LOC_UNRESOLVED:
                case LOC_OPTIMIZED_OUT:
                default:
                  break;
@@ -295,6 +296,7 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile)
                    case LOC_LOCAL_ARG:
                    case LOC_BASEREG:
                    case LOC_BASEREG_ARG:
+                   case LOC_UNRESOLVED:
                    case LOC_OPTIMIZED_OUT:
                    default:
                      break;
@@ -662,8 +664,8 @@ record_line (subfile, line, pc)
 
 static int
 compare_line_numbers (ln1p, ln2p)
-     const PTR ln1p;
-     const PTR ln2p;
+     const void *ln1p;
+     const void *ln2p;
 {
   struct linetable_entry *ln1 = (struct linetable_entry *) ln1p;
   struct linetable_entry *ln2 = (struct linetable_entry *) ln2p;
@@ -735,10 +737,8 @@ start_symtab (name, dirname, start_addr)
    because then gdb will never know about this empty file (FIXME). */
 
 struct symtab *
-end_symtab (end_addr, sort_pending, sort_linevec, objfile, section)
+end_symtab (end_addr, objfile, section)
      CORE_ADDR end_addr;
-     int sort_pending;
-     int sort_linevec;
      struct objfile *objfile;
      int section;
 {
@@ -772,14 +772,12 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile, section)
        }
     }
 
-  /* It is unfortunate that in xcoff, pending blocks might not be ordered
-     in this stage. Especially, blocks for static functions will show up at
-     the end.  We need to sort them, so tools like `find_pc_function' and
-     `find_pc_block' can work reliably. */
-
-  if (sort_pending && pending_blocks)
+  /* Reordered executables may have out of order pending blocks; if
+     OBJF_REORDERED is true, then sort the pending blocks.  */
+  if ((objfile->flags & OBJF_REORDERED) && pending_blocks)
     {
-      /* FIXME!  Remove this horrid bubble sort and use qsort!!! */
+      /* FIXME!  Remove this horrid bubble sort and use qsort!!!
+        It'd be a whole lot easier if they weren't in a linked list!!! */
       int swapped;
       do
        {
@@ -863,12 +861,11 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile, section)
              subfile->line_vector = (struct linetable *)
                xrealloc ((char *) subfile->line_vector, linetablesize);
 #endif
-             /* If sort_linevec is false, we might want just check to make
-                sure they are sorted and complain() if not, as a way of
-                tracking down compilers/symbol readers which don't get
-                them sorted right.  */
 
-             if (sort_linevec)
+             /* Like the pending blocks, the line table may be scrambled
+                in reordered executables.  Sort it if OBJF_REORDERED is
+                true.  */
+             if (objfile->flags & OBJF_REORDERED)
                qsort (subfile->line_vector->item,
                       subfile->line_vector->nitems,
                       sizeof (struct linetable_entry), compare_line_numbers);
This page took 0.027163 seconds and 4 git commands to generate.