Back to index

cell-binutils  2.17cvs20070401
wrstabs.c
Go to the documentation of this file.
00001 /* wrstabs.c -- Output stabs debugging information
00002    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006
00003    Free Software Foundation, Inc.
00004    Written by Ian Lance Taylor <ian@cygnus.com>.
00005 
00006    This file is part of GNU Binutils.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2 of the License, or
00011    (at your option) any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
00021    02110-1301, USA.  */
00022 
00023 /* This file contains code which writes out stabs debugging
00024    information.  */
00025 
00026 #include <stdio.h>
00027 #include <assert.h>
00028 
00029 #include "bfd.h"
00030 #include "bucomm.h"
00031 #include "libiberty.h"
00032 #include "safe-ctype.h"
00033 #include "debug.h"
00034 #include "budbg.h"
00035 #include "aout/aout64.h"
00036 #include "aout/stab_gnu.h"
00037 
00038 /* The size of a stabs symbol.  This presumes 32 bit values.  */
00039 
00040 #define STAB_SYMBOL_SIZE (12)
00041 
00042 /* An entry in a string hash table.  */
00043 
00044 struct string_hash_entry
00045 {
00046   struct bfd_hash_entry root;
00047   /* Next string in this table.  */
00048   struct string_hash_entry *next;
00049   /* Index in string table.  */
00050   long index;
00051   /* Size of type if this is a typedef.  */
00052   unsigned int size;
00053 };
00054 
00055 /* A string hash table.  */
00056 
00057 struct string_hash_table
00058 {
00059   struct bfd_hash_table table;
00060 };
00061 
00062 /* The type stack.  Each element on the stack is a string.  */
00063 
00064 struct stab_type_stack
00065 {
00066   /* The next element on the stack.  */
00067   struct stab_type_stack *next;
00068   /* This element as a string.  */
00069   char *string;
00070   /* The type index of this element.  */
00071   long index;
00072   /* The size of the type.  */
00073   unsigned int size;
00074   /* Whether type string defines a new type.  */
00075   bfd_boolean definition;
00076   /* String defining struct fields.  */
00077   char *fields;
00078   /* NULL terminated array of strings defining base classes for a
00079      class.  */
00080   char **baseclasses;
00081   /* String defining class methods.  */
00082   char *methods;
00083   /* String defining vtable pointer for a class.  */
00084   char *vtable;
00085 };
00086 
00087 /* This structure is used to keep track of type indices for tagged
00088    types.  */
00089 
00090 struct stab_tag
00091 {
00092   /* The type index.  */
00093   long index;
00094   /* The tag name.  */
00095   const char *tag;
00096   /* The kind of type.  This is set to DEBUG_KIND_ILLEGAL when the
00097      type is defined.  */
00098   enum debug_type_kind kind;
00099   /* The size of the struct.  */
00100   unsigned int size;
00101 };
00102 
00103 /* We remember various sorts of type indices.  They are not related,
00104    but, for convenience, we keep all the information in this
00105    structure.  */
00106 
00107 struct stab_type_cache
00108 {
00109   /* The void type index.  */
00110   long void_type;
00111   /* Signed integer type indices, indexed by size - 1.  */
00112   long signed_integer_types[8];
00113   /* Unsigned integer type indices, indexed by size - 1.  */
00114   long unsigned_integer_types[8];
00115   /* Floating point types, indexed by size - 1.  */
00116   long float_types[16];
00117   /* Pointers to types, indexed by the type index.  */
00118   long *pointer_types;
00119   size_t pointer_types_alloc;
00120   /* Functions returning types, indexed by the type index.  */
00121   long *function_types;
00122   size_t function_types_alloc;
00123   /* References to types, indexed by the type index.  */
00124   long *reference_types;
00125   size_t reference_types_alloc;
00126   /* Struct/union/class type indices, indexed by the struct id.  */
00127   struct stab_tag *struct_types;
00128   size_t struct_types_alloc;
00129 };
00130 
00131 /* This is the handle passed through debug_write.  */
00132 
00133 struct stab_write_handle
00134 {
00135   /* The BFD.  */
00136   bfd *abfd;
00137   /* This buffer holds the symbols.  */
00138   bfd_byte *symbols;
00139   size_t symbols_size;
00140   size_t symbols_alloc;
00141   /* This is a list of hash table entries for the strings.  */
00142   struct string_hash_entry *strings;
00143   /* The last string hash table entry.  */
00144   struct string_hash_entry *last_string;
00145   /* The size of the strings.  */
00146   size_t strings_size;
00147   /* This hash table eliminates duplicate strings.  */
00148   struct string_hash_table strhash;
00149   /* The type stack.  */
00150   struct stab_type_stack *type_stack;
00151   /* The next type index.  */
00152   long type_index;
00153   /* The type cache.  */
00154   struct stab_type_cache type_cache;
00155   /* A mapping from typedef names to type indices.  */
00156   struct string_hash_table typedef_hash;
00157   /* If this is not -1, it is the offset to the most recent N_SO
00158      symbol, and the value of that symbol needs to be set.  */
00159   long so_offset;
00160   /* If this is not -1, it is the offset to the most recent N_FUN
00161      symbol, and the value of that symbol needs to be set.  */
00162   long fun_offset;
00163   /* The last text section address seen.  */
00164   bfd_vma last_text_address;
00165   /* The block nesting depth.  */
00166   unsigned int nesting;
00167   /* The function address.  */
00168   bfd_vma fnaddr;
00169   /* A pending LBRAC symbol.  */
00170   bfd_vma pending_lbrac;
00171   /* The current line number file name.  */
00172   const char *lineno_filename;
00173 };
00174 
00175 static struct bfd_hash_entry *string_hash_newfunc
00176   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
00177 static bfd_boolean stab_write_symbol
00178   (struct stab_write_handle *, int, int, bfd_vma, const char *);
00179 static bfd_boolean stab_push_string
00180   (struct stab_write_handle *, const char *, long, bfd_boolean, unsigned int);
00181 static bfd_boolean stab_push_defined_type
00182   (struct stab_write_handle *, long, unsigned int);
00183 static char *stab_pop_type (struct stab_write_handle *);
00184 static bfd_boolean stab_modify_type
00185   (struct stab_write_handle *, int, unsigned int, long **, size_t *);
00186 static long stab_get_struct_index
00187   (struct stab_write_handle *, const char *, unsigned int,
00188    enum debug_type_kind, unsigned int *);
00189 static bfd_boolean stab_class_method_var
00190   (struct stab_write_handle *, const char *, enum debug_visibility,
00191    bfd_boolean, bfd_boolean, bfd_boolean, bfd_vma, bfd_boolean);
00192 static bfd_boolean stab_start_compilation_unit (void *, const char *);
00193 static bfd_boolean stab_start_source (void *, const char *);
00194 static bfd_boolean stab_empty_type (void *);
00195 static bfd_boolean stab_void_type (void *);
00196 static bfd_boolean stab_int_type (void *, unsigned int, bfd_boolean);
00197 static bfd_boolean stab_float_type (void *, unsigned int);
00198 static bfd_boolean stab_complex_type (void *, unsigned int);
00199 static bfd_boolean stab_bool_type (void *, unsigned int);
00200 static bfd_boolean stab_enum_type
00201   (void *, const char *, const char **, bfd_signed_vma *);
00202 static bfd_boolean stab_pointer_type (void *);
00203 static bfd_boolean stab_function_type (void *, int, bfd_boolean);
00204 static bfd_boolean stab_reference_type (void *);
00205 static bfd_boolean stab_range_type (void *, bfd_signed_vma, bfd_signed_vma);
00206 static bfd_boolean stab_array_type
00207   (void *, bfd_signed_vma, bfd_signed_vma, bfd_boolean);
00208 static bfd_boolean stab_set_type (void *, bfd_boolean);
00209 static bfd_boolean stab_offset_type (void *);
00210 static bfd_boolean stab_method_type (void *, bfd_boolean, int, bfd_boolean);
00211 static bfd_boolean stab_const_type (void *);
00212 static bfd_boolean stab_volatile_type (void *);
00213 static bfd_boolean stab_start_struct_type
00214   (void *, const char *, unsigned int, bfd_boolean, unsigned int);
00215 static bfd_boolean stab_struct_field
00216   (void *, const char *, bfd_vma, bfd_vma, enum debug_visibility);
00217 static bfd_boolean stab_end_struct_type (void *);
00218 static bfd_boolean stab_start_class_type
00219   (void *, const char *, unsigned int, bfd_boolean, unsigned int,
00220    bfd_boolean, bfd_boolean);
00221 static bfd_boolean stab_class_static_member
00222   (void *, const char *, const char *, enum debug_visibility);
00223 static bfd_boolean stab_class_baseclass
00224   (void *, bfd_vma, bfd_boolean, enum debug_visibility);
00225 static bfd_boolean stab_class_start_method (void *, const char *);
00226 static bfd_boolean stab_class_method_variant
00227   (void *, const char *, enum debug_visibility, bfd_boolean, bfd_boolean,
00228    bfd_vma, bfd_boolean);
00229 static bfd_boolean stab_class_static_method_variant
00230   (void *, const char *, enum debug_visibility, bfd_boolean, bfd_boolean);
00231 static bfd_boolean stab_class_end_method (void *);
00232 static bfd_boolean stab_end_class_type (void *);
00233 static bfd_boolean stab_typedef_type (void *, const char *);
00234 static bfd_boolean stab_tag_type
00235   (void *, const char *, unsigned int, enum debug_type_kind);
00236 static bfd_boolean stab_typdef (void *, const char *);
00237 static bfd_boolean stab_tag (void *, const char *);
00238 static bfd_boolean stab_int_constant (void *, const char *, bfd_vma);
00239 static bfd_boolean stab_float_constant (void *, const char *, double);
00240 static bfd_boolean stab_typed_constant (void *, const char *, bfd_vma);
00241 static bfd_boolean stab_variable
00242   (void *, const char *, enum debug_var_kind, bfd_vma);
00243 static bfd_boolean stab_start_function (void *, const char *, bfd_boolean);
00244 static bfd_boolean stab_function_parameter
00245   (void *, const char *, enum debug_parm_kind, bfd_vma);
00246 static bfd_boolean stab_start_block (void *, bfd_vma);
00247 static bfd_boolean stab_end_block (void *, bfd_vma);
00248 static bfd_boolean stab_end_function (void *);
00249 static bfd_boolean stab_lineno (void *, const char *, unsigned long, bfd_vma);
00250 
00251 static const struct debug_write_fns stab_fns =
00252 {
00253   stab_start_compilation_unit,
00254   stab_start_source,
00255   stab_empty_type,
00256   stab_void_type,
00257   stab_int_type,
00258   stab_float_type,
00259   stab_complex_type,
00260   stab_bool_type,
00261   stab_enum_type,
00262   stab_pointer_type,
00263   stab_function_type,
00264   stab_reference_type,
00265   stab_range_type,
00266   stab_array_type,
00267   stab_set_type,
00268   stab_offset_type,
00269   stab_method_type,
00270   stab_const_type,
00271   stab_volatile_type,
00272   stab_start_struct_type,
00273   stab_struct_field,
00274   stab_end_struct_type,
00275   stab_start_class_type,
00276   stab_class_static_member,
00277   stab_class_baseclass,
00278   stab_class_start_method,
00279   stab_class_method_variant,
00280   stab_class_static_method_variant,
00281   stab_class_end_method,
00282   stab_end_class_type,
00283   stab_typedef_type,
00284   stab_tag_type,
00285   stab_typdef,
00286   stab_tag,
00287   stab_int_constant,
00288   stab_float_constant,
00289   stab_typed_constant,
00290   stab_variable,
00291   stab_start_function,
00292   stab_function_parameter,
00293   stab_start_block,
00294   stab_end_block,
00295   stab_end_function,
00296   stab_lineno
00297 };
00298 
00299 /* Routine to create an entry in a string hash table.  */
00300 
00301 static struct bfd_hash_entry *
00302 string_hash_newfunc (struct bfd_hash_entry *entry,
00303                    struct bfd_hash_table *table, const char *string)
00304 {
00305   struct string_hash_entry *ret = (struct string_hash_entry *) entry;
00306 
00307   /* Allocate the structure if it has not already been allocated by a
00308      subclass.  */
00309   if (ret == (struct string_hash_entry *) NULL)
00310     ret = ((struct string_hash_entry *)
00311           bfd_hash_allocate (table, sizeof (struct string_hash_entry)));
00312   if (ret == (struct string_hash_entry *) NULL)
00313     return NULL;
00314 
00315   /* Call the allocation method of the superclass.  */
00316   ret = ((struct string_hash_entry *)
00317         bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
00318 
00319   if (ret)
00320     {
00321       /* Initialize the local fields.  */
00322       ret->next = NULL;
00323       ret->index = -1;
00324       ret->size = 0;
00325     }
00326 
00327   return (struct bfd_hash_entry *) ret;
00328 }
00329 
00330 /* Look up an entry in a string hash table.  */
00331 
00332 #define string_hash_lookup(t, string, create, copy) \
00333   ((struct string_hash_entry *) \
00334    bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
00335 
00336 /* Add a symbol to the stabs debugging information we are building.  */
00337 
00338 static bfd_boolean
00339 stab_write_symbol (struct stab_write_handle *info, int type, int desc,
00340                  bfd_vma value, const char *string)
00341 {
00342   bfd_size_type strx;
00343   bfd_byte sym[STAB_SYMBOL_SIZE];
00344 
00345   if (string == NULL)
00346     strx = 0;
00347   else
00348     {
00349       struct string_hash_entry *h;
00350 
00351       h = string_hash_lookup (&info->strhash, string, TRUE, TRUE);
00352       if (h == NULL)
00353        {
00354          non_fatal (_("string_hash_lookup failed: %s"),
00355                    bfd_errmsg (bfd_get_error ()));
00356          return FALSE;
00357        }
00358       if (h->index != -1)
00359        strx = h->index;
00360       else
00361        {
00362          strx = info->strings_size;
00363          h->index = strx;
00364          if (info->last_string == NULL)
00365            info->strings = h;
00366          else
00367            info->last_string->next = h;
00368          info->last_string = h;
00369          info->strings_size += strlen (string) + 1;
00370        }
00371     }
00372 
00373   /* This presumes 32 bit values.  */
00374   bfd_put_32 (info->abfd, strx, sym);
00375   bfd_put_8 (info->abfd, type, sym + 4);
00376   bfd_put_8 (info->abfd, 0, sym + 5);
00377   bfd_put_16 (info->abfd, desc, sym + 6);
00378   bfd_put_32 (info->abfd, value, sym + 8);
00379 
00380   if (info->symbols_size + STAB_SYMBOL_SIZE > info->symbols_alloc)
00381     {
00382       info->symbols_alloc *= 2;
00383       info->symbols = (bfd_byte *) xrealloc (info->symbols,
00384                                         info->symbols_alloc);
00385     }
00386 
00387   memcpy (info->symbols + info->symbols_size, sym, STAB_SYMBOL_SIZE);
00388 
00389   info->symbols_size += STAB_SYMBOL_SIZE;
00390 
00391   return TRUE;
00392 }
00393 
00394 /* Push a string on to the type stack.  */
00395 
00396 static bfd_boolean
00397 stab_push_string (struct stab_write_handle *info, const char *string,
00398                 long index, bfd_boolean definition, unsigned int size)
00399 {
00400   struct stab_type_stack *s;
00401 
00402   s = (struct stab_type_stack *) xmalloc (sizeof *s);
00403   s->string = xstrdup (string);
00404   s->index = index;
00405   s->definition = definition;
00406   s->size = size;
00407 
00408   s->fields = NULL;
00409   s->baseclasses = NULL;
00410   s->methods = NULL;
00411   s->vtable = NULL;
00412 
00413   s->next = info->type_stack;
00414   info->type_stack = s;
00415 
00416   return TRUE;
00417 }
00418 
00419 /* Push a type index which has already been defined.  */
00420 
00421 static bfd_boolean
00422 stab_push_defined_type (struct stab_write_handle *info, long index,
00423                      unsigned int size)
00424 {
00425   char buf[20];
00426 
00427   sprintf (buf, "%ld", index);
00428   return stab_push_string (info, buf, index, FALSE, size);
00429 }
00430 
00431 /* Pop a type off the type stack.  The caller is responsible for
00432    freeing the string.  */
00433 
00434 static char *
00435 stab_pop_type (struct stab_write_handle *info)
00436 {
00437   struct stab_type_stack *s;
00438   char *ret;
00439 
00440   s = info->type_stack;
00441   assert (s != NULL);
00442 
00443   info->type_stack = s->next;
00444 
00445   ret = s->string;
00446 
00447   free (s);
00448 
00449   return ret;
00450 }
00451 
00452 /* The general routine to write out stabs in sections debugging
00453    information.  This accumulates the stabs symbols and the strings in
00454    two obstacks.  We can't easily write out the information as we go
00455    along, because we need to know the section sizes before we can
00456    write out the section contents.  ABFD is the BFD and DHANDLE is the
00457    handle for the debugging information.  This sets *PSYMS to point to
00458    the symbols, *PSYMSIZE the size of the symbols, *PSTRINGS to the
00459    strings, and *PSTRINGSIZE to the size of the strings.  */
00460 
00461 bfd_boolean
00462 write_stabs_in_sections_debugging_info (bfd *abfd, void *dhandle,
00463                                    bfd_byte **psyms,
00464                                    bfd_size_type *psymsize,
00465                                    bfd_byte **pstrings,
00466                                    bfd_size_type *pstringsize)
00467 {
00468   struct stab_write_handle info;
00469   struct string_hash_entry *h;
00470   bfd_byte *p;
00471 
00472   info.abfd = abfd;
00473 
00474   info.symbols_size = 0;
00475   info.symbols_alloc = 500;
00476   info.symbols = (bfd_byte *) xmalloc (info.symbols_alloc);
00477 
00478   info.strings = NULL;
00479   info.last_string = NULL;
00480   /* Reserve 1 byte for a null byte.  */
00481   info.strings_size = 1;
00482 
00483   if (!bfd_hash_table_init (&info.strhash.table, string_hash_newfunc,
00484                          sizeof (struct string_hash_entry))
00485       || !bfd_hash_table_init (&info.typedef_hash.table, string_hash_newfunc,
00486                             sizeof (struct string_hash_entry)))
00487     {
00488       non_fatal ("bfd_hash_table_init_failed: %s",
00489                bfd_errmsg (bfd_get_error ()));
00490       return FALSE;
00491     }
00492 
00493   info.type_stack = NULL;
00494   info.type_index = 1;
00495   memset (&info.type_cache, 0, sizeof info.type_cache);
00496   info.so_offset = -1;
00497   info.fun_offset = -1;
00498   info.last_text_address = 0;
00499   info.nesting = 0;
00500   info.fnaddr = 0;
00501   info.pending_lbrac = (bfd_vma) -1;
00502 
00503   /* The initial symbol holds the string size.  */
00504   if (! stab_write_symbol (&info, 0, 0, 0, (const char *) NULL))
00505     return FALSE;
00506 
00507   /* Output an initial N_SO symbol.  */
00508   info.so_offset = info.symbols_size;
00509   if (! stab_write_symbol (&info, N_SO, 0, 0, bfd_get_filename (abfd)))
00510     return FALSE;
00511 
00512   if (! debug_write (dhandle, &stab_fns, (void *) &info))
00513     return FALSE;
00514 
00515   assert (info.pending_lbrac == (bfd_vma) -1);
00516 
00517   /* Output a trailing N_SO.  */
00518   if (! stab_write_symbol (&info, N_SO, 0, info.last_text_address,
00519                         (const char *) NULL))
00520     return FALSE;
00521 
00522   /* Put the string size in the initial symbol.  */
00523   bfd_put_32 (abfd, info.strings_size, info.symbols + 8);
00524 
00525   *psyms = info.symbols;
00526   *psymsize = info.symbols_size;
00527 
00528   *pstringsize = info.strings_size;
00529   *pstrings = (bfd_byte *) xmalloc (info.strings_size);
00530 
00531   p = *pstrings;
00532   *p++ = '\0';
00533   for (h = info.strings; h != NULL; h = h->next)
00534     {
00535       strcpy ((char *) p, h->root.string);
00536       p += strlen ((char *) p) + 1;
00537     }
00538 
00539   return TRUE;
00540 }
00541 
00542 /* Start writing out information for a compilation unit.  */
00543 
00544 static bfd_boolean
00545 stab_start_compilation_unit (void *p, const char *filename)
00546 {
00547   struct stab_write_handle *info = (struct stab_write_handle *) p;
00548 
00549   /* We would normally output an N_SO symbol here.  However, that
00550      would force us to reset all of our type information.  I think we
00551      will be better off just outputting an N_SOL symbol, and not
00552      worrying about splitting information between files.  */
00553 
00554   info->lineno_filename = filename;
00555 
00556   return stab_write_symbol (info, N_SOL, 0, 0, filename);
00557 }
00558 
00559 /* Start writing out information for a particular source file.  */
00560 
00561 static bfd_boolean
00562 stab_start_source (void *p, const char *filename)
00563 {
00564   struct stab_write_handle *info = (struct stab_write_handle *) p;
00565 
00566   /* FIXME: The symbol's value is supposed to be the text section
00567      address.  However, we would have to fill it in later, and gdb
00568      doesn't care, so we don't bother with it.  */
00569 
00570   info->lineno_filename = filename;
00571 
00572   return stab_write_symbol (info, N_SOL, 0, 0, filename);
00573 }
00574 
00575 /* Push an empty type.  This shouldn't normally happen.  We just use a
00576    void type.  */
00577 
00578 static bfd_boolean
00579 stab_empty_type (void *p)
00580 {
00581   struct stab_write_handle *info = (struct stab_write_handle *) p;
00582 
00583   /* We don't call stab_void_type if the type is not yet defined,
00584      because that might screw up the typedef.  */
00585 
00586   if (info->type_cache.void_type != 0)
00587     return stab_push_defined_type (info, info->type_cache.void_type, 0);
00588   else
00589     {
00590       long index;
00591       char buf[40];
00592 
00593       index = info->type_index;
00594       ++info->type_index;
00595 
00596       sprintf (buf, "%ld=%ld", index, index);
00597 
00598       return stab_push_string (info, buf, index, FALSE, 0);
00599     }
00600 }
00601 
00602 /* Push a void type.  */
00603 
00604 static bfd_boolean
00605 stab_void_type (void *p)
00606 {
00607   struct stab_write_handle *info = (struct stab_write_handle *) p;
00608 
00609   if (info->type_cache.void_type != 0)
00610     return stab_push_defined_type (info, info->type_cache.void_type, 0);
00611   else
00612     {
00613       long index;
00614       char buf[40];
00615 
00616       index = info->type_index;
00617       ++info->type_index;
00618 
00619       info->type_cache.void_type = index;
00620 
00621       sprintf (buf, "%ld=%ld", index, index);
00622 
00623       return stab_push_string (info, buf, index, TRUE, 0);
00624     }
00625 }
00626 
00627 /* Push an integer type.  */
00628 
00629 static bfd_boolean
00630 stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp)
00631 {
00632   struct stab_write_handle *info = (struct stab_write_handle *) p;
00633   long *cache;
00634 
00635   if (size <= 0 || (size > sizeof (long) && size != 8))
00636     {
00637       non_fatal (_("stab_int_type: bad size %u"), size);
00638       return FALSE;
00639     }
00640 
00641   if (unsignedp)
00642     cache = info->type_cache.signed_integer_types;
00643   else
00644     cache = info->type_cache.unsigned_integer_types;
00645 
00646   if (cache[size - 1] != 0)
00647     return stab_push_defined_type (info, cache[size - 1], size);
00648   else
00649     {
00650       long index;
00651       char buf[100];
00652 
00653       index = info->type_index;
00654       ++info->type_index;
00655 
00656       cache[size - 1] = index;
00657 
00658       sprintf (buf, "%ld=r%ld;", index, index);
00659       if (unsignedp)
00660        {
00661          strcat (buf, "0;");
00662          if (size < sizeof (long))
00663            sprintf (buf + strlen (buf), "%ld;", ((long) 1 << (size * 8)) - 1);
00664          else if (size == sizeof (long))
00665            strcat (buf, "-1;");
00666          else if (size == 8)
00667            strcat (buf, "01777777777777777777777;");
00668          else
00669            abort ();
00670        }
00671       else
00672        {
00673          if (size <= sizeof (long))
00674            sprintf (buf + strlen (buf), "%ld;%ld;",
00675                    (long) - ((unsigned long) 1 << (size * 8 - 1)),
00676                    (long) (((unsigned long) 1 << (size * 8 - 1)) - 1));
00677          else if (size == 8)
00678            strcat (buf, "01000000000000000000000;0777777777777777777777;");
00679          else
00680            abort ();
00681        }
00682 
00683       return stab_push_string (info, buf, index, TRUE, size);
00684     }
00685 }
00686 
00687 /* Push a floating point type.  */
00688 
00689 static bfd_boolean
00690 stab_float_type (void *p, unsigned int size)
00691 {
00692   struct stab_write_handle *info = (struct stab_write_handle *) p;
00693 
00694   if (size > 0
00695       && size - 1 < (sizeof info->type_cache.float_types
00696                    / sizeof info->type_cache.float_types[0])
00697       && info->type_cache.float_types[size - 1] != 0)
00698     return stab_push_defined_type (info,
00699                                info->type_cache.float_types[size - 1],
00700                                size);
00701   else
00702     {
00703       long index;
00704       char *int_type;
00705       char buf[50];
00706 
00707       /* Floats are defined as a subrange of int.  */
00708       if (! stab_int_type (info, 4, FALSE))
00709        return FALSE;
00710       int_type = stab_pop_type (info);
00711 
00712       index = info->type_index;
00713       ++info->type_index;
00714 
00715       if (size > 0
00716          && size - 1 < (sizeof info->type_cache.float_types
00717                       / sizeof info->type_cache.float_types[0]))
00718        info->type_cache.float_types[size - 1] = index;
00719 
00720       sprintf (buf, "%ld=r%s;%u;0;", index, int_type, size);
00721 
00722       free (int_type);
00723 
00724       return stab_push_string (info, buf, index, TRUE, size);
00725     }
00726 }
00727 
00728 /* Push a complex type.  */
00729 
00730 static bfd_boolean
00731 stab_complex_type (void *p, unsigned int size)
00732 {
00733   struct stab_write_handle *info = (struct stab_write_handle *) p;
00734   char buf[50];
00735   long index;
00736 
00737   index = info->type_index;
00738   ++info->type_index;
00739 
00740   sprintf (buf, "%ld=r%ld;%u;0;", index, index, size);
00741 
00742   return stab_push_string (info, buf, index, TRUE, size * 2);
00743 }
00744 
00745 /* Push a bfd_boolean type.  We use an XCOFF predefined type, since gdb
00746    always recognizes them.  */
00747 
00748 static bfd_boolean
00749 stab_bool_type (void *p, unsigned int size)
00750 {
00751   struct stab_write_handle *info = (struct stab_write_handle *) p;
00752   long index;
00753 
00754   switch (size)
00755     {
00756     case 1:
00757       index = -21;
00758       break;
00759 
00760     case 2:
00761       index = -22;
00762       break;
00763 
00764     default:
00765     case 4:
00766       index = -16;
00767       break;
00768 
00769     case 8:
00770       index = -33;
00771       break;
00772     }
00773 
00774   return stab_push_defined_type (info, index, size);
00775 }
00776 
00777 /* Push an enum type.  */
00778 
00779 static bfd_boolean
00780 stab_enum_type (void *p, const char *tag, const char **names,
00781               bfd_signed_vma *vals)
00782 {
00783   struct stab_write_handle *info = (struct stab_write_handle *) p;
00784   size_t len;
00785   const char **pn;
00786   char *buf;
00787   long index = 0;
00788   bfd_signed_vma *pv;
00789 
00790   if (names == NULL)
00791     {
00792       assert (tag != NULL);
00793 
00794       buf = (char *) xmalloc (10 + strlen (tag));
00795       sprintf (buf, "xe%s:", tag);
00796       /* FIXME: The size is just a guess.  */
00797       if (! stab_push_string (info, buf, 0, FALSE, 4))
00798        return FALSE;
00799       free (buf);
00800       return TRUE;
00801     }
00802 
00803   len = 10;
00804   if (tag != NULL)
00805     len += strlen (tag);
00806   for (pn = names; *pn != NULL; pn++)
00807     len += strlen (*pn) + 20;
00808 
00809   buf = (char *) xmalloc (len);
00810 
00811   if (tag == NULL)
00812     strcpy (buf, "e");
00813   else
00814     {
00815       index = info->type_index;
00816       ++info->type_index;
00817       sprintf (buf, "%s:T%ld=e", tag, index);
00818     }
00819 
00820   for (pn = names, pv = vals; *pn != NULL; pn++, pv++)
00821     sprintf (buf + strlen (buf), "%s:%ld,", *pn, (long) *pv);
00822   strcat (buf, ";");
00823 
00824   if (tag == NULL)
00825     {
00826       /* FIXME: The size is just a guess.  */
00827       if (! stab_push_string (info, buf, 0, FALSE, 4))
00828        return FALSE;
00829     }
00830   else
00831     {
00832       /* FIXME: The size is just a guess.  */
00833       if (! stab_write_symbol (info, N_LSYM, 0, 0, buf)
00834          || ! stab_push_defined_type (info, index, 4))
00835        return FALSE;
00836     }
00837 
00838   free (buf);
00839 
00840   return TRUE;
00841 }
00842 
00843 /* Push a modification of the top type on the stack.  Cache the
00844    results in CACHE and CACHE_ALLOC.  */
00845 
00846 static bfd_boolean
00847 stab_modify_type (struct stab_write_handle *info, int mod,
00848                 unsigned int size, long **cache, size_t *cache_alloc)
00849 {
00850   long targindex;
00851   long index;
00852   char *s, *buf;
00853 
00854   assert (info->type_stack != NULL);
00855   targindex = info->type_stack->index;
00856 
00857   if (targindex <= 0
00858       || cache == NULL)
00859     {
00860       bfd_boolean definition;
00861 
00862       /* Either the target type has no index, or we aren't caching
00863          this modifier.  Either way we have no way of recording the
00864          new type, so we don't bother to define one.  */
00865       definition = info->type_stack->definition;
00866       s = stab_pop_type (info);
00867       buf = (char *) xmalloc (strlen (s) + 2);
00868       sprintf (buf, "%c%s", mod, s);
00869       free (s);
00870       if (! stab_push_string (info, buf, 0, definition, size))
00871        return FALSE;
00872       free (buf);
00873     }
00874   else
00875     {
00876       if ((size_t) targindex >= *cache_alloc)
00877        {
00878          size_t alloc;
00879 
00880          alloc = *cache_alloc;
00881          if (alloc == 0)
00882            alloc = 10;
00883          while ((size_t) targindex >= alloc)
00884            alloc *= 2;
00885          *cache = (long *) xrealloc (*cache, alloc * sizeof (long));
00886          memset (*cache + *cache_alloc, 0,
00887                 (alloc - *cache_alloc) * sizeof (long));
00888          *cache_alloc = alloc;
00889        }
00890 
00891       index = (*cache)[targindex];
00892       if (index != 0 && ! info->type_stack->definition)
00893        {
00894          /* We have already defined a modification of this type, and
00895              the entry on the type stack is not a definition, so we
00896              can safely discard it (we may have a definition on the
00897              stack, even if we already defined a modification, if it
00898              is a struct which we did not define at the time it was
00899              referenced).  */
00900          free (stab_pop_type (info));
00901          if (! stab_push_defined_type (info, index, size))
00902            return FALSE;
00903        }
00904       else
00905        {
00906          index = info->type_index;
00907          ++info->type_index;
00908 
00909          s = stab_pop_type (info);
00910          buf = (char *) xmalloc (strlen (s) + 20);
00911          sprintf (buf, "%ld=%c%s", index, mod, s);
00912          free (s);
00913 
00914          (*cache)[targindex] = index;
00915 
00916          if (! stab_push_string (info, buf, index, TRUE, size))
00917            return FALSE;
00918 
00919          free (buf);
00920        }
00921     }
00922 
00923   return TRUE;
00924 }
00925 
00926 /* Push a pointer type.  */
00927 
00928 static bfd_boolean
00929 stab_pointer_type (void *p)
00930 {
00931   struct stab_write_handle *info = (struct stab_write_handle *) p;
00932 
00933   /* FIXME: The size should depend upon the architecture.  */
00934   return stab_modify_type (info, '*', 4, &info->type_cache.pointer_types,
00935                         &info->type_cache.pointer_types_alloc);
00936 }
00937 
00938 /* Push a function type.  */
00939 
00940 static bfd_boolean
00941 stab_function_type (void *p, int argcount,
00942                   bfd_boolean varargs ATTRIBUTE_UNUSED)
00943 {
00944   struct stab_write_handle *info = (struct stab_write_handle *) p;
00945   int i;
00946 
00947   /* We have no way to represent the argument types, so we just
00948      discard them.  However, if they define new types, we must output
00949      them.  We do this by producing empty typedefs.  */
00950   for (i = 0; i < argcount; i++)
00951     {
00952       if (! info->type_stack->definition)
00953        free (stab_pop_type (info));
00954       else
00955        {
00956          char *s, *buf;
00957 
00958          s = stab_pop_type (info);
00959 
00960          buf = (char *) xmalloc (strlen (s) + 3);
00961          sprintf (buf, ":t%s", s);
00962          free (s);
00963 
00964          if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
00965            return FALSE;
00966 
00967          free (buf);
00968        }
00969     }
00970 
00971   return stab_modify_type (info, 'f', 0, &info->type_cache.function_types,
00972                         &info->type_cache.function_types_alloc);
00973 }
00974 
00975 /* Push a reference type.  */
00976 
00977 static bfd_boolean
00978 stab_reference_type (void *p)
00979 {
00980   struct stab_write_handle *info = (struct stab_write_handle *) p;
00981 
00982   /* FIXME: The size should depend upon the architecture.  */
00983   return stab_modify_type (info, '&', 4, &info->type_cache.reference_types,
00984                         &info->type_cache.reference_types_alloc);
00985 }
00986 
00987 /* Push a range type.  */
00988 
00989 static bfd_boolean
00990 stab_range_type (void *p, bfd_signed_vma low, bfd_signed_vma high)
00991 {
00992   struct stab_write_handle *info = (struct stab_write_handle *) p;
00993   bfd_boolean definition;
00994   unsigned int size;
00995   char *s, *buf;
00996 
00997   definition = info->type_stack->definition;
00998   size = info->type_stack->size;
00999 
01000   s = stab_pop_type (info);
01001   buf = (char *) xmalloc (strlen (s) + 100);
01002   sprintf (buf, "r%s;%ld;%ld;", s, (long) low, (long) high);
01003   free (s);
01004 
01005   if (! stab_push_string (info, buf, 0, definition, size))
01006     return FALSE;
01007 
01008   free (buf);
01009 
01010   return TRUE;
01011 }
01012 
01013 /* Push an array type.  */
01014 
01015 static bfd_boolean
01016 stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
01017                bfd_boolean stringp)
01018 {
01019   struct stab_write_handle *info = (struct stab_write_handle *) p;
01020   bfd_boolean definition;
01021   unsigned int element_size;
01022   char *range, *element, *buf;
01023   long index;
01024   unsigned int size;
01025 
01026   definition = info->type_stack->definition;
01027   range = stab_pop_type (info);
01028 
01029   definition = definition || info->type_stack->definition;
01030   element_size = info->type_stack->size;
01031   element = stab_pop_type (info);
01032 
01033   buf = (char *) xmalloc (strlen (range) + strlen (element) + 100);
01034 
01035   if (! stringp)
01036     {
01037       index = 0;
01038       *buf = '\0';
01039     }
01040   else
01041     {
01042       /* We need to define a type in order to include the string
01043          attribute.  */
01044       index = info->type_index;
01045       ++info->type_index;
01046       definition = TRUE;
01047       sprintf (buf, "%ld=@S;", index);
01048     }
01049 
01050   sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s",
01051           range, (long) low, (long) high, element);
01052   free (range);
01053   free (element);
01054 
01055   if (high < low)
01056     size = 0;
01057   else
01058     size = element_size * ((high - low) + 1);
01059   if (! stab_push_string (info, buf, index, definition, size))
01060     return FALSE;
01061 
01062   free (buf);
01063 
01064   return TRUE;
01065 }
01066 
01067 /* Push a set type.  */
01068 
01069 static bfd_boolean
01070 stab_set_type (void *p, bfd_boolean bitstringp)
01071 {
01072   struct stab_write_handle *info = (struct stab_write_handle *) p;
01073   bfd_boolean definition;
01074   char *s, *buf;
01075   long index;
01076 
01077   definition = info->type_stack->definition;
01078 
01079   s = stab_pop_type (info);
01080   buf = (char *) xmalloc (strlen (s) + 30);
01081 
01082   if (! bitstringp)
01083     {
01084       *buf = '\0';
01085       index = 0;
01086     }
01087   else
01088     {
01089       /* We need to define a type in order to include the string
01090          attribute.  */
01091       index = info->type_index;
01092       ++info->type_index;
01093       definition = TRUE;
01094       sprintf (buf, "%ld=@S;", index);
01095     }
01096 
01097   sprintf (buf + strlen (buf), "S%s", s);
01098   free (s);
01099 
01100   if (! stab_push_string (info, buf, index, definition, 0))
01101     return FALSE;
01102 
01103   free (buf);
01104 
01105   return TRUE;
01106 }
01107 
01108 /* Push an offset type.  */
01109 
01110 static bfd_boolean
01111 stab_offset_type (void *p)
01112 {
01113   struct stab_write_handle *info = (struct stab_write_handle *) p;
01114   bfd_boolean definition;
01115   char *target, *base, *buf;
01116 
01117   definition = info->type_stack->definition;
01118   target = stab_pop_type (info);
01119 
01120   definition = definition || info->type_stack->definition;
01121   base = stab_pop_type (info);
01122 
01123   buf = (char *) xmalloc (strlen (target) + strlen (base) + 3);
01124   sprintf (buf, "@%s,%s", base, target);
01125   free (base);
01126   free (target);
01127 
01128   if (! stab_push_string (info, buf, 0, definition, 0))
01129     return FALSE;
01130 
01131   free (buf);
01132 
01133   return TRUE;
01134 }
01135 
01136 /* Push a method type.  */
01137 
01138 static bfd_boolean
01139 stab_method_type (void *p, bfd_boolean domainp, int argcount,
01140                 bfd_boolean varargs)
01141 {
01142   struct stab_write_handle *info = (struct stab_write_handle *) p;
01143   bfd_boolean definition;
01144   char *domain, *return_type, *buf;
01145   char **args;
01146   int i;
01147   size_t len;
01148 
01149   /* We don't bother with stub method types, because that would
01150      require a mangler for C++ argument types.  This will waste space
01151      in the debugging output.  */
01152 
01153   /* We need a domain.  I'm not sure DOMAINP can ever be false,
01154      anyhow.  */
01155   if (! domainp)
01156     {
01157       if (! stab_empty_type (p))
01158        return FALSE;
01159     }
01160 
01161   definition = info->type_stack->definition;
01162   domain = stab_pop_type (info);
01163 
01164   /* A non-varargs function is indicated by making the last parameter
01165      type be void.  */
01166 
01167   if (argcount < 0)
01168     {
01169       args = NULL;
01170       argcount = 0;
01171     }
01172   else if (argcount == 0)
01173     {
01174       if (varargs)
01175        args = NULL;
01176       else
01177        {
01178          args = (char **) xmalloc (1 * sizeof (*args));
01179          if (! stab_empty_type (p))
01180            return FALSE;
01181          definition = definition || info->type_stack->definition;
01182          args[0] = stab_pop_type (info);
01183          argcount = 1;
01184        }
01185     }
01186   else
01187     {
01188       args = (char **) xmalloc ((argcount + 1) * sizeof (*args));
01189       for (i = argcount - 1; i >= 0; i--)
01190        {
01191          definition = definition || info->type_stack->definition;
01192          args[i] = stab_pop_type (info);
01193        }
01194       if (! varargs)
01195        {
01196          if (! stab_empty_type (p))
01197            return FALSE;
01198          definition = definition || info->type_stack->definition;
01199          args[argcount] = stab_pop_type (info);
01200          ++argcount;
01201        }
01202     }
01203 
01204   definition = definition || info->type_stack->definition;
01205   return_type = stab_pop_type (info);
01206 
01207   len = strlen (domain) + strlen (return_type) + 10;
01208   for (i = 0; i < argcount; i++)
01209     len += strlen (args[i]);
01210 
01211   buf = (char *) xmalloc (len);
01212 
01213   sprintf (buf, "#%s,%s", domain, return_type);
01214   free (domain);
01215   free (return_type);
01216   for (i = 0; i < argcount; i++)
01217     {
01218       strcat (buf, ",");
01219       strcat (buf, args[i]);
01220       free (args[i]);
01221     }
01222   strcat (buf, ";");
01223 
01224   if (args != NULL)
01225     free (args);
01226 
01227   if (! stab_push_string (info, buf, 0, definition, 0))
01228     return FALSE;
01229 
01230   free (buf);
01231 
01232   return TRUE;
01233 }
01234 
01235 /* Push a const version of a type.  */
01236 
01237 static bfd_boolean
01238 stab_const_type (void *p)
01239 {
01240   struct stab_write_handle *info = (struct stab_write_handle *) p;
01241 
01242   return stab_modify_type (info, 'k', info->type_stack->size,
01243                         (long **) NULL, (size_t *) NULL);
01244 }
01245 
01246 /* Push a volatile version of a type.  */
01247 
01248 static bfd_boolean
01249 stab_volatile_type (void *p)
01250 {
01251   struct stab_write_handle *info = (struct stab_write_handle *) p;
01252 
01253   return stab_modify_type (info, 'B', info->type_stack->size,
01254                         (long **) NULL, (size_t *) NULL);
01255 }
01256 
01257 /* Get the type index to use for a struct/union/class ID.  This should
01258    return -1 if it fails.  */
01259 
01260 static long
01261 stab_get_struct_index (struct stab_write_handle *info, const char *tag,
01262                      unsigned int id, enum debug_type_kind kind,
01263                      unsigned int *psize)
01264 {
01265   if (id >= info->type_cache.struct_types_alloc)
01266     {
01267       size_t alloc;
01268 
01269       alloc = info->type_cache.struct_types_alloc;
01270       if (alloc == 0)
01271        alloc = 10;
01272       while (id >= alloc)
01273        alloc *= 2;
01274       info->type_cache.struct_types =
01275        (struct stab_tag *) xrealloc (info->type_cache.struct_types,
01276                                   alloc * sizeof (struct stab_tag));
01277       memset ((info->type_cache.struct_types
01278               + info->type_cache.struct_types_alloc),
01279              0,
01280              ((alloc - info->type_cache.struct_types_alloc)
01281               * sizeof (struct stab_tag)));
01282       info->type_cache.struct_types_alloc = alloc;
01283     }
01284 
01285   if (info->type_cache.struct_types[id].index == 0)
01286     {
01287       info->type_cache.struct_types[id].index = info->type_index;
01288       ++info->type_index;
01289       info->type_cache.struct_types[id].tag = tag;
01290       info->type_cache.struct_types[id].kind = kind;
01291     }
01292 
01293   if (kind == DEBUG_KIND_ILLEGAL)
01294     {
01295       /* This is a definition of the struct.  */
01296       info->type_cache.struct_types[id].kind = kind;
01297       info->type_cache.struct_types[id].size = *psize;
01298     }
01299   else
01300     *psize = info->type_cache.struct_types[id].size;
01301 
01302   return info->type_cache.struct_types[id].index;
01303 }
01304 
01305 /* Start outputting a struct.  We ignore the tag, and handle it in
01306    stab_tag.  */
01307 
01308 static bfd_boolean
01309 stab_start_struct_type (void *p, const char *tag, unsigned int id,
01310                      bfd_boolean structp, unsigned int size)
01311 {
01312   struct stab_write_handle *info = (struct stab_write_handle *) p;
01313   long index;
01314   bfd_boolean definition;
01315   char *buf;
01316 
01317   buf = (char *) xmalloc (40);
01318 
01319   if (id == 0)
01320     {
01321       index = 0;
01322       *buf = '\0';
01323       definition = FALSE;
01324     }
01325   else
01326     {
01327       index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
01328                                  &size);
01329       if (index < 0)
01330        return FALSE;
01331       sprintf (buf, "%ld=", index);
01332       definition = TRUE;
01333     }
01334 
01335   sprintf (buf + strlen (buf), "%c%u",
01336           structp ? 's' : 'u',
01337           size);
01338 
01339   if (! stab_push_string (info, buf, index, definition, size))
01340     return FALSE;
01341 
01342   info->type_stack->fields = (char *) xmalloc (1);
01343   info->type_stack->fields[0] = '\0';
01344 
01345   return TRUE;
01346 }
01347 
01348 /* Add a field to a struct.  */
01349 
01350 static bfd_boolean
01351 stab_struct_field (void *p, const char *name, bfd_vma bitpos,
01352                  bfd_vma bitsize, enum debug_visibility visibility)
01353 {
01354   struct stab_write_handle *info = (struct stab_write_handle *) p;
01355   bfd_boolean definition;
01356   unsigned int size;
01357   char *s, *n;
01358   const char *vis;
01359 
01360   definition = info->type_stack->definition;
01361   size = info->type_stack->size;
01362   s = stab_pop_type (info);
01363 
01364   /* Add this field to the end of the current struct fields, which is
01365      currently on the top of the stack.  */
01366 
01367   assert (info->type_stack->fields != NULL);
01368   n = (char *) xmalloc (strlen (info->type_stack->fields)
01369                      + strlen (name)
01370                      + strlen (s)
01371                      + 50);
01372 
01373   switch (visibility)
01374     {
01375     default:
01376       abort ();
01377 
01378     case DEBUG_VISIBILITY_PUBLIC:
01379       vis = "";
01380       break;
01381 
01382     case DEBUG_VISIBILITY_PRIVATE:
01383       vis = "/0";
01384       break;
01385 
01386     case DEBUG_VISIBILITY_PROTECTED:
01387       vis = "/1";
01388       break;
01389     }
01390 
01391   if (bitsize == 0)
01392     {
01393       bitsize = size * 8;
01394       if (bitsize == 0)
01395        non_fatal (_("%s: warning: unknown size for field `%s' in struct"),
01396                  bfd_get_filename (info->abfd), name);
01397     }
01398 
01399   sprintf (n, "%s%s:%s%s,%ld,%ld;", info->type_stack->fields, name, vis, s,
01400           (long) bitpos, (long) bitsize);
01401 
01402   free (info->type_stack->fields);
01403   info->type_stack->fields = n;
01404 
01405   if (definition)
01406     info->type_stack->definition = TRUE;
01407 
01408   return TRUE;
01409 }
01410 
01411 /* Finish up a struct.  */
01412 
01413 static bfd_boolean
01414 stab_end_struct_type (void *p)
01415 {
01416   struct stab_write_handle *info = (struct stab_write_handle *) p;
01417   bfd_boolean definition;
01418   long index;
01419   unsigned int size;
01420   char *fields, *first, *buf;
01421 
01422   assert (info->type_stack != NULL && info->type_stack->fields != NULL);
01423 
01424   definition = info->type_stack->definition;
01425   index = info->type_stack->index;
01426   size = info->type_stack->size;
01427   fields = info->type_stack->fields;
01428   first = stab_pop_type (info);
01429 
01430   buf = (char *) xmalloc (strlen (first) + strlen (fields) + 2);
01431   sprintf (buf, "%s%s;", first, fields);
01432   free (first);
01433   free (fields);
01434 
01435   if (! stab_push_string (info, buf, index, definition, size))
01436     return FALSE;
01437 
01438   free (buf);
01439 
01440   return TRUE;
01441 }
01442 
01443 /* Start outputting a class.  */
01444 
01445 static bfd_boolean
01446 stab_start_class_type (void *p, const char *tag, unsigned int id, bfd_boolean structp, unsigned int size, bfd_boolean vptr, bfd_boolean ownvptr)
01447 {
01448   struct stab_write_handle *info = (struct stab_write_handle *) p;
01449   bfd_boolean definition;
01450   char *vstring;
01451 
01452   if (! vptr || ownvptr)
01453     {
01454       definition = FALSE;
01455       vstring = NULL;
01456     }
01457   else
01458     {
01459       definition = info->type_stack->definition;
01460       vstring = stab_pop_type (info);
01461     }
01462 
01463   if (! stab_start_struct_type (p, tag, id, structp, size))
01464     return FALSE;
01465 
01466   if (vptr)
01467     {
01468       char *vtable;
01469 
01470       if (ownvptr)
01471        {
01472          assert (info->type_stack->index > 0);
01473          vtable = (char *) xmalloc (20);
01474          sprintf (vtable, "~%%%ld", info->type_stack->index);
01475        }
01476       else
01477        {
01478          vtable = (char *) xmalloc (strlen (vstring) + 3);
01479          sprintf (vtable, "~%%%s", vstring);
01480          free (vstring);
01481        }
01482 
01483       info->type_stack->vtable = vtable;
01484     }
01485 
01486   if (definition)
01487     info->type_stack->definition = TRUE;
01488 
01489   return TRUE;
01490 }
01491 
01492 /* Add a static member to the class on the type stack.  */
01493 
01494 static bfd_boolean
01495 stab_class_static_member (void *p, const char *name, const char *physname,
01496                        enum debug_visibility visibility)
01497 {
01498   struct stab_write_handle *info = (struct stab_write_handle *) p;
01499   bfd_boolean definition;
01500   char *s, *n;
01501   const char *vis;
01502 
01503   definition = info->type_stack->definition;
01504   s = stab_pop_type (info);
01505 
01506   /* Add this field to the end of the current struct fields, which is
01507      currently on the top of the stack.  */
01508 
01509   assert (info->type_stack->fields != NULL);
01510   n = (char *) xmalloc (strlen (info->type_stack->fields)
01511                      + strlen (name)
01512                      + strlen (s)
01513                      + strlen (physname)
01514                      + 10);
01515 
01516   switch (visibility)
01517     {
01518     default:
01519       abort ();
01520 
01521     case DEBUG_VISIBILITY_PUBLIC:
01522       vis = "";
01523       break;
01524 
01525     case DEBUG_VISIBILITY_PRIVATE:
01526       vis = "/0";
01527       break;
01528 
01529     case DEBUG_VISIBILITY_PROTECTED:
01530       vis = "/1";
01531       break;
01532     }
01533 
01534   sprintf (n, "%s%s:%s%s:%s;", info->type_stack->fields, name, vis, s,
01535           physname);
01536 
01537   free (info->type_stack->fields);
01538   info->type_stack->fields = n;
01539 
01540   if (definition)
01541     info->type_stack->definition = TRUE;
01542 
01543   return TRUE;
01544 }
01545 
01546 /* Add a base class to the class on the type stack.  */
01547 
01548 static bfd_boolean
01549 stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual,
01550                     enum debug_visibility visibility)
01551 {
01552   struct stab_write_handle *info = (struct stab_write_handle *) p;
01553   bfd_boolean definition;
01554   char *s;
01555   char *buf;
01556   unsigned int c;
01557   char **baseclasses;
01558 
01559   definition = info->type_stack->definition;
01560   s = stab_pop_type (info);
01561 
01562   /* Build the base class specifier.  */
01563 
01564   buf = (char *) xmalloc (strlen (s) + 25);
01565   buf[0] = virtual ? '1' : '0';
01566   switch (visibility)
01567     {
01568     default:
01569       abort ();
01570 
01571     case DEBUG_VISIBILITY_PRIVATE:
01572       buf[1] = '0';
01573       break;
01574 
01575     case DEBUG_VISIBILITY_PROTECTED:
01576       buf[1] = '1';
01577       break;
01578 
01579     case DEBUG_VISIBILITY_PUBLIC:
01580       buf[1] = '2';
01581       break;
01582     }
01583 
01584   sprintf (buf + 2, "%ld,%s;", (long) bitpos, s);
01585   free (s);
01586 
01587   /* Add the new baseclass to the existing ones.  */
01588 
01589   assert (info->type_stack != NULL && info->type_stack->fields != NULL);
01590 
01591   if (info->type_stack->baseclasses == NULL)
01592     c = 0;
01593   else
01594     {
01595       c = 0;
01596       while (info->type_stack->baseclasses[c] != NULL)
01597        ++c;
01598     }
01599 
01600   baseclasses = (char **) xrealloc (info->type_stack->baseclasses,
01601                                 (c + 2) * sizeof (*baseclasses));
01602   baseclasses[c] = buf;
01603   baseclasses[c + 1] = NULL;
01604 
01605   info->type_stack->baseclasses = baseclasses;
01606 
01607   if (definition)
01608     info->type_stack->definition = TRUE;
01609 
01610   return TRUE;
01611 }
01612 
01613 /* Start adding a method to the class on the type stack.  */
01614 
01615 static bfd_boolean
01616 stab_class_start_method (void *p, const char *name)
01617 {
01618   struct stab_write_handle *info = (struct stab_write_handle *) p;
01619   char *m;
01620 
01621   assert (info->type_stack != NULL && info->type_stack->fields != NULL);
01622 
01623   if (info->type_stack->methods == NULL)
01624     {
01625       m = (char *) xmalloc (strlen (name) + 3);
01626       *m = '\0';
01627     }
01628   else
01629     {
01630       m = (char *) xrealloc (info->type_stack->methods,
01631                           (strlen (info->type_stack->methods)
01632                            + strlen (name)
01633                            + 4));
01634     }
01635 
01636   sprintf (m + strlen (m), "%s::", name);
01637 
01638   info->type_stack->methods = m;
01639 
01640   return TRUE;
01641 }
01642 
01643 /* Add a variant, either static or not, to the current method.  */
01644 
01645 static bfd_boolean
01646 stab_class_method_var (struct stab_write_handle *info, const char *physname,
01647                      enum debug_visibility visibility,
01648                      bfd_boolean staticp, bfd_boolean constp,
01649                      bfd_boolean volatilep, bfd_vma voffset,
01650                      bfd_boolean contextp)
01651 {
01652   bfd_boolean definition;
01653   char *type;
01654   char *context = NULL;
01655   char visc, qualc, typec;
01656 
01657   definition = info->type_stack->definition;
01658   type = stab_pop_type (info);
01659 
01660   if (contextp)
01661     {
01662       definition = definition || info->type_stack->definition;
01663       context = stab_pop_type (info);
01664     }
01665 
01666   assert (info->type_stack != NULL && info->type_stack->methods != NULL);
01667 
01668   switch (visibility)
01669     {
01670     default:
01671       abort ();
01672 
01673     case DEBUG_VISIBILITY_PRIVATE:
01674       visc = '0';
01675       break;
01676 
01677     case DEBUG_VISIBILITY_PROTECTED:
01678       visc = '1';
01679       break;
01680 
01681     case DEBUG_VISIBILITY_PUBLIC:
01682       visc = '2';
01683       break;
01684     }
01685 
01686   if (constp)
01687     {
01688       if (volatilep)
01689        qualc = 'D';
01690       else
01691        qualc = 'B';
01692     }
01693   else
01694     {
01695       if (volatilep)
01696        qualc = 'C';
01697       else
01698        qualc = 'A';
01699     }
01700 
01701   if (staticp)
01702     typec = '?';
01703   else if (! contextp)
01704     typec = '.';
01705   else
01706     typec = '*';
01707 
01708   info->type_stack->methods =
01709     (char *) xrealloc (info->type_stack->methods,
01710                      (strlen (info->type_stack->methods)
01711                      + strlen (type)
01712                      + strlen (physname)
01713                      + (contextp ? strlen (context) : 0)
01714                      + 40));
01715 
01716   sprintf (info->type_stack->methods + strlen (info->type_stack->methods),
01717           "%s:%s;%c%c%c", type, physname, visc, qualc, typec);
01718   free (type);
01719 
01720   if (contextp)
01721     {
01722       sprintf (info->type_stack->methods + strlen (info->type_stack->methods),
01723               "%ld;%s;", (long) voffset, context);
01724       free (context);
01725     }
01726 
01727   if (definition)
01728     info->type_stack->definition = TRUE;
01729 
01730   return TRUE;
01731 }
01732 
01733 /* Add a variant to the current method.  */
01734 
01735 static bfd_boolean
01736 stab_class_method_variant (void *p, const char *physname,
01737                         enum debug_visibility visibility,
01738                         bfd_boolean constp, bfd_boolean volatilep,
01739                         bfd_vma voffset, bfd_boolean contextp)
01740 {
01741   struct stab_write_handle *info = (struct stab_write_handle *) p;
01742 
01743   return stab_class_method_var (info, physname, visibility, FALSE, constp,
01744                             volatilep, voffset, contextp);
01745 }
01746 
01747 /* Add a static variant to the current method.  */
01748 
01749 static bfd_boolean
01750 stab_class_static_method_variant (void *p, const char *physname,
01751                               enum debug_visibility visibility,
01752                               bfd_boolean constp, bfd_boolean volatilep)
01753 {
01754   struct stab_write_handle *info = (struct stab_write_handle *) p;
01755 
01756   return stab_class_method_var (info, physname, visibility, TRUE, constp,
01757                             volatilep, 0, FALSE);
01758 }
01759 
01760 /* Finish up a method.  */
01761 
01762 static bfd_boolean
01763 stab_class_end_method (void *p)
01764 {
01765   struct stab_write_handle *info = (struct stab_write_handle *) p;
01766 
01767   assert (info->type_stack != NULL && info->type_stack->methods != NULL);
01768 
01769   /* We allocated enough room on info->type_stack->methods to add the
01770      trailing semicolon.  */
01771   strcat (info->type_stack->methods, ";");
01772 
01773   return TRUE;
01774 }
01775 
01776 /* Finish up a class.  */
01777 
01778 static bfd_boolean
01779 stab_end_class_type (void *p)
01780 {
01781   struct stab_write_handle *info = (struct stab_write_handle *) p;
01782   size_t len;
01783   unsigned int i = 0;
01784   char *buf;
01785 
01786   assert (info->type_stack != NULL && info->type_stack->fields != NULL);
01787 
01788   /* Work out the size we need to allocate for the class definition.  */
01789 
01790   len = (strlen (info->type_stack->string)
01791         + strlen (info->type_stack->fields)
01792         + 10);
01793   if (info->type_stack->baseclasses != NULL)
01794     {
01795       len += 20;
01796       for (i = 0; info->type_stack->baseclasses[i] != NULL; i++)
01797        len += strlen (info->type_stack->baseclasses[i]);
01798     }
01799   if (info->type_stack->methods != NULL)
01800     len += strlen (info->type_stack->methods);
01801   if (info->type_stack->vtable != NULL)
01802     len += strlen (info->type_stack->vtable);
01803 
01804   /* Build the class definition.  */
01805 
01806   buf = (char *) xmalloc (len);
01807 
01808   strcpy (buf, info->type_stack->string);
01809 
01810   if (info->type_stack->baseclasses != NULL)
01811     {
01812       sprintf (buf + strlen (buf), "!%u,", i);
01813       for (i = 0; info->type_stack->baseclasses[i] != NULL; i++)
01814        {
01815          strcat (buf, info->type_stack->baseclasses[i]);
01816          free (info->type_stack->baseclasses[i]);
01817        }
01818       free (info->type_stack->baseclasses);
01819       info->type_stack->baseclasses = NULL;
01820     }
01821 
01822   strcat (buf, info->type_stack->fields);
01823   free (info->type_stack->fields);
01824   info->type_stack->fields = NULL;
01825 
01826   if (info->type_stack->methods != NULL)
01827     {
01828       strcat (buf, info->type_stack->methods);
01829       free (info->type_stack->methods);
01830       info->type_stack->methods = NULL;
01831     }
01832 
01833   strcat (buf, ";");
01834 
01835   if (info->type_stack->vtable != NULL)
01836     {
01837       strcat (buf, info->type_stack->vtable);
01838       free (info->type_stack->vtable);
01839       info->type_stack->vtable = NULL;
01840     }
01841 
01842   /* Replace the string on the top of the stack with the complete
01843      class definition.  */
01844   free (info->type_stack->string);
01845   info->type_stack->string = buf;
01846 
01847   return TRUE;
01848 }
01849 
01850 /* Push a typedef which was previously defined.  */
01851 
01852 static bfd_boolean
01853 stab_typedef_type (void *p, const char *name)
01854 {
01855   struct stab_write_handle *info = (struct stab_write_handle *) p;
01856   struct string_hash_entry *h;
01857 
01858   h = string_hash_lookup (&info->typedef_hash, name, FALSE, FALSE);
01859   assert (h != NULL && h->index > 0);
01860 
01861   return stab_push_defined_type (info, h->index, h->size);
01862 }
01863 
01864 /* Push a struct, union or class tag.  */
01865 
01866 static bfd_boolean
01867 stab_tag_type (void *p, const char *name, unsigned int id,
01868               enum debug_type_kind kind)
01869 {
01870   struct stab_write_handle *info = (struct stab_write_handle *) p;
01871   long index;
01872   unsigned int size = 0;
01873 
01874   index = stab_get_struct_index (info, name, id, kind, &size);
01875   if (index < 0)
01876     return FALSE;
01877 
01878   return stab_push_defined_type (info, index, size);
01879 }
01880 
01881 /* Define a typedef.  */
01882 
01883 static bfd_boolean
01884 stab_typdef (void *p, const char *name)
01885 {
01886   struct stab_write_handle *info = (struct stab_write_handle *) p;
01887   long index;
01888   unsigned int size;
01889   char *s, *buf;
01890   struct string_hash_entry *h;
01891 
01892   index = info->type_stack->index;
01893   size = info->type_stack->size;
01894   s = stab_pop_type (info);
01895 
01896   buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
01897 
01898   if (index > 0)
01899     sprintf (buf, "%s:t%s", name, s);
01900   else
01901     {
01902       index = info->type_index;
01903       ++info->type_index;
01904       sprintf (buf, "%s:t%ld=%s", name, index, s);
01905     }
01906 
01907   free (s);
01908 
01909   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
01910     return FALSE;
01911 
01912   free (buf);
01913 
01914   h = string_hash_lookup (&info->typedef_hash, name, TRUE, FALSE);
01915   if (h == NULL)
01916     {
01917       non_fatal (_("string_hash_lookup failed: %s"),
01918                bfd_errmsg (bfd_get_error ()));
01919       return FALSE;
01920     }
01921 
01922   /* I don't think we care about redefinitions.  */
01923 
01924   h->index = index;
01925   h->size = size;
01926 
01927   return TRUE;
01928 }
01929 
01930 /* Define a tag.  */
01931 
01932 static bfd_boolean
01933 stab_tag (void *p, const char *tag)
01934 {
01935   struct stab_write_handle *info = (struct stab_write_handle *) p;
01936   char *s, *buf;
01937 
01938   s = stab_pop_type (info);
01939 
01940   buf = (char *) xmalloc (strlen (tag) + strlen (s) + 3);
01941 
01942   sprintf (buf, "%s:T%s", tag, s);
01943   free (s);
01944 
01945   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
01946     return FALSE;
01947 
01948   free (buf);
01949 
01950   return TRUE;
01951 }
01952 
01953 /* Define an integer constant.  */
01954 
01955 static bfd_boolean
01956 stab_int_constant (void *p, const char *name, bfd_vma val)
01957 {
01958   struct stab_write_handle *info = (struct stab_write_handle *) p;
01959   char *buf;
01960 
01961   buf = (char *) xmalloc (strlen (name) + 20);
01962   sprintf (buf, "%s:c=i%ld", name, (long) val);
01963 
01964   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
01965     return FALSE;
01966 
01967   free (buf);
01968 
01969   return TRUE;
01970 }
01971 
01972 /* Define a floating point constant.  */
01973 
01974 static bfd_boolean
01975 stab_float_constant (void *p, const char *name, double val)
01976 {
01977   struct stab_write_handle *info = (struct stab_write_handle *) p;
01978   char *buf;
01979 
01980   buf = (char *) xmalloc (strlen (name) + 20);
01981   sprintf (buf, "%s:c=f%g", name, val);
01982 
01983   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
01984     return FALSE;
01985 
01986   free (buf);
01987 
01988   return TRUE;
01989 }
01990 
01991 /* Define a typed constant.  */
01992 
01993 static bfd_boolean
01994 stab_typed_constant (void *p, const char *name, bfd_vma val)
01995 {
01996   struct stab_write_handle *info = (struct stab_write_handle *) p;
01997   char *s, *buf;
01998 
01999   s = stab_pop_type (info);
02000 
02001   buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
02002   sprintf (buf, "%s:c=e%s,%ld", name, s, (long) val);
02003   free (s);
02004 
02005   if (! stab_write_symbol (info, N_LSYM, 0, 0, buf))
02006     return FALSE;
02007 
02008   free (buf);
02009 
02010   return TRUE;
02011 }
02012 
02013 /* Record a variable.  */
02014 
02015 static bfd_boolean
02016 stab_variable (void *p, const char *name, enum debug_var_kind kind,
02017               bfd_vma val)
02018 {
02019   struct stab_write_handle *info = (struct stab_write_handle *) p;
02020   char *s, *buf;
02021   int stab_type;
02022   const char *kindstr;
02023 
02024   s = stab_pop_type (info);
02025 
02026   switch (kind)
02027     {
02028     default:
02029       abort ();
02030 
02031     case DEBUG_GLOBAL:
02032       stab_type = N_GSYM;
02033       kindstr = "G";
02034       break;
02035 
02036     case DEBUG_STATIC:
02037       stab_type = N_STSYM;
02038       kindstr = "S";
02039       break;
02040 
02041     case DEBUG_LOCAL_STATIC:
02042       stab_type = N_STSYM;
02043       kindstr = "V";
02044       break;
02045 
02046     case DEBUG_LOCAL:
02047       stab_type = N_LSYM;
02048       kindstr = "";
02049 
02050       /* Make sure that this is a type reference or definition.  */
02051       if (! ISDIGIT (*s))
02052        {
02053          char *n;
02054          long index;
02055 
02056          index = info->type_index;
02057          ++info->type_index;
02058          n = (char *) xmalloc (strlen (s) + 20);
02059          sprintf (n, "%ld=%s", index, s);
02060          free (s);
02061          s = n;
02062        }
02063       break;
02064 
02065     case DEBUG_REGISTER:
02066       stab_type = N_RSYM;
02067       kindstr = "r";
02068       break;
02069     }
02070 
02071   buf = (char *) xmalloc (strlen (name) + strlen (s) + 3);
02072   sprintf (buf, "%s:%s%s", name, kindstr, s);
02073   free (s);
02074 
02075   if (! stab_write_symbol (info, stab_type, 0, val, buf))
02076     return FALSE;
02077 
02078   free (buf);
02079 
02080   return TRUE;
02081 }
02082 
02083 /* Start outputting a function.  */
02084 
02085 static bfd_boolean
02086 stab_start_function (void *p, const char *name, bfd_boolean globalp)
02087 {
02088   struct stab_write_handle *info = (struct stab_write_handle *) p;
02089   char *rettype, *buf;
02090 
02091   assert (info->nesting == 0 && info->fun_offset == -1);
02092 
02093   rettype = stab_pop_type (info);
02094 
02095   buf = (char *) xmalloc (strlen (name) + strlen (rettype) + 3);
02096   sprintf (buf, "%s:%c%s", name,
02097           globalp ? 'F' : 'f',
02098           rettype);
02099 
02100   /* We don't know the value now, so we set it in start_block.  */
02101   info->fun_offset = info->symbols_size;
02102 
02103   if (! stab_write_symbol (info, N_FUN, 0, 0, buf))
02104     return FALSE;
02105 
02106   free (buf);
02107 
02108   return TRUE;
02109 }
02110 
02111 /* Output a function parameter.  */
02112 
02113 static bfd_boolean
02114 stab_function_parameter (void *p, const char *name, enum debug_parm_kind kind, bfd_vma val)
02115 {
02116   struct stab_write_handle *info = (struct stab_write_handle *) p;
02117   char *s, *buf;
02118   int stab_type;
02119   char kindc;
02120 
02121   s = stab_pop_type (info);
02122 
02123   switch (kind)
02124     {
02125     default:
02126       abort ();
02127 
02128     case DEBUG_PARM_STACK:
02129       stab_type = N_PSYM;
02130       kindc = 'p';
02131       break;
02132 
02133     case DEBUG_PARM_REG:
02134       stab_type = N_RSYM;
02135       kindc = 'P';
02136       break;
02137 
02138     case DEBUG_PARM_REFERENCE:
02139       stab_type = N_PSYM;
02140       kindc = 'v';
02141       break;
02142 
02143     case DEBUG_PARM_REF_REG:
02144       stab_type = N_RSYM;
02145       kindc = 'a';
02146       break;
02147     }
02148 
02149   buf = (char *) xmalloc (strlen (name) + strlen (s) + 3);
02150   sprintf (buf, "%s:%c%s", name, kindc, s);
02151   free (s);
02152 
02153   if (! stab_write_symbol (info, stab_type, 0, val, buf))
02154     return FALSE;
02155 
02156   free (buf);
02157 
02158   return TRUE;
02159 }
02160 
02161 /* Start a block.  */
02162 
02163 static bfd_boolean
02164 stab_start_block (void *p, bfd_vma addr)
02165 {
02166   struct stab_write_handle *info = (struct stab_write_handle *) p;
02167 
02168   /* Fill in any slots which have been waiting for the first known
02169      text address.  */
02170 
02171   if (info->so_offset != -1)
02172     {
02173       bfd_put_32 (info->abfd, addr, info->symbols + info->so_offset + 8);
02174       info->so_offset = -1;
02175     }
02176 
02177   if (info->fun_offset != -1)
02178     {
02179       bfd_put_32 (info->abfd, addr, info->symbols + info->fun_offset + 8);
02180       info->fun_offset = -1;
02181     }
02182 
02183   ++info->nesting;
02184 
02185   /* We will be called with a top level block surrounding the
02186      function, but stabs information does not output that block, so we
02187      ignore it.  */
02188 
02189   if (info->nesting == 1)
02190     {
02191       info->fnaddr = addr;
02192       return TRUE;
02193     }
02194 
02195   /* We have to output the LBRAC symbol after any variables which are
02196      declared inside the block.  We postpone the LBRAC until the next
02197      start_block or end_block.  */
02198 
02199   /* If we have postponed an LBRAC, output it now.  */
02200   if (info->pending_lbrac != (bfd_vma) -1)
02201     {
02202       if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
02203                             (const char *) NULL))
02204        return FALSE;
02205     }
02206 
02207   /* Remember the address and output it later.  */
02208 
02209   info->pending_lbrac = addr - info->fnaddr;
02210 
02211   return TRUE;
02212 }
02213 
02214 /* End a block.  */
02215 
02216 static bfd_boolean
02217 stab_end_block (void *p, bfd_vma addr)
02218 {
02219   struct stab_write_handle *info = (struct stab_write_handle *) p;
02220 
02221   if (addr > info->last_text_address)
02222     info->last_text_address = addr;
02223 
02224   /* If we have postponed an LBRAC, output it now.  */
02225   if (info->pending_lbrac != (bfd_vma) -1)
02226     {
02227       if (! stab_write_symbol (info, N_LBRAC, 0, info->pending_lbrac,
02228                             (const char *) NULL))
02229        return FALSE;
02230       info->pending_lbrac = (bfd_vma) -1;
02231     }
02232 
02233   assert (info->nesting > 0);
02234 
02235   --info->nesting;
02236 
02237   /* We ignore the outermost block.  */
02238   if (info->nesting == 0)
02239     return TRUE;
02240 
02241   return stab_write_symbol (info, N_RBRAC, 0, addr - info->fnaddr,
02242                          (const char *) NULL);
02243 }
02244 
02245 /* End a function.  */
02246 
02247 static bfd_boolean
02248 stab_end_function (void *p ATTRIBUTE_UNUSED)
02249 {
02250   return TRUE;
02251 }
02252 
02253 /* Output a line number.  */
02254 
02255 static bfd_boolean
02256 stab_lineno (void *p, const char *file, unsigned long lineno, bfd_vma addr)
02257 {
02258   struct stab_write_handle *info = (struct stab_write_handle *) p;
02259 
02260   assert (info->lineno_filename != NULL);
02261 
02262   if (addr > info->last_text_address)
02263     info->last_text_address = addr;
02264 
02265   if (strcmp (file, info->lineno_filename) != 0)
02266     {
02267       if (! stab_write_symbol (info, N_SOL, 0, addr, file))
02268        return FALSE;
02269       info->lineno_filename = file;
02270     }
02271 
02272   return stab_write_symbol (info, N_SLINE, lineno, addr - info->fnaddr,
02273                          (const char *) NULL);
02274 }