2000-02-26 Mark Kettenis <kettenis@gnu.org>
[deliverable/binutils-gdb.git] / binutils / rddbg.c
index b2602af4c6e98dd30e8a08367d77da47deb3d24c..9428c37ad5ce713bf1c644e1cf317d6721892fc0 100644 (file)
@@ -1,5 +1,5 @@
 /* rddbg.c -- Read debugging information into a generic form.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 96, 1997, 1998 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -84,7 +84,7 @@ read_debugging_info (abfd, syms, symcount)
 
   if (! found)
     {
-      fprintf (stderr, "%s: no recognized debugging information\n",
+      fprintf (stderr, _("%s: no recognized debugging information\n"),
               bfd_get_filename (abfd));
       return NULL;
     }
@@ -189,13 +189,22 @@ read_section_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
                  while (s[strlen (s) - 1] == '\\'
                         && stab + 12 < stabs + stabsize)
                    {
+                     char *p;
+
                      stab += 12;
-                     s[strlen (s) - 1] = '\0';
+                     p = s + strlen (s) - 1;
+                     *p = '\0';
                      s = concat (s,
                                  ((char *) strings
                                   + stroff
                                   + bfd_get_32 (abfd, stab)),
                                  (const char *) NULL);
+
+                     /* We have to restore the backslash, because, if
+                         the linker is hashing stabs strings, we may
+                         see the same string more than once.  */
+                     *p = '\\';
+
                      if (f != NULL)
                        free (f);
                      f = s;
@@ -270,6 +279,7 @@ read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
          *pfound = true;
 
          s = i.name;
+         f = NULL;
          while (s[strlen (s) - 1] == '\\'
                 && ps + 1 < symend)
            {
@@ -296,14 +306,14 @@ read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
              return false;
            }
 
-         free_saved_stabs ();
-
          /* Don't free f, since I think the stabs code expects
             strings to hang around.  This should be straightened out.
             FIXME.  */
        }
     }
 
+  free_saved_stabs ();
+
   if (shandle != NULL)
     {
       if (! finish_stab (dhandle, shandle))
@@ -387,7 +397,7 @@ stab_context ()
 {
   int i;
 
-  fprintf (stderr, "Last stabs entries before error:\n");
+  fprintf (stderr, _("Last stabs entries before error:\n"));
   fprintf (stderr, "n_type n_desc n_value  string\n");
 
   i = saved_stabs_index;
@@ -426,7 +436,13 @@ free_saved_stabs ()
   int i;
 
   for (i = 0; i < SAVE_STABS_COUNT; i++)
-    if (saved_stabs[i].string != NULL)
-      free (saved_stabs[i].string);
+    {
+      if (saved_stabs[i].string != NULL)
+       {
+         free (saved_stabs[i].string);
+         saved_stabs[i].string = NULL;
+       }
+    }
+
   saved_stabs_index = 0;
 }
This page took 0.024832 seconds and 4 git commands to generate.