2001-12-21 Michael Snyder <msnyder@redhat.com>
[deliverable/binutils-gdb.git] / gdb / hp-symtab-read.c
index e4c10f5c260ddd49c4dbfbe5c0c67a5b56644ee1..57665ffff37bd1f8038f4972477f7e144c45493b 100644 (file)
@@ -1,5 +1,5 @@
 /* Read hp debug symbols and convert to internal format, for GDB.
-   Copyright 1993, 1996 Free Software Foundation, Inc.
+   Copyright 1993, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -169,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;
 
@@ -182,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;
 
@@ -195,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;
@@ -236,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)
     {
@@ -311,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;
@@ -370,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)
@@ -427,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;
@@ -531,7 +516,7 @@ hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
   current_objfile = NULL;
   hp_som_som_object_present = 1;       /* Indicate we've processed an HP SOM SOM file */
 
-  return end_symtab (text_offset + text_size, objfile, 0);
+  return end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 }
 \f
 
@@ -540,13 +525,12 @@ 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)
     {
       error ("error in hpread_type_translate\n.");
-      return;
+      return FT_VOID;
     }
 
   switch (typep.dntti.type)
@@ -632,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;
@@ -720,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;
 
@@ -744,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;
@@ -839,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;
@@ -1025,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;
@@ -1218,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
@@ -1810,7 +1780,7 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
              /* Enums -- will be handled by other code that takes care
                 of DNTT_TYPE_ENUM; here we see only DNTT_TYPE_MEMENUM so
                 it's not clear we could have handled them here at all. */
-             /* FUNC_TEMPLATE: is handled by other code (??). */
+             /* FUNC_TEMPLATE: is handled by other code (?). */
              /* MEMACCESS: modified access for inherited member. Not
                 sure what to do with this, ignoriing it at present. */
 
@@ -1893,7 +1863,8 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
        {
          /* neither field nor genfield ?? is this possible?? */
          /* pai:: FIXME walk to the next -- how? */
-         warning ("Internal error: unexpected DNTT kind %d encountered as field of struct");
+         warning ("Internal error: unexpected DNTT kind %d encountered as field of struct",
+                  fieldp->dblock.kind);
          warning ("Skipping remaining fields of struct");
          break;                /* get out of loop of fields */
        }
@@ -2047,6 +2018,9 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
   /* Clear the global saying what template we are in the middle of processing */
   current_template = NULL;
 
+  /* Fix up any cv-qualified versions of this type.  */
+  finish_cv_type (type);
+
   return type;
 }
 
@@ -2059,10 +2033,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;
 
@@ -2092,10 +2064,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;
 
@@ -2156,9 +2126,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;
@@ -2169,11 +2137,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;
 
@@ -2193,10 +2158,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;
 
@@ -2217,10 +2180,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;
 
@@ -2242,7 +2203,7 @@ hpread_read_array_type (hp_type, dn_bufp, objfile)
        (!dn_bufp->darray.arrayisbytes && !dn_bufp->darray.elemisbytes)))
     {
       warning ("error in hpread_array_type.\n");
-      return;
+      return NULL;
     }
   else if (dn_bufp->darray.arraylength == 0x7fffffff)
     {
@@ -2277,10 +2238,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;
 
@@ -2340,23 +2299,24 @@ 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;
 
   /* First see if it's a simple builtin type.  */
   if (hp_type.dntti.immediate)
-    /* If this is a template argument, the argument number is
-     * encoded in the bitlength. All other cases, just return
-     * GDB's representation of this fundamental type.
-     */
-    if (hp_type.dntti.type == HP_TYPE_TEMPLATE_ARG)
-      return hpread_get_nth_template_arg (objfile, hp_type.dntti.bitlength);
-    else
-      return lookup_fundamental_type (objfile, hpread_type_translate (hp_type));
+    {
+      /* If this is a template argument, the argument number is
+       * encoded in the bitlength. All other cases, just return
+       * GDB's representation of this fundamental type.
+       */
+      if (hp_type.dntti.type == HP_TYPE_TEMPLATE_ARG)
+       return hpread_get_nth_template_arg (objfile, hp_type.dntti.bitlength);
+      else
+       return lookup_fundamental_type (objfile,
+                                       hpread_type_translate (hp_type));
+    }
 
   /* Not a builtin type.  We'll have to read it in.  */
   if (hp_type.dnttp.index < LNTT_SYMCOUNT (objfile))
@@ -2472,7 +2432,7 @@ hpread_type_lookup (hp_type, objfile)
        else
          {
            complain (&hpread_type_lookup_complaint);
-           return;
+           return NULL;
          }
 
        if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
@@ -2701,11 +2661,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;
 
@@ -2733,8 +2691,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;
@@ -2794,19 +2751,11 @@ 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;
@@ -3916,10 +3865,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;
@@ -3964,9 +3911,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;
 
@@ -4000,11 +3945,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.036148 seconds and 4 git commands to generate.