gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / binutils / wrstabs.c
index 985b7009632000809f06ddabb07e3b5c866cb4e0..0deed3151a3c9032440d8f27b374380ce36da8d9 100644 (file)
@@ -1,12 +1,12 @@
 /* wrstabs.c -- Output stabs debugging information
 /* wrstabs.c -- Output stabs debugging information
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
 
    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., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 /* This file contains code which writes out stabs debugging
    information.  */
 
 
 /* This file contains code which writes out stabs debugging
    information.  */
 
-#include <stdio.h>
-#include <ctype.h>
+#include "sysdep.h"
 #include <assert.h>
 #include <assert.h>
-
 #include "bfd.h"
 #include "bfd.h"
-#include "bucomm.h"
 #include "libiberty.h"
 #include "libiberty.h"
+#include "filenames.h"
+#include "safe-ctype.h"
+#include "bucomm.h"
 #include "debug.h"
 #include "budbg.h"
 #include "debug.h"
 #include "budbg.h"
-
-/* Meaningless definition needs by aout64.h.  FIXME.  */
-#define BYTES_IN_WORD 4
-
 #include "aout/aout64.h"
 #include "aout/stab_gnu.h"
 
 #include "aout/aout64.h"
 #include "aout/stab_gnu.h"
 
@@ -47,6 +43,8 @@
 struct string_hash_entry
 {
   struct bfd_hash_entry root;
 struct string_hash_entry
 {
   struct bfd_hash_entry root;
+  /* Next string in this table.  */
+  struct string_hash_entry *next;
   /* Index in string table.  */
   long index;
   /* Size of type if this is a typedef.  */
   /* Index in string table.  */
   long index;
   /* Size of type if this is a typedef.  */
@@ -73,7 +71,7 @@ struct stab_type_stack
   /* The size of the type.  */
   unsigned int size;
   /* Whether type string defines a new type.  */
   /* The size of the type.  */
   unsigned int size;
   /* Whether type string defines a new type.  */
-  boolean definition;
+  bfd_boolean definition;
   /* String defining struct fields.  */
   char *fields;
   /* NULL terminated array of strings defining base classes for a
   /* String defining struct fields.  */
   char *fields;
   /* NULL terminated array of strings defining base classes for a
@@ -139,10 +137,12 @@ struct stab_write_handle
   bfd_byte *symbols;
   size_t symbols_size;
   size_t symbols_alloc;
   bfd_byte *symbols;
   size_t symbols_size;
   size_t symbols_alloc;
-  /* This buffer holds the strings.  */
-  bfd_byte *strings;
+  /* This is a list of hash table entries for the strings.  */
+  struct string_hash_entry *strings;
+  /* The last string hash table entry.  */
+  struct string_hash_entry *last_string;
+  /* The size of the strings.  */
   size_t strings_size;
   size_t strings_size;
-  size_t strings_alloc;
   /* This hash table eliminates duplicate strings.  */
   struct string_hash_table strhash;
   /* The type stack.  */
   /* This hash table eliminates duplicate strings.  */
   struct string_hash_table strhash;
   /* The type stack.  */
@@ -172,83 +172,80 @@ struct stab_write_handle
 };
 
 static struct bfd_hash_entry *string_hash_newfunc
 };
 
 static struct bfd_hash_entry *string_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static boolean stab_write_symbol
-  PARAMS ((struct stab_write_handle *, int, int, bfd_vma, const char *));
-static boolean stab_push_string
-  PARAMS ((struct stab_write_handle *, const char *, long, boolean,
-          unsigned int));
-static boolean stab_push_defined_type
-  PARAMS ((struct stab_write_handle *, long, unsigned int));
-static char *stab_pop_type PARAMS ((struct stab_write_handle *));
-static boolean stab_modify_type
-  PARAMS ((struct stab_write_handle *, int, unsigned int, long **, size_t *));
+  (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
+static bfd_boolean stab_write_symbol
+  (struct stab_write_handle *, int, int, bfd_vma, const char *);
+static bfd_boolean stab_push_string
+  (struct stab_write_handle *, const char *, long, bfd_boolean, unsigned int);
+static bfd_boolean stab_push_defined_type
+  (struct stab_write_handle *, long, unsigned int);
+static char *stab_pop_type (struct stab_write_handle *);
+static bfd_boolean stab_modify_type
+  (struct stab_write_handle *, int, unsigned int, long **, size_t *);
 static long stab_get_struct_index
 static long stab_get_struct_index
-  PARAMS ((struct stab_write_handle *, const char *, unsigned int,
-          enum debug_type_kind, unsigned int *));
-static boolean stab_class_method_var
-  PARAMS ((struct stab_write_handle *, const char *, enum debug_visibility,
-          boolean, boolean, boolean, bfd_vma, boolean));
-
-static boolean stab_start_compilation_unit PARAMS ((PTR, const char *));
-static boolean stab_start_source PARAMS ((PTR, const char *));
-static boolean stab_empty_type PARAMS ((PTR));
-static boolean stab_void_type PARAMS ((PTR));
-static boolean stab_int_type PARAMS ((PTR, unsigned int, boolean));
-static boolean stab_float_type PARAMS ((PTR, unsigned int));
-static boolean stab_complex_type PARAMS ((PTR, unsigned int));
-static boolean stab_bool_type PARAMS ((PTR, unsigned int));
-static boolean stab_enum_type
-  PARAMS ((PTR, const char *, const char **, bfd_signed_vma *));
-static boolean stab_pointer_type PARAMS ((PTR));
-static boolean stab_function_type PARAMS ((PTR, int, boolean));
-static boolean stab_reference_type PARAMS ((PTR));
-static boolean stab_range_type PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma));
-static boolean stab_array_type
-  PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma, boolean));
-static boolean stab_set_type PARAMS ((PTR, boolean));
-static boolean stab_offset_type PARAMS ((PTR));
-static boolean stab_method_type PARAMS ((PTR, boolean, int, boolean));
-static boolean stab_const_type PARAMS ((PTR));
-static boolean stab_volatile_type PARAMS ((PTR));
-static boolean stab_start_struct_type
-  PARAMS ((PTR, const char *, unsigned int, boolean, unsigned int));
-static boolean stab_struct_field
-  PARAMS ((PTR, const char *, bfd_vma, bfd_vma, enum debug_visibility));
-static boolean stab_end_struct_type PARAMS ((PTR));
-static boolean stab_start_class_type
-  PARAMS ((PTR, const char *, unsigned int, boolean, unsigned int, boolean,
-          boolean));
-static boolean stab_class_static_member
-  PARAMS ((PTR, const char *, const char *, enum debug_visibility));
-static boolean stab_class_baseclass
-  PARAMS ((PTR, bfd_vma, boolean, enum debug_visibility));
-static boolean stab_class_start_method PARAMS ((PTR, const char *));
-static boolean stab_class_method_variant
-  PARAMS ((PTR, const char *, enum debug_visibility, boolean, boolean,
-          bfd_vma, boolean));
-static boolean stab_class_static_method_variant
-  PARAMS ((PTR, const char *, enum debug_visibility, boolean, boolean));
-static boolean stab_class_end_method PARAMS ((PTR));
-static boolean stab_end_class_type PARAMS ((PTR));
-static boolean stab_typedef_type PARAMS ((PTR, const char *));
-static boolean stab_tag_type
-  PARAMS ((PTR, const char *, unsigned int, enum debug_type_kind));
-static boolean stab_typdef PARAMS ((PTR, const char *));
-static boolean stab_tag PARAMS ((PTR, const char *));
-static boolean stab_int_constant PARAMS ((PTR, const char *, bfd_vma));
-static boolean stab_float_constant PARAMS ((PTR, const char *, double));
-static boolean stab_typed_constant PARAMS ((PTR, const char *, bfd_vma));
-static boolean stab_variable
-  PARAMS ((PTR, const char *, enum debug_var_kind, bfd_vma));
-static boolean stab_start_function PARAMS ((PTR, const char *, boolean));
-static boolean stab_function_parameter
-  PARAMS ((PTR, const char *, enum debug_parm_kind, bfd_vma));
-static boolean stab_start_block PARAMS ((PTR, bfd_vma));
-static boolean stab_end_block PARAMS ((PTR, bfd_vma));
-static boolean stab_end_function PARAMS ((PTR));
-static boolean stab_lineno
-  PARAMS ((PTR, const char *, unsigned long, bfd_vma));
+  (struct stab_write_handle *, const char *, unsigned int,
+   enum debug_type_kind, unsigned int *);
+static bfd_boolean stab_class_method_var
+  (struct stab_write_handle *, const char *, enum debug_visibility,
+   bfd_boolean, bfd_boolean, bfd_boolean, bfd_vma, bfd_boolean);
+static bfd_boolean stab_start_compilation_unit (void *, const char *);
+static bfd_boolean stab_start_source (void *, const char *);
+static bfd_boolean stab_empty_type (void *);
+static bfd_boolean stab_void_type (void *);
+static bfd_boolean stab_int_type (void *, unsigned int, bfd_boolean);
+static bfd_boolean stab_float_type (void *, unsigned int);
+static bfd_boolean stab_complex_type (void *, unsigned int);
+static bfd_boolean stab_bool_type (void *, unsigned int);
+static bfd_boolean stab_enum_type
+  (void *, const char *, const char **, bfd_signed_vma *);
+static bfd_boolean stab_pointer_type (void *);
+static bfd_boolean stab_function_type (void *, int, bfd_boolean);
+static bfd_boolean stab_reference_type (void *);
+static bfd_boolean stab_range_type (void *, bfd_signed_vma, bfd_signed_vma);
+static bfd_boolean stab_array_type
+  (void *, bfd_signed_vma, bfd_signed_vma, bfd_boolean);
+static bfd_boolean stab_set_type (void *, bfd_boolean);
+static bfd_boolean stab_offset_type (void *);
+static bfd_boolean stab_method_type (void *, bfd_boolean, int, bfd_boolean);
+static bfd_boolean stab_const_type (void *);
+static bfd_boolean stab_volatile_type (void *);
+static bfd_boolean stab_start_struct_type
+  (void *, const char *, unsigned int, bfd_boolean, unsigned int);
+static bfd_boolean stab_struct_field
+  (void *, const char *, bfd_vma, bfd_vma, enum debug_visibility);
+static bfd_boolean stab_end_struct_type (void *);
+static bfd_boolean stab_start_class_type
+  (void *, const char *, unsigned int, bfd_boolean, unsigned int,
+   bfd_boolean, bfd_boolean);
+static bfd_boolean stab_class_static_member
+  (void *, const char *, const char *, enum debug_visibility);
+static bfd_boolean stab_class_baseclass
+  (void *, bfd_vma, bfd_boolean, enum debug_visibility);
+static bfd_boolean stab_class_start_method (void *, const char *);
+static bfd_boolean stab_class_method_variant
+  (void *, const char *, enum debug_visibility, bfd_boolean, bfd_boolean,
+   bfd_vma, bfd_boolean);
+static bfd_boolean stab_class_static_method_variant
+  (void *, const char *, enum debug_visibility, bfd_boolean, bfd_boolean);
+static bfd_boolean stab_class_end_method (void *);
+static bfd_boolean stab_end_class_type (void *);
+static bfd_boolean stab_typedef_type (void *, const char *);
+static bfd_boolean stab_tag_type
+  (void *, const char *, unsigned int, enum debug_type_kind);
+static bfd_boolean stab_typdef (void *, const char *);
+static bfd_boolean stab_tag (void *, const char *);
+static bfd_boolean stab_int_constant (void *, const char *, bfd_vma);
+static bfd_boolean stab_float_constant (void *, const char *, double);
+static bfd_boolean stab_typed_constant (void *, const char *, bfd_vma);
+static bfd_boolean stab_variable
+  (void *, const char *, enum debug_var_kind, bfd_vma);
+static bfd_boolean stab_start_function (void *, const char *, bfd_boolean);
+static bfd_boolean stab_function_parameter
+  (void *, const char *, enum debug_parm_kind, bfd_vma);
+static bfd_boolean stab_start_block (void *, bfd_vma);
+static bfd_boolean stab_end_block (void *, bfd_vma);
+static bfd_boolean stab_end_function (void *);
+static bfd_boolean stab_lineno (void *, const char *, unsigned long, bfd_vma);
 
 static const struct debug_write_fns stab_fns =
 {
 
 static const struct debug_write_fns stab_fns =
 {
@@ -301,10 +298,8 @@ static const struct debug_write_fns stab_fns =
 /* Routine to create an entry in a string hash table.  */
 
 static struct bfd_hash_entry *
 /* Routine to create an entry in a string hash table.  */
 
 static struct bfd_hash_entry *
-string_hash_newfunc (entry, table, string)
-     struct bfd_hash_entry *entry;
-     struct bfd_hash_table *table;
-     const char *string;
+string_hash_newfunc (struct bfd_hash_entry *entry,
+                    struct bfd_hash_table *table, const char *string)
 {
   struct string_hash_entry *ret = (struct string_hash_entry *) entry;
 
 {
   struct string_hash_entry *ret = (struct string_hash_entry *) entry;
 
@@ -323,6 +318,7 @@ string_hash_newfunc (entry, table, string)
   if (ret)
     {
       /* Initialize the local fields.  */
   if (ret)
     {
       /* Initialize the local fields.  */
+      ret->next = NULL;
       ret->index = -1;
       ret->size = 0;
     }
       ret->index = -1;
       ret->size = 0;
     }
@@ -338,13 +334,9 @@ string_hash_newfunc (entry, table, string)
 
 /* Add a symbol to the stabs debugging information we are building.  */
 
 
 /* Add a symbol to the stabs debugging information we are building.  */
 
-static boolean
-stab_write_symbol (info, type, desc, value, string)
-     struct stab_write_handle *info;
-     int type;
-     int desc;
-     bfd_vma value;
-     const char *string;
+static bfd_boolean
+stab_write_symbol (struct stab_write_handle *info, int type, int desc,
+                  bfd_vma value, const char *string)
 {
   bfd_size_type strx;
   bfd_byte sym[STAB_SYMBOL_SIZE];
 {
   bfd_size_type strx;
   bfd_byte sym[STAB_SYMBOL_SIZE];
@@ -355,31 +347,25 @@ stab_write_symbol (info, type, desc, value, string)
     {
       struct string_hash_entry *h;
 
     {
       struct string_hash_entry *h;
 
-      h = string_hash_lookup (&info->strhash, string, true, false);
+      h = string_hash_lookup (&info->strhash, string, TRUE, TRUE);
       if (h == NULL)
        {
       if (h == NULL)
        {
-         fprintf (stderr, "string_hash_lookup failed: %s\n",
-                  bfd_errmsg (bfd_get_error ()));
-         return false;
+         non_fatal (_("string_hash_lookup failed: %s"),
+                    bfd_errmsg (bfd_get_error ()));
+         return FALSE;
        }
       if (h->index != -1)
        strx = h->index;
       else
        {
        }
       if (h->index != -1)
        strx = h->index;
       else
        {
-         size_t len;
-
          strx = info->strings_size;
          h->index = strx;
          strx = info->strings_size;
          h->index = strx;
-
-         len = strlen (string);
-         while (info->strings_size + len + 1 > info->strings_alloc)
-           {
-             info->strings_alloc *= 2;
-             info->strings = (bfd_byte *) xrealloc (info->strings,
-                                                    info->strings_alloc);
-           }
-         strcpy (info->strings + info->strings_size, string);
-         info->strings_size += len + 1;
+         if (info->last_string == NULL)
+           info->strings = h;
+         else
+           info->last_string->next = h;
+         info->last_string = h;
+         info->strings_size += strlen (string) + 1;
        }
     }
 
        }
     }
 
@@ -401,24 +387,20 @@ stab_write_symbol (info, type, desc, value, string)
 
   info->symbols_size += STAB_SYMBOL_SIZE;
 
 
   info->symbols_size += STAB_SYMBOL_SIZE;
 
-  return true;
+  return TRUE;
 }
 
 /* Push a string on to the type stack.  */
 
 }
 
 /* Push a string on to the type stack.  */
 
-static boolean
-stab_push_string (info, string, index, definition, size)
-     struct stab_write_handle *info;
-     const char *string;
-     long index;
-     boolean definition;
-     unsigned int size;
+static bfd_boolean
+stab_push_string (struct stab_write_handle *info, const char *string,
+                 long tindex, bfd_boolean definition, unsigned int size)
 {
   struct stab_type_stack *s;
 
   s = (struct stab_type_stack *) xmalloc (sizeof *s);
   s->string = xstrdup (string);
 {
   struct stab_type_stack *s;
 
   s = (struct stab_type_stack *) xmalloc (sizeof *s);
   s->string = xstrdup (string);
-  s->index = index;
+  s->index = tindex;
   s->definition = definition;
   s->size = size;
 
   s->definition = definition;
   s->size = size;
 
@@ -430,35 +412,33 @@ stab_push_string (info, string, index, definition, size)
   s->next = info->type_stack;
   info->type_stack = s;
 
   s->next = info->type_stack;
   info->type_stack = s;
 
-  return true;
+  return TRUE;
 }
 
 /* Push a type index which has already been defined.  */
 
 }
 
 /* Push a type index which has already been defined.  */
 
-static boolean
-stab_push_defined_type (info, index, size)
-     struct stab_write_handle *info;
-     long index;
-     unsigned int size;
+static bfd_boolean
+stab_push_defined_type (struct stab_write_handle *info, long tindex,
+                       unsigned int size)
 {
   char buf[20];
 
 {
   char buf[20];
 
-  sprintf (buf, "%ld", index);
-  return stab_push_string (info, buf, index, false, size);
+  sprintf (buf, "%ld", tindex);
+  return stab_push_string (info, buf, tindex, FALSE, size);
 }
 
 /* Pop a type off the type stack.  The caller is responsible for
    freeing the string.  */
 
 static char *
 }
 
 /* Pop a type off the type stack.  The caller is responsible for
    freeing the string.  */
 
 static char *
-stab_pop_type (info)
-     struct stab_write_handle *info;
+stab_pop_type (struct stab_write_handle *info)
 {
   struct stab_type_stack *s;
   char *ret;
 
   s = info->type_stack;
 {
   struct stab_type_stack *s;
   char *ret;
 
   s = info->type_stack;
-  assert (s != NULL);
+  if (s == NULL)
+    return NULL;
 
   info->type_stack = s->next;
 
 
   info->type_stack = s->next;
 
@@ -478,17 +458,16 @@ stab_pop_type (info)
    the symbols, *PSYMSIZE the size of the symbols, *PSTRINGS to the
    strings, and *PSTRINGSIZE to the size of the strings.  */
 
    the symbols, *PSYMSIZE the size of the symbols, *PSTRINGS to the
    strings, and *PSTRINGSIZE to the size of the strings.  */
 
-boolean
-write_stabs_in_sections_debugging_info (abfd, dhandle, psyms, psymsize,
-                                       pstrings, pstringsize)
-     bfd *abfd;
-     PTR dhandle;
-     bfd_byte **psyms;
-     bfd_size_type *psymsize;
-     bfd_byte **pstrings;
-     bfd_size_type *pstringsize;
+bfd_boolean
+write_stabs_in_sections_debugging_info (bfd *abfd, void *dhandle,
+                                       bfd_byte **psyms,
+                                       bfd_size_type *psymsize,
+                                       bfd_byte **pstrings,
+                                       bfd_size_type *pstringsize)
 {
   struct stab_write_handle info;
 {
   struct stab_write_handle info;
+  struct string_hash_entry *h;
+  bfd_byte *p;
 
   info.abfd = abfd;
 
 
   info.abfd = abfd;
 
@@ -496,17 +475,19 @@ write_stabs_in_sections_debugging_info (abfd, dhandle, psyms, psymsize,
   info.symbols_alloc = 500;
   info.symbols = (bfd_byte *) xmalloc (info.symbols_alloc);
 
   info.symbols_alloc = 500;
   info.symbols = (bfd_byte *) xmalloc (info.symbols_alloc);
 
+  info.strings = NULL;
+  info.last_string = NULL;
+  /* Reserve 1 byte for a null byte.  */
   info.strings_size = 1;
   info.strings_size = 1;
-  info.strings_alloc = 500;
-  info.strings = (bfd_byte *) xmalloc (info.strings_alloc);
-  info.strings[0] = '\0';
 
 
-  if (! bfd_hash_table_init (&info.strhash.table, string_hash_newfunc)
-      || ! bfd_hash_table_init (&info.typedef_hash.table, string_hash_newfunc))
+  if (!bfd_hash_table_init (&info.strhash.table, string_hash_newfunc,
+                           sizeof (struct string_hash_entry))
+      || !bfd_hash_table_init (&info.typedef_hash.table, string_hash_newfunc,
+                              sizeof (struct string_hash_entry)))
     {
     {
-      fprintf (stderr, "bfd_hash_table_init_failed: %s\n",
-              bfd_errmsg (bfd_get_error ()));
-      return false;
+      non_fatal ("bfd_hash_table_init_failed: %s",
+                bfd_errmsg (bfd_get_error ()));
+      return FALSE;
     }
 
   info.type_stack = NULL;
     }
 
   info.type_stack = NULL;
@@ -521,22 +502,23 @@ write_stabs_in_sections_debugging_info (abfd, dhandle, psyms, psymsize,
 
   /* The initial symbol holds the string size.  */
   if (! stab_write_symbol (&info, 0, 0, 0, (const char *) NULL))
 
   /* The initial symbol holds the string size.  */
   if (! stab_write_symbol (&info, 0, 0, 0, (const char *) NULL))
-    return false;
+    return FALSE;
 
   /* Output an initial N_SO symbol.  */
   info.so_offset = info.symbols_size;
   if (! stab_write_symbol (&info, N_SO, 0, 0, bfd_get_filename (abfd)))
 
   /* Output an initial N_SO symbol.  */
   info.so_offset = info.symbols_size;
   if (! stab_write_symbol (&info, N_SO, 0, 0, bfd_get_filename (abfd)))
-    return false;
+    return FALSE;
 
 
-  if (! debug_write (dhandle, &stab_fns, (PTR) &info))
-    return false;
+  if (! debug_write (dhandle, &stab_fns, (void *) &info))
+    return FALSE;
 
 
-  assert (info.pending_lbrac == (bfd_vma) -1);
+  if (info.pending_lbrac != (bfd_vma) -1)
+    return FALSE;
 
   /* Output a trailing N_SO.  */
   if (! stab_write_symbol (&info, N_SO, 0, info.last_text_address,
                           (const char *) NULL))
 
   /* Output a trailing N_SO.  */
   if (! stab_write_symbol (&info, N_SO, 0, info.last_text_address,
                           (const char *) NULL))
-    return false;
+    return FALSE;
 
   /* Put the string size in the initial symbol.  */
   bfd_put_32 (abfd, info.strings_size, info.symbols + 8);
 
   /* Put the string size in the initial symbol.  */
   bfd_put_32 (abfd, info.strings_size, info.symbols + 8);
@@ -544,18 +526,24 @@ write_stabs_in_sections_debugging_info (abfd, dhandle, psyms, psymsize,
   *psyms = info.symbols;
   *psymsize = info.symbols_size;
 
   *psyms = info.symbols;
   *psymsize = info.symbols_size;
 
-  *pstrings = info.strings;
   *pstringsize = info.strings_size;
   *pstringsize = info.strings_size;
+  *pstrings = (bfd_byte *) xmalloc (info.strings_size);
 
 
-  return true;
+  p = *pstrings;
+  *p++ = '\0';
+  for (h = info.strings; h != NULL; h = h->next)
+    {
+      strcpy ((char *) p, h->root.string);
+      p += strlen ((char *) p) + 1;
+    }
+
+  return TRUE;
 }
 
 /* Start writing out information for a compilation unit.  */
 
 }
 
 /* Start writing out information for a compilation unit.  */
 
-static boolean
-stab_start_compilation_unit (p, filename)
-     PTR p;
-     const char *filename;
+static bfd_boolean
+stab_start_compilation_unit (void *p, const char *filename)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -571,10 +559,8 @@ stab_start_compilation_unit (p, filename)
 
 /* Start writing out information for a particular source file.  */
 
 
 /* Start writing out information for a particular source file.  */
 
-static boolean
-stab_start_source (p, filename)
-     PTR p;
-     const char *filename;
+static bfd_boolean
+stab_start_source (void *p, const char *filename)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -590,9 +576,8 @@ stab_start_source (p, filename)
 /* Push an empty type.  This shouldn't normally happen.  We just use a
    void type.  */
 
 /* Push an empty type.  This shouldn't normally happen.  We just use a
    void type.  */
 
-static boolean
-stab_empty_type (p)
-     PTR p;
+static bfd_boolean
+stab_empty_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -603,23 +588,22 @@ stab_empty_type (p)
     return stab_push_defined_type (info, info->type_cache.void_type, 0);
   else
     {
     return stab_push_defined_type (info, info->type_cache.void_type, 0);
   else
     {
-      long index;
+      long tindex;
       char buf[40];
 
       char buf[40];
 
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
 
       ++info->type_index;
 
-      sprintf (buf, "%ld=%ld", index, index);
+      sprintf (buf, "%ld=%ld", tindex, tindex);
 
 
-      return stab_push_string (info, buf, index, false, 0);
+      return stab_push_string (info, buf, tindex, FALSE, 0);
     }
 }
 
 /* Push a void type.  */
 
     }
 }
 
 /* Push a void type.  */
 
-static boolean
-stab_void_type (p)
-     PTR p;
+static bfd_boolean
+stab_void_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -627,35 +611,32 @@ stab_void_type (p)
     return stab_push_defined_type (info, info->type_cache.void_type, 0);
   else
     {
     return stab_push_defined_type (info, info->type_cache.void_type, 0);
   else
     {
-      long index;
+      long tindex;
       char buf[40];
 
       char buf[40];
 
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
 
       ++info->type_index;
 
-      info->type_cache.void_type = index;
+      info->type_cache.void_type = tindex;
 
 
-      sprintf (buf, "%ld=%ld", index, index);
+      sprintf (buf, "%ld=%ld", tindex, tindex);
 
 
-      return stab_push_string (info, buf, index, true, 0);
+      return stab_push_string (info, buf, tindex, TRUE, 0);
     }
 }
 
 /* Push an integer type.  */
 
     }
 }
 
 /* Push an integer type.  */
 
-static boolean
-stab_int_type (p, size, unsignedp)
-     PTR p;
-     unsigned int size;
-     boolean unsignedp;
+static bfd_boolean
+stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   long *cache;
 
   if (size <= 0 || (size > sizeof (long) && size != 8))
     {
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   long *cache;
 
   if (size <= 0 || (size > sizeof (long) && size != 8))
     {
-      fprintf (stderr, "stab_int_type: bad size %u\n", size);
-      return false;
+      non_fatal (_("stab_int_type: bad size %u"), size);
+      return FALSE;
     }
 
   if (unsignedp)
     }
 
   if (unsignedp)
@@ -667,15 +648,15 @@ stab_int_type (p, size, unsignedp)
     return stab_push_defined_type (info, cache[size - 1], size);
   else
     {
     return stab_push_defined_type (info, cache[size - 1], size);
   else
     {
-      long index;
+      long tindex;
       char buf[100];
 
       char buf[100];
 
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
 
       ++info->type_index;
 
-      cache[size - 1] = index;
+      cache[size - 1] = tindex;
 
 
-      sprintf (buf, "%ld=r%ld;", index, index);
+      sprintf (buf, "%ld=r%ld;", tindex, tindex);
       if (unsignedp)
        {
          strcat (buf, "0;");
       if (unsignedp)
        {
          strcat (buf, "0;");
@@ -700,16 +681,14 @@ stab_int_type (p, size, unsignedp)
            abort ();
        }
 
            abort ();
        }
 
-      return stab_push_string (info, buf, index, true, size);
+      return stab_push_string (info, buf, tindex, TRUE, size);
     }
 }
 
 /* Push a floating point type.  */
 
     }
 }
 
 /* Push a floating point type.  */
 
-static boolean
-stab_float_type (p, size)
-     PTR p;
-     unsigned int size;
+static bfd_boolean
+stab_float_type (void *p, unsigned int size)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -722,111 +701,105 @@ stab_float_type (p, size)
                                   size);
   else
     {
                                   size);
   else
     {
-      long index;
+      long tindex;
       char *int_type;
       char buf[50];
 
       /* Floats are defined as a subrange of int.  */
       char *int_type;
       char buf[50];
 
       /* Floats are defined as a subrange of int.  */
-      if (! stab_int_type (info, 4, false))
-       return false;
+      if (! stab_int_type (info, 4, FALSE))
+       return FALSE;
       int_type = stab_pop_type (info);
 
       int_type = stab_pop_type (info);
 
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
 
       if (size > 0
          && size - 1 < (sizeof info->type_cache.float_types
                         / sizeof info->type_cache.float_types[0]))
       ++info->type_index;
 
       if (size > 0
          && size - 1 < (sizeof info->type_cache.float_types
                         / sizeof info->type_cache.float_types[0]))
-       info->type_cache.float_types[size - 1] = index;
+       info->type_cache.float_types[size - 1] = tindex;
 
 
-      sprintf (buf, "%ld=r%s;%u;0;", index, int_type, size);
+      sprintf (buf, "%ld=r%s;%u;0;", tindex, int_type, size);
 
       free (int_type);
 
 
       free (int_type);
 
-      return stab_push_string (info, buf, index, true, size);
+      return stab_push_string (info, buf, tindex, TRUE, size);
     }
 }
 
 /* Push a complex type.  */
 
     }
 }
 
 /* Push a complex type.  */
 
-static boolean
-stab_complex_type (p, size)
-     PTR p;
-     unsigned int size;
+static bfd_boolean
+stab_complex_type (void *p, unsigned int size)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char buf[50];
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char buf[50];
-  long index;
+  long tindex;
 
 
-  index = info->type_index;
+  tindex = info->type_index;
   ++info->type_index;
 
   ++info->type_index;
 
-  sprintf (buf, "%ld=r%ld;%u;0;", index, index, size);
+  sprintf (buf, "%ld=r%ld;%u;0;", tindex, tindex, size);
 
 
-  return stab_push_string (info, buf, index, true, size * 2);
+  return stab_push_string (info, buf, tindex, TRUE, size * 2);
 }
 
 }
 
-/* Push a boolean type.  We use an XCOFF predefined type, since gdb
+/* Push a bfd_boolean type.  We use an XCOFF predefined type, since gdb
    always recognizes them.  */
 
    always recognizes them.  */
 
-static boolean
-stab_bool_type (p, size)
-     PTR p;
-     unsigned int size;
+static bfd_boolean
+stab_bool_type (void *p, unsigned int size)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  long index;
+  long tindex;
 
   switch (size)
     {
     case 1:
 
   switch (size)
     {
     case 1:
-      index = -21;
+      tindex = -21;
       break;
 
     case 2:
       break;
 
     case 2:
-      index = -22;
+      tindex = -22;
       break;
       break;
-      
+
     default:
     case 4:
     default:
     case 4:
-      index = -16;
+      tindex = -16;
       break;
 
     case 8:
       break;
 
     case 8:
-      index = -33;
+      tindex = -33;
       break;
     }
 
       break;
     }
 
-  return stab_push_defined_type (info, index, size);
+  return stab_push_defined_type (info, tindex, size);
 }
 
 /* Push an enum type.  */
 
 }
 
 /* Push an enum type.  */
 
-static boolean
-stab_enum_type (p, tag, names, vals)
-     PTR p;
-     const char *tag;
-     const char **names;
-     bfd_signed_vma *vals;
+static bfd_boolean
+stab_enum_type (void *p, const char *tag, const char **names,
+               bfd_signed_vma *vals)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   size_t len;
   const char **pn;
   char *buf;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   size_t len;
   const char **pn;
   char *buf;
-  long index = 0;
+  long tindex = 0;
   bfd_signed_vma *pv;
 
   if (names == NULL)
     {
   bfd_signed_vma *pv;
 
   if (names == NULL)
     {
-      assert (tag != NULL);
+      if (tag == NULL)
+       return FALSE;
 
       buf = (char *) xmalloc (10 + strlen (tag));
       sprintf (buf, "xe%s:", tag);
       /* FIXME: The size is just a guess.  */
 
       buf = (char *) xmalloc (10 + strlen (tag));
       sprintf (buf, "xe%s:", tag);
       /* FIXME: The size is just a guess.  */
-      if (! stab_push_string (info, buf, 0, false, 4))
-       return false;
+      if (! stab_push_string (info, buf, 0, FALSE, 4))
+       return FALSE;
       free (buf);
       free (buf);
-      return true;
+      return TRUE;
     }
 
   len = 10;
     }
 
   len = 10;
@@ -835,16 +808,17 @@ stab_enum_type (p, tag, names, vals)
   for (pn = names; *pn != NULL; pn++)
     len += strlen (*pn) + 20;
 
   for (pn = names; *pn != NULL; pn++)
     len += strlen (*pn) + 20;
 
+  buf = (char *) xmalloc (len);
+
   if (tag == NULL)
     strcpy (buf, "e");
   else
     {
   if (tag == NULL)
     strcpy (buf, "e");
   else
     {
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
       ++info->type_index;
-      sprintf (buf, "%s:T%ld=e", tag, index);
+      sprintf (buf, "%s:T%ld=e", tag, tindex);
     }
 
     }
 
-  buf = (char *) xmalloc (len);
   for (pn = names, pv = vals; *pn != NULL; pn++, pv++)
     sprintf (buf + strlen (buf), "%s:%ld,", *pn, (long) *pv);
   strcat (buf, ";");
   for (pn = names, pv = vals; *pn != NULL; pn++, pv++)
     sprintf (buf + strlen (buf), "%s:%ld,", *pn, (long) *pv);
   strcat (buf, ";");
@@ -852,44 +826,41 @@ stab_enum_type (p, tag, names, vals)
   if (tag == NULL)
     {
       /* FIXME: The size is just a guess.  */
   if (tag == NULL)
     {
       /* FIXME: The size is just a guess.  */
-      if (! stab_push_string (info, buf, 0, false, 4))
-       return false;
+      if (! stab_push_string (info, buf, 0, FALSE, 4))
+       return FALSE;
     }
   else
     {
       /* FIXME: The size is just a guess.  */
       if (! stab_write_symbol (info, N_LSYM, 0, 0, buf)
     }
   else
     {
       /* FIXME: The size is just a guess.  */
       if (! stab_write_symbol (info, N_LSYM, 0, 0, buf)
-         || ! stab_push_defined_type (info, index, 4))
-       return false;
+         || ! stab_push_defined_type (info, tindex, 4))
+       return FALSE;
     }
 
   free (buf);
 
     }
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Push a modification of the top type on the stack.  Cache the
    results in CACHE and CACHE_ALLOC.  */
 
 }
 
 /* Push a modification of the top type on the stack.  Cache the
    results in CACHE and CACHE_ALLOC.  */
 
-static boolean
-stab_modify_type (info, mod, size, cache, cache_alloc)
-     struct stab_write_handle *info;
-     int mod;
-     unsigned int size;
-     long **cache;
-     size_t *cache_alloc;
+static bfd_boolean
+stab_modify_type (struct stab_write_handle *info, int mod,
+                 unsigned int size, long **cache, size_t *cache_alloc)
 {
   long targindex;
 {
   long targindex;
-  long index;
+  long tindex;
   char *s, *buf;
 
   char *s, *buf;
 
-  assert (info->type_stack != NULL);
+  if (info->type_stack == NULL)
+    return FALSE;
   targindex = info->type_stack->index;
 
   if (targindex <= 0
       || cache == NULL)
     {
   targindex = info->type_stack->index;
 
   if (targindex <= 0
       || cache == NULL)
     {
-      boolean definition;
+      bfd_boolean definition;
 
       /* Either the target type has no index, or we aren't caching
          this modifier.  Either way we have no way of recording the
 
       /* Either the target type has no index, or we aren't caching
          this modifier.  Either way we have no way of recording the
@@ -900,19 +871,19 @@ stab_modify_type (info, mod, size, cache, cache_alloc)
       sprintf (buf, "%c%s", mod, s);
       free (s);
       if (! stab_push_string (info, buf, 0, definition, size))
       sprintf (buf, "%c%s", mod, s);
       free (s);
       if (! stab_push_string (info, buf, 0, definition, size))
-       return false;
+       return FALSE;
       free (buf);
     }
   else
     {
       free (buf);
     }
   else
     {
-      if (targindex >= *cache_alloc)
+      if ((size_t) targindex >= *cache_alloc)
        {
          size_t alloc;
 
          alloc = *cache_alloc;
          if (alloc == 0)
            alloc = 10;
        {
          size_t alloc;
 
          alloc = *cache_alloc;
          if (alloc == 0)
            alloc = 10;
-         while (targindex >= alloc)
+         while ((size_t) targindex >= alloc)
            alloc *= 2;
          *cache = (long *) xrealloc (*cache, alloc * sizeof (long));
          memset (*cache + *cache_alloc, 0,
            alloc *= 2;
          *cache = (long *) xrealloc (*cache, alloc * sizeof (long));
          memset (*cache + *cache_alloc, 0,
@@ -920,44 +891,45 @@ stab_modify_type (info, mod, size, cache, cache_alloc)
          *cache_alloc = alloc;
        }
 
          *cache_alloc = alloc;
        }
 
-      index = (*cache)[targindex];
-      if (index != 0)
+      tindex = (*cache)[targindex];
+      if (tindex != 0 && ! info->type_stack->definition)
        {
        {
-         /* If we have already defined a modification of this type,
-             then the entry on the type stack can not be a definition,
-             so we can safely discard it.  */
-         assert (! info->type_stack->definition);
+         /* We have already defined a modification of this type, and
+             the entry on the type stack is not a definition, so we
+             can safely discard it (we may have a definition on the
+             stack, even if we already defined a modification, if it
+             is a struct which we did not define at the time it was
+             referenced).  */
          free (stab_pop_type (info));
          free (stab_pop_type (info));
-         if (! stab_push_defined_type (info, index, size))
-           return false;
+         if (! stab_push_defined_type (info, tindex, size))
+           return FALSE;
        }
       else
        {
        }
       else
        {
-         index = info->type_index;
+         tindex = info->type_index;
          ++info->type_index;
 
          s = stab_pop_type (info);
          buf = (char *) xmalloc (strlen (s) + 20);
          ++info->type_index;
 
          s = stab_pop_type (info);
          buf = (char *) xmalloc (strlen (s) + 20);
-         sprintf (buf, "%ld=%c%s", index, mod, s);
+         sprintf (buf, "%ld=%c%s", tindex, mod, s);
          free (s);
 
          free (s);
 
-         (*cache)[targindex] = index;
+         (*cache)[targindex] = tindex;
 
 
-         if (! stab_push_string (info, buf, index, true, size))
-           return false;
+         if (! stab_push_string (info, buf, tindex, TRUE, size))
+           return FALSE;
 
          free (buf);
        }
     }
 
 
          free (buf);
        }
     }
 
-  return true;
-}  
+  return TRUE;
+}
 
 /* Push a pointer type.  */
 
 
 /* Push a pointer type.  */
 
-static boolean
-stab_pointer_type (p)
-     PTR p;
+static bfd_boolean
+stab_pointer_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -968,18 +940,16 @@ stab_pointer_type (p)
 
 /* Push a function type.  */
 
 
 /* Push a function type.  */
 
-static boolean
-stab_function_type (p, argcount, varargs)
-     PTR p;
-     int argcount;
-     boolean varargs;
+static bfd_boolean
+stab_function_type (void *p, int argcount,
+                   bfd_boolean varargs ATTRIBUTE_UNUSED)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   int i;
 
   /* We have no way to represent the argument types, so we just
      discard them.  However, if they define new types, we must output
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   int i;
 
   /* We have no way to represent the argument types, so we just
      discard them.  However, if they define new types, we must output
-     them.  We do this by producing meaningless typedefs.  */
+     them.  We do this by producing empty typedefs.  */
   for (i = 0; i < argcount; i++)
     {
       if (! info->type_stack->definition)
   for (i = 0; i < argcount; i++)
     {
       if (! info->type_stack->definition)
@@ -987,19 +957,15 @@ stab_function_type (p, argcount, varargs)
       else
        {
          char *s, *buf;
       else
        {
          char *s, *buf;
-         long index;
 
          s = stab_pop_type (info);
 
 
          s = stab_pop_type (info);
 
-         buf = (char *) xmalloc (strlen (s) + 40);
-         index = info->type_index;
-         ++info->type_index;
-         sprintf (buf, "__fake_type_%ld:t%s", index, s);
-
+         buf = (char *) xmalloc (strlen (s) + 3);
+         sprintf (buf, ":t%s", s);
          free (s);
 
          if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
          free (s);
 
          if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
-           return false;
+           return FALSE;
 
          free (buf);
        }
 
          free (buf);
        }
@@ -1011,9 +977,8 @@ stab_function_type (p, argcount, varargs)
 
 /* Push a reference type.  */
 
 
 /* Push a reference type.  */
 
-static boolean
-stab_reference_type (p)
-     PTR p;
+static bfd_boolean
+stab_reference_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -1024,14 +989,11 @@ stab_reference_type (p)
 
 /* Push a range type.  */
 
 
 /* Push a range type.  */
 
-static boolean
-stab_range_type (p, low, high)
-     PTR p;
-     bfd_signed_vma low;
-     bfd_signed_vma high;
+static bfd_boolean
+stab_range_type (void *p, bfd_signed_vma low, bfd_signed_vma high)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   unsigned int size;
   char *s, *buf;
 
   unsigned int size;
   char *s, *buf;
 
@@ -1044,27 +1006,24 @@ stab_range_type (p, low, high)
   free (s);
 
   if (! stab_push_string (info, buf, 0, definition, size))
   free (s);
 
   if (! stab_push_string (info, buf, 0, definition, size))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Push an array type.  */
 
 }
 
 /* Push an array type.  */
 
-static boolean
-stab_array_type (p, low, high, stringp)
-     PTR p;
-     bfd_signed_vma low;
-     bfd_signed_vma high;
-     boolean stringp;
+static bfd_boolean
+stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
+                bfd_boolean stringp)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   unsigned int element_size;
   char *range, *element, *buf;
   unsigned int element_size;
   char *range, *element, *buf;
-  long index;
+  long tindex;
   unsigned int size;
 
   definition = info->type_stack->definition;
   unsigned int size;
 
   definition = info->type_stack->definition;
@@ -1078,46 +1037,45 @@ stab_array_type (p, low, high, stringp)
 
   if (! stringp)
     {
 
   if (! stringp)
     {
-      index = 0;
+      tindex = 0;
       *buf = '\0';
     }
   else
     {
       /* We need to define a type in order to include the string
          attribute.  */
       *buf = '\0';
     }
   else
     {
       /* We need to define a type in order to include the string
          attribute.  */
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
       ++info->type_index;
-      definition = true;
-      sprintf (buf, "%ld=@S;", index);
+      definition = TRUE;
+      sprintf (buf, "%ld=@S;", tindex);
     }
 
     }
 
-  sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s", range, low, high, element);
+  sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s",
+          range, (long) low, (long) high, element);
   free (range);
   free (element);
 
   free (range);
   free (element);
 
-  if (high <= low)
+  if (high < low)
     size = 0;
   else
     size = element_size * ((high - low) + 1);
     size = 0;
   else
     size = element_size * ((high - low) + 1);
-  if (! stab_push_string (info, buf, index, definition, size))
-    return false;
+  if (! stab_push_string (info, buf, tindex, definition, size))
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Push a set type.  */
 
 }
 
 /* Push a set type.  */
 
-static boolean
-stab_set_type (p, bitstringp)
-     PTR p;
-     boolean bitstringp;
+static bfd_boolean
+stab_set_type (void *p, bfd_boolean bitstringp)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   char *s, *buf;
   char *s, *buf;
-  long index;
+  long tindex;
 
   definition = info->type_stack->definition;
 
 
   definition = info->type_stack->definition;
 
@@ -1127,37 +1085,36 @@ stab_set_type (p, bitstringp)
   if (! bitstringp)
     {
       *buf = '\0';
   if (! bitstringp)
     {
       *buf = '\0';
-      index = 0;
+      tindex = 0;
     }
   else
     {
       /* We need to define a type in order to include the string
          attribute.  */
     }
   else
     {
       /* We need to define a type in order to include the string
          attribute.  */
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
       ++info->type_index;
-      definition = true;
-      sprintf (buf, "%ld=@S;", index);
+      definition = TRUE;
+      sprintf (buf, "%ld=@S;", tindex);
     }
 
   sprintf (buf + strlen (buf), "S%s", s);
   free (s);
 
     }
 
   sprintf (buf + strlen (buf), "S%s", s);
   free (s);
 
-  if (! stab_push_string (info, buf, index, definition, 0))
-    return false;
+  if (! stab_push_string (info, buf, tindex, definition, 0))
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Push an offset type.  */
 
 }
 
 /* Push an offset type.  */
 
-static boolean
-stab_offset_type (p)
-     PTR p;
+static bfd_boolean
+stab_offset_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   char *target, *base, *buf;
 
   definition = info->type_stack->definition;
   char *target, *base, *buf;
 
   definition = info->type_stack->definition;
@@ -1172,24 +1129,21 @@ stab_offset_type (p)
   free (target);
 
   if (! stab_push_string (info, buf, 0, definition, 0))
   free (target);
 
   if (! stab_push_string (info, buf, 0, definition, 0))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Push a method type.  */
 
 }
 
 /* Push a method type.  */
 
-static boolean
-stab_method_type (p, domainp, argcount, varargs)
-     PTR p;
-     boolean domainp;
-     int argcount;
-     boolean varargs;
+static bfd_boolean
+stab_method_type (void *p, bfd_boolean domainp, int argcount,
+                 bfd_boolean varargs)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   char *domain, *return_type, *buf;
   char **args;
   int i;
   char *domain, *return_type, *buf;
   char **args;
   int i;
@@ -1204,7 +1158,7 @@ stab_method_type (p, domainp, argcount, varargs)
   if (! domainp)
     {
       if (! stab_empty_type (p))
   if (! domainp)
     {
       if (! stab_empty_type (p))
-       return false;
+       return FALSE;
     }
 
   definition = info->type_stack->definition;
     }
 
   definition = info->type_stack->definition;
@@ -1226,7 +1180,7 @@ stab_method_type (p, domainp, argcount, varargs)
        {
          args = (char **) xmalloc (1 * sizeof (*args));
          if (! stab_empty_type (p))
        {
          args = (char **) xmalloc (1 * sizeof (*args));
          if (! stab_empty_type (p))
-           return false;
+           return FALSE;
          definition = definition || info->type_stack->definition;
          args[0] = stab_pop_type (info);
          argcount = 1;
          definition = definition || info->type_stack->definition;
          args[0] = stab_pop_type (info);
          argcount = 1;
@@ -1243,7 +1197,7 @@ stab_method_type (p, domainp, argcount, varargs)
       if (! varargs)
        {
          if (! stab_empty_type (p))
       if (! varargs)
        {
          if (! stab_empty_type (p))
-           return false;
+           return FALSE;
          definition = definition || info->type_stack->definition;
          args[argcount] = stab_pop_type (info);
          ++argcount;
          definition = definition || info->type_stack->definition;
          args[argcount] = stab_pop_type (info);
          ++argcount;
@@ -1270,22 +1224,20 @@ stab_method_type (p, domainp, argcount, varargs)
     }
   strcat (buf, ";");
 
     }
   strcat (buf, ";");
 
-  if (args != NULL)
-    free (args);
+  free (args);
 
   if (! stab_push_string (info, buf, 0, definition, 0))
 
   if (! stab_push_string (info, buf, 0, definition, 0))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Push a const version of a type.  */
 
 }
 
 /* Push a const version of a type.  */
 
-static boolean
-stab_const_type (p)
-     PTR p;
+static bfd_boolean
+stab_const_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -1295,9 +1247,8 @@ stab_const_type (p)
 
 /* Push a volatile version of a type.  */
 
 
 /* Push a volatile version of a type.  */
 
-static boolean
-stab_volatile_type (p)
-     PTR p;
+static bfd_boolean
+stab_volatile_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -1309,12 +1260,9 @@ stab_volatile_type (p)
    return -1 if it fails.  */
 
 static long
    return -1 if it fails.  */
 
 static long
-stab_get_struct_index (info, tag, id, kind, psize)
-     struct stab_write_handle *info;
-     const char *tag;
-     unsigned int id;
-     enum debug_type_kind kind;
-     unsigned int *psize;
+stab_get_struct_index (struct stab_write_handle *info, const char *tag,
+                      unsigned int id, enum debug_type_kind kind,
+                      unsigned int *psize)
 {
   if (id >= info->type_cache.struct_types_alloc)
     {
 {
   if (id >= info->type_cache.struct_types_alloc)
     {
@@ -1359,63 +1307,52 @@ stab_get_struct_index (info, tag, id, kind, psize)
 /* Start outputting a struct.  We ignore the tag, and handle it in
    stab_tag.  */
 
 /* Start outputting a struct.  We ignore the tag, and handle it in
    stab_tag.  */
 
-/*ARGSUSED*/
-static boolean
-stab_start_struct_type (p, tag, id, structp, size)
-     PTR p;
-     const char *tag;
-     unsigned int id;
-     boolean structp;
-     unsigned int size;
+static bfd_boolean
+stab_start_struct_type (void *p, const char *tag, unsigned int id,
+                       bfd_boolean structp, unsigned int size)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  long index;
-  boolean definition;
-  char *buf;
-
-  buf = (char *) xmalloc (40);
+  long tindex;
+  bfd_boolean definition;
+  char buf[40];
 
   if (id == 0)
     {
 
   if (id == 0)
     {
-      index = 0;
+      tindex = 0;
       *buf = '\0';
       *buf = '\0';
-      definition = false;
+      definition = FALSE;
     }
   else
     {
     }
   else
     {
-      index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
+      tindex = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
                                     &size);
                                     &size);
-      if (index < 0)
-       return false;
-      sprintf (buf, "%ld=", index);
-      definition = true;
+      if (tindex < 0)
+       return FALSE;
+      sprintf (buf, "%ld=", tindex);
+      definition = TRUE;
     }
 
   sprintf (buf + strlen (buf), "%c%u",
           structp ? 's' : 'u',
           size);
 
     }
 
   sprintf (buf + strlen (buf), "%c%u",
           structp ? 's' : 'u',
           size);
 
-  if (! stab_push_string (info, buf, index, definition, size))
-    return false;
+  if (! stab_push_string (info, buf, tindex, definition, size))
+    return FALSE;
 
   info->type_stack->fields = (char *) xmalloc (1);
   info->type_stack->fields[0] = '\0';
 
 
   info->type_stack->fields = (char *) xmalloc (1);
   info->type_stack->fields[0] = '\0';
 
-  return true;
+  return TRUE;
 }
 
 /* Add a field to a struct.  */
 
 }
 
 /* Add a field to a struct.  */
 
-static boolean
-stab_struct_field (p, name, bitpos, bitsize, visibility)
-     PTR p;
-     const char *name;
-     bfd_vma bitpos;
-     bfd_vma bitsize;
-     enum debug_visibility visibility;
+static bfd_boolean
+stab_struct_field (void *p, const char *name, bfd_vma bitpos,
+                  bfd_vma bitsize, enum debug_visibility visibility)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   unsigned int size;
   char *s, *n;
   const char *vis;
   unsigned int size;
   char *s, *n;
   const char *vis;
@@ -1426,8 +1363,9 @@ stab_struct_field (p, name, bitpos, bitsize, visibility)
 
   /* Add this field to the end of the current struct fields, which is
      currently on the top of the stack.  */
 
   /* Add this field to the end of the current struct fields, which is
      currently on the top of the stack.  */
+  if (info->type_stack->fields == NULL)
+    return FALSE;
 
 
-  assert (info->type_stack->fields != NULL);
   n = (char *) xmalloc (strlen (info->type_stack->fields)
                        + strlen (name)
                        + strlen (s)
   n = (char *) xmalloc (strlen (info->type_stack->fields)
                        + strlen (name)
                        + strlen (s)
@@ -1455,9 +1393,8 @@ stab_struct_field (p, name, bitpos, bitsize, visibility)
     {
       bitsize = size * 8;
       if (bitsize == 0)
     {
       bitsize = size * 8;
       if (bitsize == 0)
-       fprintf (stderr,
-                "%s: warning: unknown size for field `%s' in struct\n",
-                bfd_get_filename (info->abfd), name);
+       non_fatal (_("%s: warning: unknown size for field `%s' in struct"),
+                  bfd_get_filename (info->abfd), name);
     }
 
   sprintf (n, "%s%s:%s%s,%ld,%ld;", info->type_stack->fields, name, vis, s,
     }
 
   sprintf (n, "%s%s:%s%s,%ld,%ld;", info->type_stack->fields, name, vis, s,
@@ -1467,27 +1404,27 @@ stab_struct_field (p, name, bitpos, bitsize, visibility)
   info->type_stack->fields = n;
 
   if (definition)
   info->type_stack->fields = n;
 
   if (definition)
-    info->type_stack->definition = true;
+    info->type_stack->definition = TRUE;
 
 
-  return true;
+  return TRUE;
 }
 
 /* Finish up a struct.  */
 
 }
 
 /* Finish up a struct.  */
 
-static boolean
-stab_end_struct_type (p)
-     PTR p;
+static bfd_boolean
+stab_end_struct_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
-  long index;
+  bfd_boolean definition;
+  long tindex;
   unsigned int size;
   char *fields, *first, *buf;
 
   unsigned int size;
   char *fields, *first, *buf;
 
-  assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+  if (info->type_stack == NULL || info->type_stack->fields == NULL)
+    return FALSE;
 
   definition = info->type_stack->definition;
 
   definition = info->type_stack->definition;
-  index = info->type_stack->index;
+  tindex = info->type_stack->index;
   size = info->type_stack->size;
   fields = info->type_stack->fields;
   first = stab_pop_type (info);
   size = info->type_stack->size;
   fields = info->type_stack->fields;
   first = stab_pop_type (info);
@@ -1497,43 +1434,33 @@ stab_end_struct_type (p)
   free (first);
   free (fields);
 
   free (first);
   free (fields);
 
-  if (! stab_push_string (info, buf, index, definition, size))
-    return false;
+  if (! stab_push_string (info, buf, tindex, definition, size))
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Start outputting a class.  */
 
 }
 
 /* Start outputting a class.  */
 
-static boolean
-stab_start_class_type (p, tag, id, structp, size, vptr, ownvptr)
-     PTR p;
-     const char *tag;
-     unsigned int id;
-     boolean structp;
-     unsigned int size;
-     boolean vptr;
-     boolean ownvptr;
+static bfd_boolean
+stab_start_class_type (void *p, const char *tag, unsigned int id,
+                      bfd_boolean structp, unsigned int size,
+                      bfd_boolean vptr, bfd_boolean ownvptr)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
-  char *vstring;
+  bfd_boolean definition = FALSE;
+  char *vstring = NULL;
 
 
-  if (! vptr || ownvptr)
-    {
-      definition = false;
-      vstring = NULL;
-    }
-  else
+  if (vptr && !ownvptr)
     {
       definition = info->type_stack->definition;
       vstring = stab_pop_type (info);
     }
 
   if (! stab_start_struct_type (p, tag, id, structp, size))
     {
       definition = info->type_stack->definition;
       vstring = stab_pop_type (info);
     }
 
   if (! stab_start_struct_type (p, tag, id, structp, size))
-    return false;
+    return FALSE;
 
   if (vptr)
     {
 
   if (vptr)
     {
@@ -1541,37 +1468,35 @@ stab_start_class_type (p, tag, id, structp, size, vptr, ownvptr)
 
       if (ownvptr)
        {
 
       if (ownvptr)
        {
-         assert (info->type_stack->index > 0);
+         if (info->type_stack->index < 1)
+           return FALSE;
          vtable = (char *) xmalloc (20);
          sprintf (vtable, "~%%%ld", info->type_stack->index);
        }
       else
        {
          vtable = (char *) xmalloc (20);
          sprintf (vtable, "~%%%ld", info->type_stack->index);
        }
       else
        {
+         if (vstring == NULL)
+           return FALSE;
          vtable = (char *) xmalloc (strlen (vstring) + 3);
          sprintf (vtable, "~%%%s", vstring);
          free (vstring);
          vtable = (char *) xmalloc (strlen (vstring) + 3);
          sprintf (vtable, "~%%%s", vstring);
          free (vstring);
+         if (definition)
+           info->type_stack->definition = TRUE;
        }
        }
-
       info->type_stack->vtable = vtable;
     }
 
       info->type_stack->vtable = vtable;
     }
 
-  if (definition)
-    info->type_stack->definition = true;
-
-  return true;
+  return TRUE;
 }
 
 /* Add a static member to the class on the type stack.  */
 
 }
 
 /* Add a static member to the class on the type stack.  */
 
-static boolean
-stab_class_static_member (p, name, physname, visibility)
-     PTR p;
-     const char *name;
-     const char *physname;
-     enum debug_visibility visibility;
+static bfd_boolean
+stab_class_static_member (void *p, const char *name, const char *physname,
+                         enum debug_visibility visibility)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   char *s, *n;
   const char *vis;
 
   char *s, *n;
   const char *vis;
 
@@ -1581,7 +1506,8 @@ stab_class_static_member (p, name, physname, visibility)
   /* Add this field to the end of the current struct fields, which is
      currently on the top of the stack.  */
 
   /* Add this field to the end of the current struct fields, which is
      currently on the top of the stack.  */
 
-  assert (info->type_stack->fields != NULL);
+  if (info->type_stack->fields == NULL)
+    return FALSE;
   n = (char *) xmalloc (strlen (info->type_stack->fields)
                        + strlen (name)
                        + strlen (s)
   n = (char *) xmalloc (strlen (info->type_stack->fields)
                        + strlen (name)
                        + strlen (s)
@@ -1613,22 +1539,19 @@ stab_class_static_member (p, name, physname, visibility)
   info->type_stack->fields = n;
 
   if (definition)
   info->type_stack->fields = n;
 
   if (definition)
-    info->type_stack->definition = true;
+    info->type_stack->definition = TRUE;
 
 
-  return true;
+  return TRUE;
 }
 
 /* Add a base class to the class on the type stack.  */
 
 }
 
 /* Add a base class to the class on the type stack.  */
 
-static boolean
-stab_class_baseclass (p, bitpos, virtual, visibility)
-     PTR p;
-     bfd_vma bitpos;
-     boolean virtual;
-     enum debug_visibility visibility;
+static bfd_boolean
+stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual,
+                     enum debug_visibility visibility)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  boolean definition;
+  bfd_boolean definition;
   char *s;
   char *buf;
   unsigned int c;
   char *s;
   char *buf;
   unsigned int c;
@@ -1640,7 +1563,7 @@ stab_class_baseclass (p, bitpos, virtual, visibility)
   /* Build the base class specifier.  */
 
   buf = (char *) xmalloc (strlen (s) + 25);
   /* Build the base class specifier.  */
 
   buf = (char *) xmalloc (strlen (s) + 25);
-  buf[0] = virtual ? '1' : '0';
+  buf[0] = is_virtual ? '1' : '0';
   switch (visibility)
     {
     default:
   switch (visibility)
     {
     default:
@@ -1664,7 +1587,8 @@ stab_class_baseclass (p, bitpos, virtual, visibility)
 
   /* Add the new baseclass to the existing ones.  */
 
 
   /* Add the new baseclass to the existing ones.  */
 
-  assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+  if (info->type_stack == NULL || info->type_stack->fields == NULL)
+    return FALSE;
 
   if (info->type_stack->baseclasses == NULL)
     c = 0;
 
   if (info->type_stack->baseclasses == NULL)
     c = 0;
@@ -1683,22 +1607,21 @@ stab_class_baseclass (p, bitpos, virtual, visibility)
   info->type_stack->baseclasses = baseclasses;
 
   if (definition)
   info->type_stack->baseclasses = baseclasses;
 
   if (definition)
-    info->type_stack->definition = true;
+    info->type_stack->definition = TRUE;
 
 
-  return true;
+  return TRUE;
 }
 
 /* Start adding a method to the class on the type stack.  */
 
 }
 
 /* Start adding a method to the class on the type stack.  */
 
-static boolean
-stab_class_start_method (p, name)
-     PTR p;
-     const char *name;
+static bfd_boolean
+stab_class_start_method (void *p, const char *name)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *m;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *m;
 
-  assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+  if (info->type_stack == NULL || info->type_stack->fields == NULL)
+    return FALSE;
 
   if (info->type_stack->methods == NULL)
     {
 
   if (info->type_stack->methods == NULL)
     {
@@ -1717,24 +1640,19 @@ stab_class_start_method (p, name)
 
   info->type_stack->methods = m;
 
 
   info->type_stack->methods = m;
 
-  return true;
+  return TRUE;
 }
 
 /* Add a variant, either static or not, to the current method.  */
 
 }
 
 /* Add a variant, either static or not, to the current method.  */
 
-static boolean
-stab_class_method_var (info, physname, visibility, staticp, constp, volatilep,
-                      voffset, contextp)
-     struct stab_write_handle *info;
-     const char *physname;
-     enum debug_visibility visibility;
-     boolean staticp;
-     boolean constp;
-     boolean volatilep;
-     bfd_vma voffset;
-     boolean contextp;
+static bfd_boolean
+stab_class_method_var (struct stab_write_handle *info, const char *physname,
+                      enum debug_visibility visibility,
+                      bfd_boolean staticp, bfd_boolean constp,
+                      bfd_boolean volatilep, bfd_vma voffset,
+                      bfd_boolean contextp)
 {
 {
-  boolean definition;
+  bfd_boolean definition;
   char *type;
   char *context = NULL;
   char visc, qualc, typec;
   char *type;
   char *context = NULL;
   char visc, qualc, typec;
@@ -1748,7 +1666,8 @@ stab_class_method_var (info, physname, visibility, staticp, constp, volatilep,
       context = stab_pop_type (info);
     }
 
       context = stab_pop_type (info);
     }
 
-  assert (info->type_stack != NULL && info->type_stack->methods != NULL);
+  if (info->type_stack == NULL || info->type_stack->methods == NULL)
+    return FALSE;
 
   switch (visibility)
     {
 
   switch (visibility)
     {
@@ -1810,75 +1729,69 @@ stab_class_method_var (info, physname, visibility, staticp, constp, volatilep,
     }
 
   if (definition)
     }
 
   if (definition)
-    info->type_stack->definition = true;
+    info->type_stack->definition = TRUE;
 
 
-  return true;
+  return TRUE;
 }
 
 /* Add a variant to the current method.  */
 
 }
 
 /* Add a variant to the current method.  */
 
-static boolean
-stab_class_method_variant (p, physname, visibility, constp, volatilep,
-                          voffset, contextp)
-     PTR p;
-     const char *physname;
-     enum debug_visibility visibility;
-     boolean constp;
-     boolean volatilep;
-     bfd_vma voffset;
-     boolean contextp;
+static bfd_boolean
+stab_class_method_variant (void *p, const char *physname,
+                          enum debug_visibility visibility,
+                          bfd_boolean constp, bfd_boolean volatilep,
+                          bfd_vma voffset, bfd_boolean contextp)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
-  return stab_class_method_var (info, physname, visibility, false, constp,
+  return stab_class_method_var (info, physname, visibility, FALSE, constp,
                                volatilep, voffset, contextp);
 }
 
 /* Add a static variant to the current method.  */
 
                                volatilep, voffset, contextp);
 }
 
 /* Add a static variant to the current method.  */
 
-static boolean
-stab_class_static_method_variant (p, physname, visibility, constp, volatilep)
-     PTR p;
-     const char *physname;
-     enum debug_visibility visibility;
-     boolean constp;
-     boolean volatilep;
+static bfd_boolean
+stab_class_static_method_variant (void *p, const char *physname,
+                                 enum debug_visibility visibility,
+                                 bfd_boolean constp, bfd_boolean volatilep)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
-  return stab_class_method_var (info, physname, visibility, true, constp,
-                               volatilep, 0, false);
+  return stab_class_method_var (info, physname, visibility, TRUE, constp,
+                               volatilep, 0, FALSE);
 }
 
 /* Finish up a method.  */
 
 }
 
 /* Finish up a method.  */
 
-static boolean
-stab_class_end_method (p)
-     PTR p;
+static bfd_boolean
+stab_class_end_method (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
-  assert (info->type_stack != NULL && info->type_stack->methods != NULL);
+  if (info->type_stack == NULL || info->type_stack->methods == NULL)
+    return FALSE;
 
   /* We allocated enough room on info->type_stack->methods to add the
      trailing semicolon.  */
   strcat (info->type_stack->methods, ";");
 
 
   /* We allocated enough room on info->type_stack->methods to add the
      trailing semicolon.  */
   strcat (info->type_stack->methods, ";");
 
-  return true;
+  return TRUE;
 }
 
 /* Finish up a class.  */
 
 }
 
 /* Finish up a class.  */
 
-static boolean
-stab_end_class_type (p)
-     PTR p;
+static bfd_boolean
+stab_end_class_type (void *p)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   size_t len;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   size_t len;
-  unsigned int i;
+  unsigned int i = 0;
   char *buf;
 
   char *buf;
 
-  assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+  if (info->type_stack == NULL
+      || info->type_stack->string == NULL
+      || info->type_stack->fields == NULL)
+    return FALSE;
 
   /* Work out the size we need to allocate for the class definition.  */
 
 
   /* Work out the size we need to allocate for the class definition.  */
 
@@ -1939,102 +1852,94 @@ stab_end_class_type (p)
   free (info->type_stack->string);
   info->type_stack->string = buf;
 
   free (info->type_stack->string);
   info->type_stack->string = buf;
 
-  return true;
+  return TRUE;
 }
 
 /* Push a typedef which was previously defined.  */
 
 }
 
 /* Push a typedef which was previously defined.  */
 
-static boolean
-stab_typedef_type (p, name)
-     PTR p;
-     const char *name;
+static bfd_boolean
+stab_typedef_type (void *p, const char *name)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   struct string_hash_entry *h;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   struct string_hash_entry *h;
 
-  h = string_hash_lookup (&info->typedef_hash, name, false, false);
-  assert (h != NULL && h->index > 0);
+  h = string_hash_lookup (&info->typedef_hash, name, FALSE, FALSE);
+  if (h == NULL || h->index < 1)
+    return FALSE;
 
   return stab_push_defined_type (info, h->index, h->size);
 }
 
 /* Push a struct, union or class tag.  */
 
 
   return stab_push_defined_type (info, h->index, h->size);
 }
 
 /* Push a struct, union or class tag.  */
 
-static boolean
-stab_tag_type (p, name, id, kind)
-     PTR p;
-     const char *name;
-     unsigned int id;
-     enum debug_type_kind kind;
+static bfd_boolean
+stab_tag_type (void *p, const char *name, unsigned int id,
+              enum debug_type_kind kind)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  long index;
-  unsigned int size;
+  long tindex;
+  unsigned int size = 0;
 
 
-  index = stab_get_struct_index (info, name, id, kind, &size);
-  if (index < 0)
-    return false;
+  tindex = stab_get_struct_index (info, name, id, kind, &size);
+  if (tindex < 0)
+    return FALSE;
 
 
-  return stab_push_defined_type (info, index, size);
+  return stab_push_defined_type (info, tindex, size);
 }
 
 /* Define a typedef.  */
 
 }
 
 /* Define a typedef.  */
 
-static boolean
-stab_typdef (p, name)
-     PTR p;
-     const char *name;
+static bfd_boolean
+stab_typdef (void *p, const char *name)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
-  long index;
+  long tindex;
   unsigned int size;
   char *s, *buf;
   struct string_hash_entry *h;
 
   unsigned int size;
   char *s, *buf;
   struct string_hash_entry *h;
 
-  index = info->type_stack->index;
+  tindex = info->type_stack->index;
   size = info->type_stack->size;
   s = stab_pop_type (info);
 
   buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
 
   size = info->type_stack->size;
   s = stab_pop_type (info);
 
   buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
 
-  if (index > 0)
+  if (tindex > 0)
     sprintf (buf, "%s:t%s", name, s);
   else
     {
     sprintf (buf, "%s:t%s", name, s);
   else
     {
-      index = info->type_index;
+      tindex = info->type_index;
       ++info->type_index;
       ++info->type_index;
-      sprintf (buf, "%s:t%ld=%s", name, index, s);
+      sprintf (buf, "%s:t%ld=%s", name, tindex, s);
     }
 
   free (s);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
     }
 
   free (s);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  h = string_hash_lookup (&info->typedef_hash, name, true, false);
+  h = string_hash_lookup (&info->typedef_hash, name, TRUE, FALSE);
   if (h == NULL)
     {
   if (h == NULL)
     {
-      fprintf (stderr, "string_hash_lookup failed: %s\n",
-              bfd_errmsg (bfd_get_error ()));
-      return false;
+      non_fatal (_("string_hash_lookup failed: %s"),
+                bfd_errmsg (bfd_get_error ()));
+      return FALSE;
     }
 
   /* I don't think we care about redefinitions.  */
 
     }
 
   /* I don't think we care about redefinitions.  */
 
-  h->index = index;
+  h->index = tindex;
   h->size = size;
 
   h->size = size;
 
-  return true;
+  return TRUE;
 }
 
 /* Define a tag.  */
 
 }
 
 /* Define a tag.  */
 
-static boolean
-stab_tag (p, tag)
-     PTR p;
-     const char *tag;
+static bfd_boolean
+stab_tag (void *p, const char *tag)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
@@ -2047,20 +1952,17 @@ stab_tag (p, tag)
   free (s);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
   free (s);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Define an integer constant.  */
 
 }
 
 /* Define an integer constant.  */
 
-static boolean
-stab_int_constant (p, name, val)
-     PTR p;
-     const char *name;
-     bfd_vma val;
+static bfd_boolean
+stab_int_constant (void *p, const char *name, bfd_vma val)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *buf;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *buf;
@@ -2069,20 +1971,17 @@ stab_int_constant (p, name, val)
   sprintf (buf, "%s:c=i%ld", name, (long) val);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
   sprintf (buf, "%s:c=i%ld", name, (long) val);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Define a floating point constant.  */
 
 }
 
 /* Define a floating point constant.  */
 
-static boolean
-stab_float_constant (p, name, val)
-     PTR p;
-     const char *name;
-     double val;
+static bfd_boolean
+stab_float_constant (void *p, const char *name, double val)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *buf;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *buf;
@@ -2091,20 +1990,17 @@ stab_float_constant (p, name, val)
   sprintf (buf, "%s:c=f%g", name, val);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
   sprintf (buf, "%s:c=f%g", name, val);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Define a typed constant.  */
 
 }
 
 /* Define a typed constant.  */
 
-static boolean
-stab_typed_constant (p, name, val)
-     PTR p;
-     const char *name;
-     bfd_vma val;
+static bfd_boolean
+stab_typed_constant (void *p, const char *name, bfd_vma val)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
@@ -2116,21 +2012,18 @@ stab_typed_constant (p, name, val)
   free (s);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
   free (s);
 
   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Record a variable.  */
 
 }
 
 /* Record a variable.  */
 
-static boolean
-stab_variable (p, name, kind, val)
-     PTR p;
-     const char *name;
-     enum debug_var_kind kind;
-     bfd_vma val;
+static bfd_boolean
+stab_variable (void *p, const char *name, enum debug_var_kind kind,
+              bfd_vma val)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
@@ -2164,22 +2057,22 @@ stab_variable (p, name, kind, val)
       kindstr = "";
 
       /* Make sure that this is a type reference or definition.  */
       kindstr = "";
 
       /* Make sure that this is a type reference or definition.  */
-      if (! isdigit (*s))
+      if (! ISDIGIT (*s))
        {
          char *n;
        {
          char *n;
-         long index;
+         long tindex;
 
 
-         index = info->type_index;
+         tindex = info->type_index;
          ++info->type_index;
          n = (char *) xmalloc (strlen (s) + 20);
          ++info->type_index;
          n = (char *) xmalloc (strlen (s) + 20);
-         sprintf (n, "%ld=%s", index, s);
+         sprintf (n, "%ld=%s", tindex, s);
          free (s);
          s = n;
        }
       break;
 
     case DEBUG_REGISTER:
          free (s);
          s = n;
        }
       break;
 
     case DEBUG_REGISTER:
-      stab_type = N_LSYM;
+      stab_type = N_RSYM;
       kindstr = "r";
       break;
     }
       kindstr = "r";
       break;
     }
@@ -2189,25 +2082,23 @@ stab_variable (p, name, kind, val)
   free (s);
 
   if (! stab_write_symbol (info, stab_type, 0, val, buf))
   free (s);
 
   if (! stab_write_symbol (info, stab_type, 0, val, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Start outputting a function.  */
 
 }
 
 /* Start outputting a function.  */
 
-static boolean
-stab_start_function (p, name, globalp)
-     PTR p;
-     const char *name;
-     boolean globalp;
+static bfd_boolean
+stab_start_function (void *p, const char *name, bfd_boolean globalp)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *rettype, *buf;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *rettype, *buf;
 
-  assert (info->nesting == 0 && info->fun_offset == -1);
+  if (info->nesting != 0 || info->fun_offset != -1)
+    return FALSE;
 
   rettype = stab_pop_type (info);
 
 
   rettype = stab_pop_type (info);
 
@@ -2220,21 +2111,17 @@ stab_start_function (p, name, globalp)
   info->fun_offset = info->symbols_size;
 
   if (! stab_write_symbol (info, N_FUN, 0, 0, buf))
   info->fun_offset = info->symbols_size;
 
   if (! stab_write_symbol (info, N_FUN, 0, 0, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Output a function parameter.  */
 
 }
 
 /* Output a function parameter.  */
 
-static boolean
-stab_function_parameter (p, name, kind, val)
-     PTR p;
-     const char *name;
-     enum debug_parm_kind kind;
-     bfd_vma val;
+static bfd_boolean
+stab_function_parameter (void *p, const char *name, enum debug_parm_kind kind, bfd_vma val)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
   char *s, *buf;
@@ -2274,19 +2161,17 @@ stab_function_parameter (p, name, kind, val)
   free (s);
 
   if (! stab_write_symbol (info, stab_type, 0, val, buf))
   free (s);
 
   if (! stab_write_symbol (info, stab_type, 0, val, buf))
-    return false;
+    return FALSE;
 
   free (buf);
 
 
   free (buf);
 
-  return true;
+  return TRUE;
 }
 
 /* Start a block.  */
 
 }
 
 /* Start a block.  */
 
-static boolean
-stab_start_block (p, addr)
-     PTR p;
-     bfd_vma addr;
+static bfd_boolean
+stab_start_block (void *p, bfd_vma addr)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -2314,7 +2199,7 @@ stab_start_block (p, addr)
   if (info->nesting == 1)
     {
       info->fnaddr = addr;
   if (info->nesting == 1)
     {
       info->fnaddr = addr;
-      return true;
+      return TRUE;
     }
 
   /* We have to output the LBRAC symbol after any variables which are
     }
 
   /* We have to output the LBRAC symbol after any variables which are
@@ -2326,22 +2211,20 @@ stab_start_block (p, addr)
     {
       if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
                               (const char *) NULL))
     {
       if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
                               (const char *) NULL))
-       return false;
+       return FALSE;
     }
 
   /* Remember the address and output it later.  */
 
   info->pending_lbrac = addr - info->fnaddr;
 
     }
 
   /* Remember the address and output it later.  */
 
   info->pending_lbrac = addr - info->fnaddr;
 
-  return true;
+  return TRUE;
 }
 
 /* End a block.  */
 
 }
 
 /* End a block.  */
 
-static boolean
-stab_end_block (p, addr)
-     PTR p;
-     bfd_vma addr;
+static bfd_boolean
+stab_end_block (void *p, bfd_vma addr)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
@@ -2353,17 +2236,18 @@ stab_end_block (p, addr)
     {
       if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
                               (const char *) NULL))
     {
       if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
                               (const char *) NULL))
-       return false;
+       return FALSE;
       info->pending_lbrac = (bfd_vma) -1;
     }
 
       info->pending_lbrac = (bfd_vma) -1;
     }
 
-  assert (info->nesting > 0);
+  if (info->nesting < 1)
+    return FALSE;
 
   --info->nesting;
 
   /* We ignore the outermost block.  */
   if (info->nesting == 0)
 
   --info->nesting;
 
   /* We ignore the outermost block.  */
   if (info->nesting == 0)
-    return true;
+    return TRUE;
 
   return stab_write_symbol (info, N_RBRAC, 0, addr - info->fnaddr,
                            (const char *) NULL);
 
   return stab_write_symbol (info, N_RBRAC, 0, addr - info->fnaddr,
                            (const char *) NULL);
@@ -2371,34 +2255,29 @@ stab_end_block (p, addr)
 
 /* End a function.  */
 
 
 /* End a function.  */
 
-/*ARGSUSED*/
-static boolean
-stab_end_function (p)
-     PTR p;
+static bfd_boolean
+stab_end_function (void *p ATTRIBUTE_UNUSED)
 {
 {
-  return true;
+  return TRUE;
 }
 
 /* Output a line number.  */
 
 }
 
 /* Output a line number.  */
 
-static boolean
-stab_lineno (p, file, lineno, addr)
-     PTR p;
-     const char *file;
-     unsigned long lineno;
-     bfd_vma addr;
+static bfd_boolean
+stab_lineno (void *p, const char *file, unsigned long lineno, bfd_vma addr)
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
 {
   struct stab_write_handle *info = (struct stab_write_handle *) p;
 
-  assert (info->lineno_filename != NULL);
+  if (info->lineno_filename == NULL)
+    return FALSE;
 
   if (addr > info->last_text_address)
     info->last_text_address = addr;
 
 
   if (addr > info->last_text_address)
     info->last_text_address = addr;
 
-  if (strcmp (file, info->lineno_filename) != 0)
+  if (filename_cmp (file, info->lineno_filename) != 0)
     {
       if (! stab_write_symbol (info, N_SOL, 0, addr, file))
     {
       if (! stab_write_symbol (info, N_SOL, 0, addr, file))
-       return false;
+       return FALSE;
       info->lineno_filename = file;
     }
 
       info->lineno_filename = file;
     }
 
This page took 0.053078 seconds and 4 git commands to generate.