import gdb-1999-06-14 snapshot
[deliverable/binutils-gdb.git] / gdb / dwarfread.c
index 09b7f10ee4f2142d74940611b616e23d09963fcd..9de03123d7d1e0660ef4c52dfeed6201cf806a9d 100644 (file)
@@ -1,5 +1,5 @@
 /* DWARF debugging format support for GDB.
-   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996
+   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998
    Free Software Foundation, Inc.
    Written by Fred Fish at Cygnus Support.  Portions based on dbxread.c,
    mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port.
@@ -674,11 +674,13 @@ set_cu_language (dip)
       case LANG_MODULA2:
        cu_language = language_m2;
        break;
+      case LANG_FORTRAN77:
+      case LANG_FORTRAN90:
+       cu_language = language_fortran;
+       break;
       case LANG_ADA83:
       case LANG_COBOL74:
       case LANG_COBOL85:
-      case LANG_FORTRAN77:
-      case LANG_FORTRAN90:
       case LANG_PASCAL83:
        /* We don't know anything special about these yet. */
        cu_language = language_unknown;
@@ -1086,10 +1088,10 @@ struct_type (dip, thisdie, enddie, objfile)
          list -> field.name =
              obsavestring (mbr.at_name, strlen (mbr.at_name),
                            &objfile -> type_obstack);
-         list -> field.type = decode_die_type (&mbr);
-         list -> field.bitpos = 8 * locval (&mbr);
+         FIELD_TYPE (list->field) = decode_die_type (&mbr);
+         FIELD_BITPOS (list->field) = 8 * locval (&mbr);
          /* Handle bit fields. */
-         list -> field.bitsize = mbr.at_bit_size;
+         FIELD_BITSIZE (list->field) = mbr.at_bit_size;
          if (BITS_BIG_ENDIAN)
            {
              /* For big endian bits, the at_bit_offset gives the
@@ -1097,7 +1099,7 @@ struct_type (dip, thisdie, enddie, objfile)
                 anonymous object to the MSB of the field.  We don't
                 have to do anything special since we don't need to
                 know the size of the anonymous object. */
-             list -> field.bitpos += mbr.at_bit_offset;
+             FIELD_BITPOS (list->field) += mbr.at_bit_offset;
            }
          else
            {
@@ -1127,7 +1129,7 @@ struct_type (dip, thisdie, enddie, objfile)
                         a debug information size optimization. */
                      anonymous_size = TYPE_LENGTH (list -> field.type);
                    }
-                 list -> field.bitpos +=
+                 FIELD_BITPOS (list->field) +=
                    anonymous_size * 8 - mbr.at_bit_offset - mbr.at_bit_size;
                }
            }
@@ -1501,10 +1503,8 @@ read_tag_pointer_type (dip)
       TYPE_POINTER_TYPE (type) = utype;
 
       /* We assume the machine has only one representation for pointers!  */
-      /* FIXME:  This confuses host<->target data representations, and is a
-        poor assumption besides. */
-      
-      TYPE_LENGTH (utype) = sizeof (char *);
+      /* FIXME:  Possably a poor assumption  */
+      TYPE_LENGTH (utype) = TARGET_PTR_BIT / TARGET_CHAR_BIT ;
       TYPE_CODE (utype) = TYPE_CODE_PTR;
     }
 }
@@ -1771,9 +1771,9 @@ enum_type (dip, objfile)
          new = (struct nextfield *) alloca (sizeof (struct nextfield));
          new -> next = list;
          list = new;
-         list -> field.type = NULL;
-         list -> field.bitsize = 0;
-         list -> field.bitpos =
+         FIELD_TYPE (list->field) = NULL;
+         FIELD_BITSIZE (list->field) = 0;
+         FIELD_BITPOS (list->field) =
            target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED,
                            objfile);
          scan += TARGET_FT_LONG_SIZE (objfile);
@@ -1791,7 +1791,7 @@ enum_type (dip, objfile)
          SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
          SYMBOL_CLASS (sym) = LOC_CONST;
          SYMBOL_TYPE (sym) = type;
-         SYMBOL_VALUE (sym) = list -> field.bitpos;
+         SYMBOL_VALUE (sym) = FIELD_BITPOS (list->field);
          if (SYMBOL_VALUE (sym) < 0)
            unsigned_enum = 0;
          add_symbol_to_list (sym, list_in_scope);
@@ -1902,10 +1902,17 @@ handle_producer (producer)
   /* If this compilation unit was compiled with g++ or gcc, then set the
      processing_gcc_compilation flag. */
 
-  processing_gcc_compilation =
-    STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))
-      || STREQN (producer, CHILL_PRODUCER, strlen (CHILL_PRODUCER))
-      || STREQN (producer, GCC_PRODUCER, strlen (GCC_PRODUCER));
+  if (STREQN (producer, GCC_PRODUCER, strlen (GCC_PRODUCER)))
+    {
+      char version = producer[strlen (GCC_PRODUCER)];
+      processing_gcc_compilation = (version == '2' ? 2 : 1);
+    }
+  else
+    {
+      processing_gcc_compilation =
+       STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))
+       || STREQN (producer, CHILL_PRODUCER, strlen (CHILL_PRODUCER));
+    }
 
   /* Select a demangling style if we can identify the producer and if
      the current style is auto.  We leave the current style alone if it
@@ -1975,6 +1982,7 @@ read_file_scope (dip, thisdie, enddie, objfile)
   memset (utypes, 0, numutypes * sizeof (struct type *));
   memset (ftypes, 0, FT_NUM_MEMBERS * sizeof (struct type *));
   start_symtab (dip -> at_name, dip -> at_comp_dir, dip -> at_low_pc);
+  record_debugformat ("DWARF 1");
   decode_line_numbers (lnbase);
   process_dies (thisdie + dip -> die_length, enddie, objfile);
 
@@ -2444,7 +2452,8 @@ psymtab_to_symtab_1 (pst)
          if (DBLENGTH (pst))           /* Otherwise it's a dummy */
            {
              buildsym_init ();
-             old_chain = make_cleanup (really_free_pendings, 0);
+             old_chain = make_cleanup ((make_cleanup_func) 
+                                        really_free_pendings, 0);
              read_ofile_symtab (pst);
              if (info_verbose)
                {
This page took 0.025469 seconds and 4 git commands to generate.