Isolate STABS readers' use of the `textlow' and `texthigh' fields
[deliverable/binutils-gdb.git] / gdb / dbxread.c
index d9ad0405275d18d2e507f0a774ca79b0bd434ec0..75a1ba70f5e7518b460c43a27166792614e7bc7b 100644 (file)
@@ -1,5 +1,6 @@
 /* Read dbx symbol tables and convert to internal format, for GDB.
-   Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+   1996, 1997, 1998, 1999, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "obstack.h"
 #include "gdb_stat.h"
-#include <ctype.h>
 #include "symtab.h"
 #include "breakpoint.h"
-#include "command.h"
 #include "target.h"
 #include "gdbcore.h"           /* for bfd stuff */
 #include "libaout.h"           /* FIXME Secret internal BFD stuff for a.out */
@@ -58,6 +57,7 @@
 #include "demangle.h"
 #include "language.h"          /* Needed inside partial-stab.h */
 #include "complaints.h"
+#include "cp-abi.h"
 
 #include "aout/aout64.h"
 #include "aout/stab_gnu.h"     /* We always use GNU stabs, not native, now */
 
 struct symloc
   {
+    /* The start (inclusive) and end (exclusive) addresses for this
+       partial symtab's text.  STABS doesn't reliably give us nice
+       start and end addresses for each function.  Instead, we are
+       told the addresses of various boundary points, and we have to
+       gather those together to build ranges.  These are our running
+       best guess as to the range of text addresses for this psymtab.  */
+    CORE_ADDR textlow, texthigh;
 
     /* Offset within the file symbol table of first local symbol for this
        file.  */
@@ -105,6 +112,8 @@ struct symloc
 #define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
 #define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
 #define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
+#define TEXTLOW(p) (SYMLOC(p)->textlow)
+#define TEXTHIGH(p) (SYMLOC(p)->texthigh)
 #define SYMBOL_SIZE(p) (SYMLOC(p)->symbol_size)
 #define SYMBOL_OFFSET(p) (SYMLOC(p)->symbol_offset)
 #define STRING_OFFSET(p) (SYMLOC(p)->string_offset)
@@ -213,7 +222,8 @@ find_text_range (bfd * sym_bfd, struct objfile *objfile)
 {
   asection *sec;
   int found_any = 0;
-  CORE_ADDR start, end;
+  CORE_ADDR start = 0;
+  CORE_ADDR end = 0;
 
   for (sec = sym_bfd->sections; sec; sec = sec->next)
     if (bfd_get_section_flags (sym_bfd, sec) & SEC_CODE)
@@ -265,86 +275,61 @@ static int bincls_allocated;
 
 /* Local function prototypes */
 
-extern void _initialize_dbxread PARAMS ((void));
+extern void _initialize_dbxread (void);
 
-static void
-process_now PARAMS ((struct objfile *));
-
-static void
-free_header_files PARAMS ((void));
+static void process_now (struct objfile *);
 
-static void
-init_header_files PARAMS ((void));
+static void read_ofile_symtab (struct partial_symtab *);
 
-static void
-read_ofile_symtab PARAMS ((struct partial_symtab *));
-
-static void
-dbx_psymtab_to_symtab PARAMS ((struct partial_symtab *));
+static void dbx_psymtab_to_symtab (struct partial_symtab *);
 
-static void
-dbx_psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
+static void dbx_psymtab_to_symtab_1 (struct partial_symtab *);
 
-static void
-read_dbx_dynamic_symtab PARAMS ((struct objfile * objfile));
+static void read_dbx_dynamic_symtab (struct objfile *objfile);
 
-static void
-read_dbx_symtab PARAMS ((struct objfile *));
+static void read_dbx_symtab (struct objfile *);
 
-static void
-free_bincl_list PARAMS ((struct objfile *));
+static void free_bincl_list (struct objfile *);
 
-static struct partial_symtab *
-  find_corresponding_bincl_psymtab PARAMS ((char *, int));
+static struct partial_symtab *find_corresponding_bincl_psymtab (char *, int);
 
-static void
-add_bincl_to_list PARAMS ((struct partial_symtab *, char *, int));
+static void add_bincl_to_list (struct partial_symtab *, char *, int);
 
-static void
-init_bincl_list PARAMS ((int, struct objfile *));
+static void init_bincl_list (int, struct objfile *);
 
-static char *
-  dbx_next_symbol_text PARAMS ((struct objfile *));
+static char *dbx_next_symbol_text (struct objfile *);
 
-static void
-fill_symbuf PARAMS ((bfd *));
+static void fill_symbuf (bfd *);
 
-static void
-dbx_symfile_init PARAMS ((struct objfile *));
+static void dbx_symfile_init (struct objfile *);
 
-static void
-dbx_new_init PARAMS ((struct objfile *));
+static void dbx_new_init (struct objfile *);
 
-static void
-dbx_symfile_read PARAMS ((struct objfile *, int));
+static void dbx_symfile_read (struct objfile *, int);
 
-static void
-dbx_symfile_finish PARAMS ((struct objfile *));
+static void dbx_symfile_finish (struct objfile *);
 
-static void
-record_minimal_symbol PARAMS ((char *, CORE_ADDR, int, struct objfile *));
+static void record_minimal_symbol (char *, CORE_ADDR, int, struct objfile *);
 
-static void
-add_new_header_file PARAMS ((char *, int));
+static void add_new_header_file (char *, int);
 
-static void
-add_old_header_file PARAMS ((char *, int));
+static void add_old_header_file (char *, int);
 
-static void
-add_this_object_header_file PARAMS ((int));
+static void add_this_object_header_file (int);
 
-static struct partial_symtab *
-start_psymtab PARAMS ((struct objfile *, char *, CORE_ADDR, int,
-                      struct partial_symbol **, struct partial_symbol **));
+static struct partial_symtab *start_psymtab (struct objfile *, char *,
+                                            CORE_ADDR, int,
+                                            struct partial_symbol **,
+                                            struct partial_symbol **);
 
 /* Free up old header file tables */
 
-static void
-free_header_files ()
+void
+free_header_files (void)
 {
   if (this_object_header_files)
     {
-      free ((PTR) this_object_header_files);
+      xfree (this_object_header_files);
       this_object_header_files = NULL;
     }
   n_allocated_this_object_header_files = 0;
@@ -352,8 +337,8 @@ free_header_files ()
 
 /* Allocate new header file tables */
 
-static void
-init_header_files ()
+void
+init_header_files (void)
 {
   n_allocated_this_object_header_files = 10;
   this_object_header_files = (int *) xmalloc (10 * sizeof (int));
@@ -363,8 +348,7 @@ init_header_files ()
    at the next successive FILENUM.  */
 
 static void
-add_this_object_header_file (i)
-     int i;
+add_this_object_header_file (int i)
 {
   if (n_this_object_header_files == n_allocated_this_object_header_files)
     {
@@ -383,9 +367,7 @@ add_this_object_header_file (i)
    symbol tables for the same header file.  */
 
 static void
-add_old_header_file (name, instance)
-     char *name;
-     int instance;
+add_old_header_file (char *name, int instance)
 {
   register struct header_file *p = HEADER_FILES (current_objfile);
   register int i;
@@ -411,9 +393,7 @@ add_old_header_file (name, instance)
    so we record the file when its "begin" is seen and ignore the "end".  */
 
 static void
-add_new_header_file (name, instance)
-     char *name;
-     int instance;
+add_new_header_file (char *name, int instance)
 {
   register int i;
   register struct header_file *hfile;
@@ -456,8 +436,7 @@ add_new_header_file (name, instance)
 
 #if 0
 static struct type **
-explicit_lookup_type (real_filenum, index)
-     int real_filenum, index;
+explicit_lookup_type (int real_filenum, int index)
 {
   register struct header_file *f = &HEADER_FILES (current_objfile)[real_filenum];
 
@@ -474,11 +453,8 @@ explicit_lookup_type (real_filenum, index)
 #endif
 \f
 static void
-record_minimal_symbol (name, address, type, objfile)
-     char *name;
-     CORE_ADDR address;
-     int type;
-     struct objfile *objfile;
+record_minimal_symbol (char *name, CORE_ADDR address, int type,
+                      struct objfile *objfile)
 {
   enum minimal_symbol_type ms_type;
   int section;
@@ -488,17 +464,17 @@ record_minimal_symbol (name, address, type, objfile)
     {
     case N_TEXT | N_EXT:
       ms_type = mst_text;
-      section = SECT_OFF_TEXT;
+      section = SECT_OFF_TEXT (objfile);
       bfd_section = DBX_TEXT_SECTION (objfile);
       break;
     case N_DATA | N_EXT:
       ms_type = mst_data;
-      section = SECT_OFF_DATA;
+      section = SECT_OFF_DATA (objfile);
       bfd_section = DBX_DATA_SECTION (objfile);
       break;
     case N_BSS | N_EXT:
       ms_type = mst_bss;
-      section = SECT_OFF_BSS;
+      section = SECT_OFF_BSS (objfile);
       bfd_section = DBX_BSS_SECTION (objfile);
       break;
     case N_ABS | N_EXT:
@@ -509,7 +485,7 @@ record_minimal_symbol (name, address, type, objfile)
 #ifdef N_SETV
     case N_SETV | N_EXT:
       ms_type = mst_data;
-      section = SECT_OFF_DATA;
+      section = SECT_OFF_DATA (objfile);
       bfd_section = DBX_DATA_SECTION (objfile);
       break;
     case N_SETV:
@@ -517,7 +493,7 @@ record_minimal_symbol (name, address, type, objfile)
          of going over many .o files, it doesn't make sense to have one
          file local.  */
       ms_type = mst_file_data;
-      section = SECT_OFF_DATA;
+      section = SECT_OFF_DATA (objfile);
       bfd_section = DBX_DATA_SECTION (objfile);
       break;
 #endif
@@ -526,7 +502,7 @@ record_minimal_symbol (name, address, type, objfile)
     case N_FN:
     case N_FN_SEQ:
       ms_type = mst_file_text;
-      section = SECT_OFF_TEXT;
+      section = SECT_OFF_TEXT (objfile);
       bfd_section = DBX_TEXT_SECTION (objfile);
       break;
     case N_DATA:
@@ -544,15 +520,15 @@ record_minimal_symbol (name, address, type, objfile)
        char *tempstring = name;
        if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd))
          ++tempstring;
-       if (VTBL_PREFIX_P ((tempstring)))
+       if (is_vtable_name (tempstring))
          ms_type = mst_data;
       }
-      section = SECT_OFF_DATA;
+      section = SECT_OFF_DATA (objfile);
       bfd_section = DBX_DATA_SECTION (objfile);
       break;
     case N_BSS:
       ms_type = mst_file_bss;
-      section = SECT_OFF_BSS;
+      section = SECT_OFF_BSS (objfile);
       bfd_section = DBX_BSS_SECTION (objfile);
       break;
     default:
@@ -579,9 +555,7 @@ record_minimal_symbol (name, address, type, objfile)
    table (as opposed to a shared lib or dynamically loaded file).  */
 
 static void
-dbx_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;             /* FIXME comments above */
+dbx_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *sym_bfd;
   int val;
@@ -604,6 +578,7 @@ dbx_symfile_read (objfile, mainline)
      || (0 == strncmp (bfd_get_target (sym_bfd), "som", 3))
      || (0 == strncmp (bfd_get_target (sym_bfd), "coff", 4))
      || (0 == strncmp (bfd_get_target (sym_bfd), "pe", 2))
+     || (0 == strncmp (bfd_get_target (sym_bfd), "epoc-pe", 7))
      || (0 == strncmp (bfd_get_target (sym_bfd), "nlm", 3)));
 
   val = bfd_seek (sym_bfd, DBX_SYMTAB_OFFSET (objfile), SEEK_SET);
@@ -612,8 +587,8 @@ dbx_symfile_read (objfile, mainline)
 
   /* If we are reinitializing, or if we have never loaded syms yet, init */
   if (mainline
-      || objfile->global_psymbols.size == 0
-      || objfile->static_psymbols.size == 0)
+      || (objfile->global_psymbols.size == 0
+         &&  objfile->static_psymbols.size == 0))
     init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
 
   symbol_size = DBX_SYMBOL_SIZE (objfile);
@@ -623,7 +598,7 @@ dbx_symfile_read (objfile, mainline)
   back_to = make_cleanup (really_free_pendings, 0);
 
   init_minimal_symbol_collection ();
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  make_cleanup_discard_minimal_symbols ();
 
   /* Read stabs data from executable file and define symbols. */
 
@@ -633,6 +608,19 @@ dbx_symfile_read (objfile, mainline)
 
   read_dbx_dynamic_symtab (objfile);
 
+  /* Take the text ranges the STABS partial symbol scanner computed
+     for each of the psymtabs and convert it into the canonical form
+     for psymtabs.  */
+  {
+    struct partial_symtab *p;
+
+    ALL_OBJFILE_PSYMTABS (objfile, p)
+      {
+        p->textlow = TEXTLOW (p);
+        p->texthigh = TEXTHIGH (p);
+      }
+  }
+
   /* Install any minimal symbols that have been collected as the current
      minimal symbols for this objfile. */
 
@@ -646,8 +634,7 @@ dbx_symfile_read (objfile, mainline)
    file, e.g. a shared library).  */
 
 static void
-dbx_new_init (ignore)
-     struct objfile *ignore;
+dbx_new_init (struct objfile *ignore)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -671,8 +658,7 @@ dbx_new_init (ignore)
 #define DBX_STRINGTAB_SIZE_SIZE sizeof(long)   /* FIXME */
 
 static void
-dbx_symfile_init (objfile)
-     struct objfile *objfile;
+dbx_symfile_init (struct objfile *objfile)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -736,7 +722,7 @@ dbx_symfile_init (objfile)
        perror_with_name (name);
 
       memset ((PTR) size_temp, 0, sizeof (size_temp));
-      val = bfd_read ((PTR) size_temp, sizeof (size_temp), 1, sym_bfd);
+      val = bfd_bread ((PTR) size_temp, sizeof (size_temp), sym_bfd);
       if (val < 0)
        {
          perror_with_name (name);
@@ -775,8 +761,9 @@ dbx_symfile_init (objfile)
          val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, SEEK_SET);
          if (val < 0)
            perror_with_name (name);
-         val = bfd_read (DBX_STRINGTAB (objfile), DBX_STRINGTAB_SIZE (objfile), 1,
-                         sym_bfd);
+         val = bfd_bread (DBX_STRINGTAB (objfile),
+                          DBX_STRINGTAB_SIZE (objfile),
+                          sym_bfd);
          if (val != DBX_STRINGTAB_SIZE (objfile))
            perror_with_name (name);
        }
@@ -789,8 +776,7 @@ dbx_symfile_init (objfile)
    objfile struct from the global list of known objfiles. */
 
 static void
-dbx_symfile_finish (objfile)
-     struct objfile *objfile;
+dbx_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_stab_info != NULL)
     {
@@ -801,10 +787,10 @@ dbx_symfile_finish (objfile)
 
          while (--i >= 0)
            {
-             free (hfiles[i].name);
-             free (hfiles[i].vector);
+             xfree (hfiles[i].name);
+             xfree (hfiles[i].vector);
            }
-         free ((PTR) hfiles);
+         xfree (hfiles);
        }
       mfree (objfile->md, objfile->sym_stab_info);
     }
@@ -822,15 +808,15 @@ static int symbuf_end;
    completed after all the stabs are read.  */
 struct cont_elem
   {
-    /* sym and stabsstring for continuing information in cfront */
+    /* sym and stabstring for continuing information in cfront */
     struct symbol *sym;
     char *stabs;
-    /* state dependancies (statics that must be preserved) */
+    /* state dependencies (statics that must be preserved) */
     int sym_idx;
     int sym_end;
     int symnum;
-    int (*func) PARAMS ((struct objfile *, struct symbol *, char *));
-    /* other state dependancies include:
+    int (*func) (struct objfile *, struct symbol *, char *);
+    /* other state dependencies include:
        (assumption is that these will not change since process_now FIXME!!)
        stringtab_global
        n_stabs
@@ -845,10 +831,8 @@ static int cont_count = 0;
 /* Arrange for function F to be called with arguments SYM and P later
    in the stabs reading process.  */
 void
-process_later (sym, p, f)
-     struct symbol *sym;
-     char *p;
-     int (*f) PARAMS ((struct objfile *, struct symbol *, char *));
+process_later (struct symbol *sym, char *p,
+              int (*f) (struct objfile *, struct symbol *, char *))
 {
 
   /* Allocate more space for the deferred list.  */
@@ -877,8 +861,7 @@ process_later (sym, p, f)
 /* Call deferred funtions in CONT_LIST.  */
 
 static void
-process_now (objfile)
-     struct objfile *objfile;
+process_now (struct objfile *objfile)
 {
   int i;
   int save_symbuf_idx;
@@ -887,7 +870,7 @@ process_now (objfile)
   struct symbol *sym;
   char *stabs;
   int err;
-  int (*func) PARAMS ((struct objfile *, struct symbol *, char *));
+  int (*func) (struct objfile *, struct symbol *, char *);
 
   /* Save the state of our caller, we'll want to restore it before
      returning.  */
@@ -947,8 +930,7 @@ static unsigned int symbuf_read;
    (into the string table) but this does no harm.  */
 
 static void
-fill_symbuf (sym_bfd)
-     bfd *sym_bfd;
+fill_symbuf (bfd *sym_bfd)
 {
   unsigned int count;
   int nbytes;
@@ -972,7 +954,7 @@ fill_symbuf (sym_bfd)
        count = sizeof (symbuf);
     }
 
-  nbytes = bfd_read ((PTR) symbuf, count, 1, sym_bfd);
+  nbytes = bfd_bread ((PTR) symbuf, count, sym_bfd);
   if (nbytes < 0)
     perror_with_name (bfd_get_filename (sym_bfd));
   else if (nbytes == 0)
@@ -983,22 +965,15 @@ fill_symbuf (sym_bfd)
   symbuf_read += nbytes;
 }
 
-#define SWAP_SYMBOL(symp, abfd) \
-  { \
-    (symp)->n_strx = bfd_h_get_32(abfd,                        \
-                               (unsigned char *)&(symp)->n_strx);      \
-    (symp)->n_desc = bfd_h_get_16 (abfd,                       \
-                               (unsigned char *)&(symp)->n_desc);      \
-    (symp)->n_value = bfd_h_get_32 (abfd,                      \
-                               (unsigned char *)&(symp)->n_value);     \
-  }
-
 #define INTERNALIZE_SYMBOL(intern, extern, abfd)                       \
   {                                                                    \
     (intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type);            \
     (intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx);           \
     (intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc);           \
-    (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value);         \
+    if (bfd_get_sign_extend_vma (abfd))                                        \
+      (intern).n_value = bfd_h_get_signed_32 (abfd, (extern)->e_value);        \
+    else                                                               \
+      (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value);       \
   }
 
 /* Invariant: The symbol pointed to by symbuf_idx is the first one
@@ -1011,8 +986,7 @@ fill_symbuf (sym_bfd)
    call this function to get the continuation.  */
 
 static char *
-dbx_next_symbol_text (objfile)
-     struct objfile *objfile;
+dbx_next_symbol_text (struct objfile *objfile)
 {
   struct internal_nlist nlist;
 
@@ -1032,9 +1006,7 @@ dbx_next_symbol_text (objfile)
    allocated.  */
 
 static void
-init_bincl_list (number, objfile)
-     int number;
-     struct objfile *objfile;
+init_bincl_list (int number, struct objfile *objfile)
 {
   bincls_allocated = number;
   next_bincl = bincl_list = (struct header_file_location *)
@@ -1044,10 +1016,7 @@ init_bincl_list (number, objfile)
 /* Add a bincl to the list.  */
 
 static void
-add_bincl_to_list (pst, name, instance)
-     struct partial_symtab *pst;
-     char *name;
-     int instance;
+add_bincl_to_list (struct partial_symtab *pst, char *name, int instance)
 {
   if (next_bincl >= bincl_list + bincls_allocated)
     {
@@ -1068,9 +1037,7 @@ add_bincl_to_list (pst, name, instance)
    with that header_file_location.  */
 
 static struct partial_symtab *
-find_corresponding_bincl_psymtab (name, instance)
-     char *name;
-     int instance;
+find_corresponding_bincl_psymtab (char *name, int instance)
 {
   struct header_file_location *bincl;
 
@@ -1086,19 +1053,29 @@ find_corresponding_bincl_psymtab (name, instance)
 /* Free the storage allocated for the bincl list.  */
 
 static void
-free_bincl_list (objfile)
-     struct objfile *objfile;
+free_bincl_list (struct objfile *objfile)
 {
   mfree (objfile->md, (PTR) bincl_list);
   bincls_allocated = 0;
 }
 
+static void
+do_free_bincl_list_cleanup (void *objfile)
+{
+  free_bincl_list (objfile);
+}
+
+static struct cleanup *
+make_cleanup_free_bincl_list (struct objfile *objfile)
+{
+  return make_cleanup (do_free_bincl_list_cleanup, objfile);
+}
+
 /* Scan a SunOs dynamic symbol table for symbols of interest and
    add them to the minimal symbol table.  */
 
 static void
-read_dbx_dynamic_symtab (objfile)
-     struct objfile *objfile;
+read_dbx_dynamic_symtab (struct objfile *objfile)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
@@ -1129,7 +1106,7 @@ read_dbx_dynamic_symtab (objfile)
     return;
 
   dynsyms = (asymbol **) xmalloc (dynsym_size);
-  back_to = make_cleanup (free, dynsyms);
+  back_to = make_cleanup (xfree, dynsyms);
 
   dynsym_count = bfd_canonicalize_dynamic_symtab (abfd, dynsyms);
   if (dynsym_count < 0)
@@ -1156,17 +1133,17 @@ read_dbx_dynamic_symtab (objfile)
 
          if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
            {
-             sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+             sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
              type = N_TEXT;
            }
          else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
            {
-             sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+             sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
              type = N_DATA;
            }
          else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
            {
-             sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
+             sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
              type = N_BSS;
            }
          else
@@ -1192,7 +1169,7 @@ read_dbx_dynamic_symtab (objfile)
     }
 
   dynrels = (arelent **) xmalloc (dynrel_size);
-  make_cleanup (free, dynrels);
+  make_cleanup (xfree, dynrels);
 
   dynrel_count = bfd_canonicalize_dynamic_reloc (abfd, dynrels, dynsyms);
   if (dynrel_count < 0)
@@ -1207,7 +1184,7 @@ read_dbx_dynamic_symtab (objfile)
     {
       arelent *rel = *relptr;
       CORE_ADDR address =
-      rel->address + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+      rel->address + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 
       switch (bfd_get_arch (abfd))
        {
@@ -1240,8 +1217,7 @@ read_dbx_dynamic_symtab (objfile)
    debugging information is available. */
 
 static void
-read_dbx_symtab (objfile)
-     struct objfile *objfile;
+read_dbx_symtab (struct objfile *objfile)
 {
   register struct external_nlist *bufp = 0;    /* =0 avoids gcc -Wall glitch */
   struct internal_nlist nlist;
@@ -1294,7 +1270,7 @@ read_dbx_symtab (objfile)
 
   /* Init bincl list */
   init_bincl_list (20, objfile);
-  back_to = make_cleanup ((make_cleanup_func) free_bincl_list, objfile);
+  back_to = make_cleanup_free_bincl_list (objfile);
 
   last_source_file = NULL;
 
@@ -1381,13 +1357,13 @@ read_dbx_symtab (objfile)
       /* Don't set pst->texthigh lower than it already is.  */
       CORE_ADDR text_end =
       (lowest_text_address == (CORE_ADDR) -1
-       ? (text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT))
+       ? (text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))
        : lowest_text_address)
       + text_size;
 
       end_psymtab (pst, psymtab_include_list, includes_used,
                   symnum * symbol_size,
-                  text_end > pst->texthigh ? text_end : pst->texthigh,
+                  text_end > TEXTHIGH (pst) ? text_end : TEXTHIGH (pst),
                   dependency_list, dependencies_used, textlow_not_set);
     }
 
@@ -1403,13 +1379,9 @@ read_dbx_symtab (objfile)
 
 
 static struct partial_symtab *
-start_psymtab (objfile, filename, textlow, ldsymoff, global_syms, static_syms)
-     struct objfile *objfile;
-     char *filename;
-     CORE_ADDR textlow;
-     int ldsymoff;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
+              int ldsymoff, struct partial_symbol **global_syms,
+              struct partial_symbol **static_syms)
 {
   struct partial_symtab *result =
   start_psymtab_common (objfile, objfile->section_offsets,
@@ -1417,6 +1389,8 @@ start_psymtab (objfile, filename, textlow, ldsymoff, global_syms, static_syms)
 
   result->read_symtab_private = (char *)
     obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
+  TEXTLOW (result) = result->textlow;
+  TEXTHIGH (result) = result->texthigh;
   LDSYMOFF (result) = ldsymoff;
   result->read_symtab = dbx_psymtab_to_symtab;
   SYMBOL_SIZE (result) = symbol_size;
@@ -1442,23 +1416,17 @@ start_psymtab (objfile, filename, textlow, ldsymoff, global_syms, static_syms)
    FIXME:  List variables and peculiarities of same.  */
 
 struct partial_symtab *
-end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
-       capping_text, dependency_list, number_dependencies, textlow_not_set)
-     struct partial_symtab *pst;
-     char **include_list;
-     int num_includes;
-     int capping_symbol_offset;
-     CORE_ADDR capping_text;
-     struct partial_symtab **dependency_list;
-     int number_dependencies;
-     int textlow_not_set;
+end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
+            int capping_symbol_offset, CORE_ADDR capping_text,
+            struct partial_symtab **dependency_list, int number_dependencies,
+            int textlow_not_set)
 {
   int i;
   struct objfile *objfile = pst->objfile;
 
   if (capping_symbol_offset != -1)
     LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
-  pst->texthigh = capping_text;
+  TEXTHIGH (pst) = capping_text;
 
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
   /* Under Solaris, the N_SO symbols always have a value of 0,
@@ -1476,7 +1444,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
      a reliable texthigh by taking the address plus size of the
      last function in the file.  */
 
-  if (pst->texthigh == 0 && last_function_name)
+  if (TEXTHIGH (pst) == 0 && last_function_name)
     {
       char *p;
       int n;
@@ -1502,14 +1470,14 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
        }
 
       if (minsym)
-       pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym);
+       TEXTHIGH (pst) = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym);
 
       last_function_name = NULL;
     }
 
   /* this test will be true if the last .o file is only data */
   if (textlow_not_set)
-    pst->textlow = pst->texthigh;
+    TEXTLOW (pst) = TEXTHIGH (pst);
   else
     {
       struct partial_symtab *p1;
@@ -1522,12 +1490,12 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
 
       ALL_OBJFILE_PSYMTABS (objfile, p1)
       {
-       if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst)
+       if (TEXTHIGH (p1) == 0 && TEXTLOW (p1) != 0 && p1 != pst)
          {
-           p1->texthigh = pst->textlow;
+           TEXTHIGH (p1) = TEXTLOW (pst);
            /* if this file has only data, then make textlow match texthigh */
-           if (p1->textlow == 0)
-             p1->textlow = p1->texthigh;
+           if (TEXTLOW (p1) == 0)
+             TEXTLOW (p1) = TEXTHIGH (p1);
          }
       }
     }
@@ -1557,14 +1525,15 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
       struct partial_symtab *subpst =
       allocate_psymtab (include_list[i], objfile);
 
+      /* Copy the sesction_offsets array from the main psymtab. */
       subpst->section_offsets = pst->section_offsets;
       subpst->read_symtab_private =
        (char *) obstack_alloc (&objfile->psymbol_obstack,
                                sizeof (struct symloc));
       LDSYMOFF (subpst) =
        LDSYMLEN (subpst) =
-       subpst->textlow =
-       subpst->texthigh = 0;
+       TEXTLOW (subpst) =
+       TEXTHIGH (subpst) = 0;
 
       /* We could save slight bits of space by only making one of these,
          shared by the entire set of include files.  FIXME-someday.  */
@@ -1614,8 +1583,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
 }
 \f
 static void
-dbx_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+dbx_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -1672,8 +1640,7 @@ dbx_psymtab_to_symtab_1 (pst)
    Be verbose about it if the user wants that.  */
 
 static void
-dbx_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+dbx_psymtab_to_symtab (struct partial_symtab *pst)
 {
   bfd *sym_bfd;
 
@@ -1716,8 +1683,7 @@ dbx_psymtab_to_symtab (pst)
 /* Read in a defined section of a specific object file's symbols. */
 
 static void
-read_ofile_symtab (pst)
-     struct partial_symtab *pst;
+read_ofile_symtab (struct partial_symtab *pst)
 {
   register char *namestring;
   register struct external_nlist *bufp;
@@ -1735,8 +1701,12 @@ read_ofile_symtab (pst)
   objfile = pst->objfile;
   sym_offset = LDSYMOFF (pst);
   sym_size = LDSYMLEN (pst);
-  text_offset = pst->textlow;
-  text_size = pst->texthigh - pst->textlow;
+  text_offset = TEXTLOW (pst);
+  text_size = TEXTHIGH (pst) - TEXTLOW (pst);
+  /* This cannot be simply objfile->section_offsets because of
+     elfstab_offset_sections() which initializes the psymtab section
+     offsets information in a special way, and that is different from
+     objfile->section_offsets. */ 
   section_offsets = pst->section_offsets;
 
   current_objfile = objfile;
@@ -1783,6 +1753,9 @@ read_ofile_symtab (pst)
       /* Try to select a C++ demangling based on the compilation unit
          producer. */
 
+#if 0
+      /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
+        know whether it will use the old style or v3 mangling.  */
       if (processing_gcc_compilation)
        {
          if (AUTO_DEMANGLING)
@@ -1790,6 +1763,7 @@ read_ofile_symtab (pst)
              set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
            }
        }
+#endif
     }
   else
     {
@@ -1843,10 +1817,14 @@ read_ofile_symtab (pst)
          else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
            processing_gcc_compilation = 2;
 
+#if 0
+         /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
+            know whether it will use the old style or v3 mangling.  */
          if (AUTO_DEMANGLING)
            {
              set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
            }
+#endif
        }
       else if (type & N_EXT || type == (unsigned char) N_TEXT
               || type == (unsigned char) N_NBTEXT
@@ -1869,19 +1847,19 @@ read_ofile_symtab (pst)
 
   /* In a Solaris elf file, this variable, which comes from the
      value of the N_SO symbol, will still be 0.  Luckily, text_offset,
-     which comes from pst->textlow is correct. */
+     which comes from TEXTLOW (pst) is correct. */
   if (last_source_start_addr == 0)
     last_source_start_addr = text_offset;
 
   /* In reordered executables last_source_start_addr may not be the
      lower bound for this symtab, instead use text_offset which comes
-     from pst->textlow which is correct.  */
+     from TEXTLOW (pst) which is correct.  */
   if (last_source_start_addr > text_offset)
     last_source_start_addr = text_offset;
 
-  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT);
+  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 
-  /* Process items which we had to "process_later" due to dependancies 
+  /* Process items which we had to "process_later" due to dependencies 
      on other stabs.  */
   process_now (objfile);
 
@@ -1898,18 +1876,17 @@ read_ofile_symtab (pst)
    NAME is the symbol name, in our address space.
    SECTION_OFFSETS is a set of amounts by which the sections of this object
    file were relocated when it was loaded into memory.
+   Note that these section_offsets are not the 
+   objfile->section_offsets but the pst->section_offsets.
    All symbols that refer
    to memory locations need to be offset by these amounts.
    OBJFILE is the object file from which we are reading symbols.
    It is used in end_symtab.  */
 
 void
-process_one_symbol (type, desc, valu, name, section_offsets, objfile)
-     int type, desc;
-     CORE_ADDR valu;
-     char *name;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
+process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
+                   struct section_offsets *section_offsets,
+                   struct objfile *objfile)
 {
 #ifdef SUN_FIXED_LBRAC_BUG
   /* If SUN_FIXED_LBRAC_BUG is defined, then it tells us whether we need
@@ -1941,7 +1918,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
   if (!block_address_function_relative)
     /* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the
        function start address, so just use the text offset.  */
-    function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
+    function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 
   /* Something is wrong if we see real data before
      seeing a source file name.  */
@@ -1981,7 +1958,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
        }
 
       /* Relocate for dynamic loading */
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 #ifdef SMASH_TEXT_ADDRESS
       SMASH_TEXT_ADDRESS (valu);
 #endif
@@ -2089,7 +2066,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
     case N_FN_SEQ:
       /* This kind of symbol indicates the start of an object file.  */
       /* Relocate for dynamic loading */
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       break;
 
     case N_SO:
@@ -2098,7 +2075,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
          Finish the symbol table of the previous source file
          (if any) and start accumulating a new symbol table.  */
       /* Relocate for dynamic loading */
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 
       n_opt_found = 0;
 
@@ -2125,7 +2102,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
              patch_subfile_names (current_subfile, name);
              break;            /* Ignore repeated SOs */
            }
-         end_symtab (valu, objfile, SECT_OFF_TEXT);
+         end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
          end_stabs ();
        }
 
@@ -2148,7 +2125,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
          included in the compilation of the main source file
          (whose name was given in the N_SO symbol.)  */
       /* Relocate for dynamic loading */
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       start_subfile (name, current_subfile->dirname);
       break;
 
@@ -2226,7 +2203,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
                   elfstab_offset_sections ever starts dealing with the
                   text offset, and we still need to do this, we need to
                   invent a SECT_OFF_ADDR_KLUDGE or something.  */
-               valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+               valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
                goto define_a_symbol;
              }
          }
@@ -2240,28 +2217,28 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
          case N_ROSYM:
            goto case_N_ROSYM;
          default:
-           abort ();
+           internal_error (__FILE__, __LINE__, "failed internal consistency check");
          }
       }
 
     case_N_STSYM:              /* Static symbol in data seg */
     case N_DSLINE:             /* Source line number, data seg */
-      valu += ANOFFSET (section_offsets, SECT_OFF_DATA);
+      valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
       goto define_a_symbol;
 
     case_N_LCSYM:              /* Static symbol in BSS seg */
     case N_BSLINE:             /* Source line number, bss seg */
       /*   N_BROWS:       overlaps with N_BSLINE */
-      valu += ANOFFSET (section_offsets, SECT_OFF_BSS);
+      valu += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
       goto define_a_symbol;
 
     case_N_ROSYM:              /* Static symbol in Read-only data seg */
-      valu += ANOFFSET (section_offsets, SECT_OFF_RODATA);
+      valu += ANOFFSET (section_offsets, SECT_OFF_RODATA (objfile));
       goto define_a_symbol;
 
     case N_ENTRY:              /* Alternate entry point */
       /* Relocate for dynamic loading */
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       goto define_a_symbol;
 
       /* The following symbol types we don't know how to process.  Handle
@@ -2313,34 +2290,18 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
              /* Deal with the SunPRO 3.0 compiler which omits the address
                 from N_FUN symbols.  */
              if (type == N_FUN
-                 && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT))
+                 && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)))
                {
-                 struct minimal_symbol *msym;
-                 char *p;
-                 int n;
-
-                 p = strchr (name, ':');
-                 if (p == NULL)
-                   p = name;
-                 n = p - name;
-                 p = alloca (n + 2);
-                 strncpy (p, name, n);
-                 p[n] = 0;
-
-                 msym = lookup_minimal_symbol (p, last_source_file,
-                                               objfile);
-                 if (msym == NULL)
-                   {
-                     /* Sun Fortran appends an underscore to the minimal
-                        symbol name, try again with an appended underscore
-                        if the minimal symbol was not found.  */
-                     p[n] = '_';
-                     p[n + 1] = 0;
-                     msym = lookup_minimal_symbol (p, last_source_file,
-                                                   objfile);
-                   }
-                 if (msym)
-                   valu = SYMBOL_VALUE_ADDRESS (msym);
+                 CORE_ADDR minsym_valu = 
+                   find_stab_function_addr (name, last_source_file, objfile);
+
+                 /* find_stab_function_addr will return 0 if the minimal
+                    symbol wasn't found.  (Unfortunately, this might also
+                    be a valid address.)  Anyway, if it *does* return 0,
+                    it is likely that the value was set correctly to begin
+                    with... */
+                 if (minsym_valu != 0)
+                   valu = minsym_valu;
                }
 #endif
 
@@ -2404,6 +2365,13 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
                function_start_offset = valu;
 
              within_function = 1;
+
+             if (context_stack_depth > 1)
+               {
+                 complain (&lbrac_unmatched_complaint, symnum);
+                 break;
+               }
+
              if (context_stack_depth > 0)
                {
                  new = pop_context ();
@@ -2411,9 +2379,6 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
                  finish_block (new->name, &local_symbols, new->old_blocks,
                                new->start_addr, valu, objfile);
                }
-             /* Stack must be empty now.  */
-             if (context_stack_depth != 0)
-               complain (&lbrac_unmatched_complaint, symnum);
 
              new = push_context (0, valu);
              new->name = define_symbol (valu, name, desc, type, objfile);
@@ -2435,7 +2400,9 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
          if (STREQ (name, GCC2_COMPILED_FLAG_SYMBOL))
            {
              processing_gcc_compilation = 2;
-#if 1                          /* Works, but is experimental.  -fnf */
+#if 0                          /* Works, but is experimental.  -fnf */
+             /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
+                know whether it will use the old style or v3 mangling.  */
              if (AUTO_DEMANGLING)
                {
                  set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
@@ -2447,13 +2414,25 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
        }
       break;
 
+    case N_MAIN:               /* Name of main routine.  */
+      /* FIXME: If one has a symbol file with N_MAIN and then replaces
+        it with a symbol file with "main" and without N_MAIN.  I'm
+        not sure exactly what rule to follow but probably something
+        like: N_MAIN takes precedence over "main" no matter what
+        objfile it is in; If there is more than one N_MAIN, choose
+        the one in the symfile_objfile; If there is more than one
+        N_MAIN within a given objfile, complain() and choose
+        arbitrarily. (kingdon) */
+      if (name != NULL)
+       set_main_name (name);
+      break;
+
       /* The following symbol types can be ignored.  */
     case N_OBJ:                /* Solaris 2:  Object file dir and name */
       /*   N_UNDF:                   Solaris 2:  file separator mark */
       /*   N_UNDF: -- we will never encounter it, since we only process one
          file's symbols at once.  */
     case N_ENDM:               /* Solaris 2:  End of module */
-    case N_MAIN:               /* Name of main routine.  */
     case N_ALIAS:              /* SunPro F77: alias name, ignore for now.  */
       break;
     }
@@ -2514,16 +2493,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
    adjusted for coff details. */
 
 void
-coffstab_build_psymtabs (objfile, mainline,
-                        textaddr, textsize, stabsects,
-                        stabstroffset, stabstrsize)
-     struct objfile *objfile;
-     int mainline;
-     CORE_ADDR textaddr;
-     unsigned int textsize;
-     struct stab_section_list *stabsects;
-     file_ptr stabstroffset;
-     unsigned int stabstrsize;
+coffstab_build_psymtabs (struct objfile *objfile, int mainline,
+                        CORE_ADDR textaddr, unsigned int textsize,
+                        struct stab_section_list *stabsects,
+                        file_ptr stabstroffset, unsigned int stabstrsize)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -2553,7 +2526,7 @@ coffstab_build_psymtabs (objfile, mainline,
   val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET);
   if (val < 0)
     perror_with_name (name);
-  val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, 1, sym_bfd);
+  val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
   if (val != stabstrsize)
     perror_with_name (name);
 
@@ -2615,15 +2588,9 @@ coffstab_build_psymtabs (objfile, mainline,
    adjusted for elf details. */
 
 void
-elfstab_build_psymtabs (objfile, mainline,
-                       staboffset, stabsize,
-                       stabstroffset, stabstrsize)
-     struct objfile *objfile;
-     int mainline;
-     file_ptr staboffset;
-     unsigned int stabsize;
-     file_ptr stabstroffset;
-     unsigned int stabstrsize;
+elfstab_build_psymtabs (struct objfile *objfile, int mainline,
+                       file_ptr staboffset, unsigned int stabsize,
+                       file_ptr stabstroffset, unsigned int stabstrsize)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -2655,7 +2622,7 @@ elfstab_build_psymtabs (objfile, mainline,
   val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET);
   if (val < 0)
     perror_with_name (name);
-  val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, 1, sym_bfd);
+  val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
   if (val != stabstrsize)
     perror_with_name (name);
 
@@ -2691,13 +2658,8 @@ elfstab_build_psymtabs (objfile, mainline,
    This routine is mostly copied from dbx_symfile_init and dbx_symfile_read. */
 
 void
-stabsect_build_psymtabs (objfile, mainline, stab_name,
-                        stabstr_name, text_name)
-     struct objfile *objfile;
-     int mainline;
-     char *stab_name;
-     char *stabstr_name;
-     char *text_name;
+stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name,
+                        char *stabstr_name, char *text_name)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -2773,7 +2735,7 @@ static struct sym_fns aout_sym_fns =
 };
 
 void
-_initialize_dbxread ()
+_initialize_dbxread (void)
 {
   add_symtab_fns (&aout_sym_fns);
 }
This page took 0.039317 seconds and 4 git commands to generate.