Fix a segfault caused by under-allocating an array.
[deliverable/binutils-gdb.git] / gdb / hp-symtab-read.c
index dc045a4ef4e58b438d96c05ecc1e2f44e56b9f84..902a40d207d91bd351a5a895fff43729df3764aa 100644 (file)
@@ -83,85 +83,73 @@ static struct complaint hpread_unhandled_blockdata_complaint =
 
 /* Forward procedure declarations */
 
-static unsigned long hpread_get_scope_start
-  PARAMS ((sltpointer, struct objfile *));
+static unsigned long hpread_get_scope_start (sltpointer, struct objfile *);
 
-static unsigned long hpread_get_line
-  PARAMS ((sltpointer, struct objfile *));
+static unsigned long hpread_get_line (sltpointer, struct objfile *);
 
-static CORE_ADDR hpread_get_location
-  PARAMS ((sltpointer, struct objfile *));
+static CORE_ADDR hpread_get_location (sltpointer, struct objfile *);
 
-static void hpread_psymtab_to_symtab_1
-  PARAMS ((struct partial_symtab *));
+static void hpread_psymtab_to_symtab_1 (struct partial_symtab *);
 
-void hpread_psymtab_to_symtab
-  PARAMS ((struct partial_symtab *));
+void hpread_psymtab_to_symtab (struct partial_symtab *);
 
 static struct symtab *hpread_expand_symtab
-  PARAMS ((struct objfile *, int, int, CORE_ADDR, int,
-          struct section_offsets *, char *));
+  (struct objfile *, int, int, CORE_ADDR, int,
+   struct section_offsets *, char *);
 
-static int hpread_type_translate
-  PARAMS ((dnttpointer));
+static int hpread_type_translate (dnttpointer);
 
-static struct type **hpread_lookup_type
-  PARAMS ((dnttpointer, struct objfile *));
+static struct type **hpread_lookup_type (dnttpointer, struct objfile *);
 
-static struct type *hpread_alloc_type
-  PARAMS ((dnttpointer, struct objfile *));
+static struct type *hpread_alloc_type (dnttpointer, struct objfile *);
 
 static struct type *hpread_read_enum_type
-  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+  (dnttpointer, union dnttentry *, struct objfile *);
 
 static struct type *hpread_read_function_type
-  PARAMS ((dnttpointer, union dnttentry *, struct objfile *, int));
+  (dnttpointer, union dnttentry *, struct objfile *, int);
 
 static struct type *hpread_read_doc_function_type
-  PARAMS ((dnttpointer, union dnttentry *, struct objfile *, int));
+  (dnttpointer, union dnttentry *, struct objfile *, int);
 
 static struct type *hpread_read_struct_type
-  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+  (dnttpointer, union dnttentry *, struct objfile *);
 
-static struct type *hpread_get_nth_template_arg
-  PARAMS ((struct objfile *, int));
+static struct type *hpread_get_nth_template_arg (struct objfile *, int);
 
 static struct type *hpread_read_templ_arg_type
-  PARAMS ((dnttpointer, union dnttentry *, struct objfile *, char *));
+  (dnttpointer, union dnttentry *, struct objfile *, char *);
 
 static struct type *hpread_read_set_type
-  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+  (dnttpointer, union dnttentry *, struct objfile *);
 
 static struct type *hpread_read_array_type
-  PARAMS ((dnttpointer, union dnttentry * dn_bufp, struct objfile * objfile));
+  (dnttpointer, union dnttentry *dn_bufp, struct objfile *objfile);
 
 static struct type *hpread_read_subrange_type
-  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+  (dnttpointer, union dnttentry *, struct objfile *);
 
-static struct type *hpread_type_lookup
-  PARAMS ((dnttpointer, struct objfile *));
+static struct type *hpread_type_lookup (dnttpointer, struct objfile *);
 
 static sltpointer hpread_record_lines
-  PARAMS ((struct subfile *, sltpointer, sltpointer,
-          struct objfile *, CORE_ADDR));
+  (struct subfile *, sltpointer, sltpointer, struct objfile *, CORE_ADDR);
 
 static void hpread_process_one_debug_symbol
-  PARAMS ((union dnttentry *, char *, struct section_offsets *,
-          struct objfile *, CORE_ADDR, int, char *, int, int *));
+  (union dnttentry *, char *, struct section_offsets *,
+   struct objfile *, CORE_ADDR, int, char *, int, int *);
 
-static int hpread_get_scope_depth
-  PARAMS ((union dnttentry *, struct objfile *, int));
+static int hpread_get_scope_depth (union dnttentry *, struct objfile *, int);
 
 static void fix_static_member_physnames
-  PARAMS ((struct type *, char *, struct objfile *));
+  (struct type *, char *, struct objfile *);
 
 static void fixup_class_method_type
-  PARAMS ((struct type *, struct type *, struct objfile *));
+  (struct type *, struct type *, struct objfile *);
 
-static void hpread_adjust_bitoffsets PARAMS ((struct type *, int));
+static void hpread_adjust_bitoffsets (struct type *, int);
 
 static dnttpointer hpread_get_next_skip_over_anon_unions
-  PARAMS ((int, dnttpointer, union dnttentry **, struct objfile *));
+  (int, dnttpointer, union dnttentry **, struct objfile *);
 
 /* Global to indicate presence of HP-compiled objects,
    in particular, SOM executable file with SOM debug info 
@@ -181,9 +169,7 @@ static struct type *fixup_method = NULL;
 /* Get the nesting depth for the source line identified by INDEX.  */
 
 static unsigned long
-hpread_get_scope_start (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_scope_start (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
 
@@ -194,9 +180,7 @@ hpread_get_scope_start (index, objfile)
 /* Get the source line number the the line identified by INDEX.  */
 
 static unsigned long
-hpread_get_line (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_line (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
 
@@ -207,9 +191,7 @@ hpread_get_line (index, objfile)
 /* Find the code address associated with a given sltpointer */
 
 static CORE_ADDR
-hpread_get_location (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_location (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
   int i;
@@ -248,8 +230,7 @@ hpread_get_location (index, objfile)
  */
 
 int
-hpread_has_name (kind)
-     enum dntt_entry_type kind;
+hpread_has_name (enum dntt_entry_type kind)
 {
   switch (kind)
     {
@@ -323,8 +304,7 @@ hpread_has_name (kind)
    table.  */
 
 static void
-hpread_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+hpread_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -382,8 +362,7 @@ hpread_psymtab_to_symtab_1 (pst)
    Be verbose about it if the user wants that.  */
 
 void
-hpread_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+hpread_psymtab_to_symtab (struct partial_symtab *pst)
 {
   /* Get out quick if given junk.  */
   if (!pst)
@@ -439,15 +418,9 @@ hpread_psymtab_to_symtab (pst)
    SECTION_OFFSETS are the relocation offsets which get added to each symbol. */
 
 static struct symtab *
-hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
-                     section_offsets, filename)
-     struct objfile *objfile;
-     int sym_offset;
-     int sym_size;
-     CORE_ADDR text_offset;
-     int text_size;
-     struct section_offsets *section_offsets;
-     char *filename;
+hpread_expand_symtab (struct objfile *objfile, int sym_offset, int sym_size,
+                     CORE_ADDR text_offset, int text_size,
+                     struct section_offsets *section_offsets, char *filename)
 {
   char *namestring;
   union dnttentry *dn_bufp;
@@ -552,8 +525,7 @@ hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
 /* Convert basic types from HP debug format into GDB internal format.  */
 
 static int
-hpread_type_translate (typep)
-     dnttpointer typep;
+hpread_type_translate (dnttpointer typep)
 {
   if (!typep.dntti.immediate)
     {
@@ -644,9 +616,7 @@ hpread_type_translate (typep)
  */
 
 static struct type **
-hpread_lookup_type (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_lookup_type (dnttpointer hp_type, struct objfile *objfile)
 {
   unsigned old_len;
   int index = hp_type.dnttp.index;
@@ -732,9 +702,7 @@ hpread_lookup_type (hp_type, objfile)
    have it lying around.  */
 
 static struct type *
-hpread_alloc_type (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_alloc_type (dnttpointer hp_type, struct objfile *objfile)
 {
   struct type **type_addr;
 
@@ -756,10 +724,8 @@ hpread_alloc_type (hp_type, objfile)
 /* Read a native enumerated type and return it in GDB internal form.  */
 
 static struct type *
-hpread_read_enum_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                      struct objfile *objfile)
 {
   struct type *type;
   struct pending **symlist, *osyms, *syms;
@@ -851,11 +817,8 @@ hpread_read_enum_type (hp_type, dn_bufp, objfile)
 /* Read and internalize a native function debug symbol.  */
 
 static struct type *
-hpread_read_function_type (hp_type, dn_bufp, objfile, newblock)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     int newblock;
+hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                          struct objfile *objfile, int newblock)
 {
   struct type *type, *type1;
   struct pending *syms;
@@ -1037,11 +1000,8 @@ finish:
  * volatile, please leave it this way.
  */
 static struct type *
-hpread_read_doc_function_type (hp_type, dn_bufp, objfile, newblock)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     int newblock;
+hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                              struct objfile *objfile, int newblock)
 {
   struct type *type, *type1;
   struct pending *syms;
@@ -1230,10 +1190,8 @@ static struct type *current_template = NULL;
  */
 
 static struct type *
-hpread_read_struct_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                        struct objfile *objfile)
 {
   /* The data members get linked together into a list of struct nextfield's */
   struct nextfield
@@ -2071,10 +2029,8 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
    Void return */
 
 static void
-fix_static_member_physnames (type, class_name, objfile)
-     struct type *type;
-     char *class_name;
-     struct objfile *objfile;
+fix_static_member_physnames (struct type *type, char *class_name,
+                            struct objfile *objfile)
 {
   int i;
 
@@ -2104,10 +2060,8 @@ fix_static_member_physnames (type, class_name, objfile)
  * Void return. */
 
 static void
-fixup_class_method_type (class, method, objfile)
-     struct type *class;
-     struct type *method;
-     struct objfile *objfile;
+fixup_class_method_type (struct type *class, struct type *method,
+                        struct objfile *objfile)
 {
   int i, j, k;
 
@@ -2168,9 +2122,7 @@ finish:
  * This is called from hpread_type_lookup().
  */
 static struct type *
-hpread_get_nth_template_arg (objfile, n)
-     struct objfile *objfile;
-     int n;
+hpread_get_nth_template_arg (struct objfile *objfile, int n)
 {
   if (current_template != NULL)
     return TYPE_TEMPLATE_ARG (current_template, n).type;
@@ -2181,11 +2133,8 @@ hpread_get_nth_template_arg (objfile, n)
 /* Read in and internalize a TEMPL_ARG (template arg) symbol.  */
 
 static struct type *
-hpread_read_templ_arg_type (hp_type, dn_bufp, objfile, name)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     char *name;
+hpread_read_templ_arg_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                           struct objfile *objfile, char *name)
 {
   struct type *type;
 
@@ -2205,10 +2154,8 @@ hpread_read_templ_arg_type (hp_type, dn_bufp, objfile, name)
 /* Read in and internalize a set debug symbol.  */
 
 static struct type *
-hpread_read_set_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_set_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                     struct objfile *objfile)
 {
   struct type *type;
 
@@ -2229,10 +2176,8 @@ hpread_read_set_type (hp_type, dn_bufp, objfile)
 /* Read in and internalize an array debug symbol.  */
 
 static struct type *
-hpread_read_array_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_array_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                       struct objfile *objfile)
 {
   struct type *type;
 
@@ -2289,10 +2234,8 @@ hpread_read_array_type (hp_type, dn_bufp, objfile)
 
 /* Read in and internalize a subrange debug symbol.  */
 static struct type *
-hpread_read_subrange_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_subrange_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+                          struct objfile *objfile)
 {
   struct type *type;
 
@@ -2352,9 +2295,7 @@ hpread_read_subrange_type (hp_type, dn_bufp, objfile)
  *     a struct/class type, etc).
  */
 static struct type *
-hpread_type_lookup (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
 {
   union dnttentry *dn_bufp;
   struct type *tmp_type;
@@ -2713,11 +2654,9 @@ hpread_type_lookup (hp_type, objfile)
 }
 
 static sltpointer
-hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
-     struct subfile *subfile;
-     sltpointer s_idx, e_idx;
-     struct objfile *objfile;
-     CORE_ADDR offset;
+hpread_record_lines (struct subfile *subfile, sltpointer s_idx,
+                    sltpointer e_idx, struct objfile *objfile,
+                    CORE_ADDR offset)
 {
   union sltentry *sl_bufp;
 
@@ -2745,8 +2684,7 @@ hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
  * If "f" is not a member function, return NULL.
  */
 char *
-class_of (functype)
-     struct type *functype;
+class_of (struct type *functype)
 {
   struct type *first_param_type;
   char *first_param_name;
@@ -2806,25 +2744,17 @@ class_of (functype)
  */
 
 static void
-hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
-                                text_offset, text_size, filename,
-                                index, at_module_boundary_p
-)
-     union dnttentry *dn_bufp;
-     char *name;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
-     CORE_ADDR text_offset;
-     int text_size;
-     char *filename;
-     int index;
-     int *at_module_boundary_p;
+hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
+                                struct section_offsets *section_offsets,
+                                struct objfile *objfile, CORE_ADDR text_offset,
+                                int text_size, char *filename, int index,
+                                int *at_module_boundary_p)
 {
   unsigned long desc;
   int type;
   CORE_ADDR valu;
-  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
-  int data_offset = ANOFFSET (section_offsets, SECT_OFF_DATA);
+  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
+  int data_offset = ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
   union dnttentry *dn_temp;
   dnttpointer hp_type;
   struct symbol *sym;
@@ -3928,10 +3858,8 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
 
 
 static int
-hpread_get_scope_depth (dn_bufp, objfile, report_nested)
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     int report_nested;
+hpread_get_scope_depth (union dnttentry *dn_bufp, struct objfile *objfile,
+                       int report_nested)
 {
   register int index;
   register union dnttentry *dn_tmp;
@@ -3976,9 +3904,7 @@ hpread_get_scope_depth (dn_bufp, objfile, report_nested)
    enclosing structure instead of relative to the union itself. */
 
 static void
-hpread_adjust_bitoffsets (type, bits)
-     struct type *type;
-     int bits;
+hpread_adjust_bitoffsets (struct type *type, int bits)
 {
   register int i;
 
@@ -4012,11 +3938,9 @@ hpread_adjust_bitoffsets (type, bits)
    is a dnttpointer for the new field after all the skipped ones */
 
 static dnttpointer
-hpread_get_next_skip_over_anon_unions (skip_fields, field, fieldp, objfile)
-     int skip_fields;
-     dnttpointer field;
-     union dnttentry **fieldp;
-     struct objfile *objfile;
+hpread_get_next_skip_over_anon_unions (int skip_fields, dnttpointer field,
+                                      union dnttentry **fieldp,
+                                      struct objfile *objfile)
 {
   struct type *anon_type;
   register int i;
This page took 0.029155 seconds and 4 git commands to generate.