* corelow.c, exec.c, inftarg.c, m3-nat.c, op50-rom.c, procfs.c,
[deliverable/binutils-gdb.git] / gdb / buildsym.c
index 256d2cecb39d479e68ebfd8898b44b490b13421f..e4dcbddc568707d6fe3defd55ab3ce7b8f531775 100644 (file)
@@ -39,6 +39,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "buildsym.h"          /* Our own declarations */
 #undef EXTERN
 
+/* For cleanup_undefined_types and finish_global_stabs (somewhat
+   questionable--see comment where we call them).  */
+#include "stabsread.h"
+
 static int
 compare_line_numbers PARAMS ((const void *, const void *));
 
@@ -347,6 +351,15 @@ make_blockvector (objfile)
          if (BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i-1))
              > BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)))
            {
+
+             /* FIXME-32x64: loses if CORE_ADDR doesn't fit in a
+                long.  Possible solutions include a version of
+                complain which takes a callback, a
+                sprintf_address_numeric to match
+                print_address_numeric, or a way to set up a GDB_FILE
+                * which causes sprintf rather than fprintf to be
+                called.  */
+
              complain (&blockvector_complaint, 
                        (unsigned long) BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)));
            }
@@ -392,8 +405,9 @@ start_subfile (name, dirname)
   current_subfile = subfile;
 
   /* Save its name and compilation directory name */
-  subfile->name = (name == NULL)? NULL : strdup (name);
-  subfile->dirname = (dirname == NULL) ? NULL : strdup (dirname);
+  subfile->name = (name == NULL) ? NULL : savestring (name, strlen (name));
+  subfile->dirname =
+    (dirname == NULL) ? NULL : savestring (dirname, strlen (dirname));
   
   /* Initialize line-number recording for this subfile.  */
   subfile->line_vector = NULL;
@@ -466,7 +480,7 @@ patch_subfile_names (subfile, name)
       && subfile->name[strlen(subfile->name)-1] == '/')
     {
       subfile->dirname = subfile->name;
-      subfile->name = strdup (name);
+      subfile->name = savestring (name, strlen (name));
 
       /* Default the source language to whatever can be deduced from
         the filename.  If nothing can be deduced (such as for a C/C++
@@ -667,11 +681,16 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile, section)
       finish_block (cstk->name, &local_symbols, cstk->old_blocks,
                    cstk->start_addr, end_addr, objfile);
 
-      /* Debug: if context stack still has something in it,
-        we are in trouble.  */
       if (context_stack_depth > 0)
        {
-         abort ();
+         /* This is said to happen with SCO.  The old coffread.c code
+            simply emptied the context stack, so we do the same.  FIXME:
+            Find out why it is happening.  This is not believed to happen
+            in most cases (even for coffread.c); it used to be an abort().  */
+         static struct complaint msg =
+           {"Context stack not empty in end_symtab", 0, 0};
+         complain (&msg);
+         context_stack_depth = 0;
        }
     }
 
This page took 0.024529 seconds and 4 git commands to generate.