* serial.h (SERIAL_SET_TTY_STATE): Comment return value.
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 92f30598f5127629b6fa94387c07e152145d0aaf..352b4c4a8db5a487d557e5dd21bb37c8ef0e6ecf 100644 (file)
@@ -993,8 +993,10 @@ parse_symbol (sh, ax, ext_sh, bigend)
        else
          t = pend->t;
 
-       /* Alpha cc unnamed structs do not get a tag name.  */
-       if (sh->iss == 0)
+       /* Do not set the tag name if it is a compiler generated tag name
+          (.Fxx or .xxfake or empty) for unnamed struct/union/enums.
+          Alpha cc puts out an sh->iss of zero for those.  */
+       if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
          TYPE_TAG_NAME (t) = NULL;
        else
          TYPE_TAG_NAME (t) = obconcat (&current_objfile->symbol_obstack,
@@ -1010,6 +1012,15 @@ parse_symbol (sh, ax, ext_sh, bigend)
        if (type_code == TYPE_CODE_ENUM)
          {
            /* This is a non-empty enum. */
+
+           /* DEC c89 has the number of enumerators in the sh.value field,
+              not the type length, so we have to compensate for that
+              incompatibility quirk.
+              This might do the wrong thing for an enum with one or two
+              enumerators and gcc -gcoff -fshort-enums, but these cases
+              are hopefully rare enough.  */
+           if (TYPE_LENGTH (t) == TYPE_NFIELDS (t))
+             TYPE_LENGTH (t) = TARGET_INT_BIT / HOST_CHAR_BIT;
            for (ext_tsym = ext_sh + external_sym_size;
                 ;
                 ext_tsym += external_sym_size)
@@ -1416,6 +1427,12 @@ parse_type (fd, ax, aux_index, bs, bigend, sym_name)
       if (tp == (struct type *) NULL)
        tp = init_type (type_code, 0, 0, (char *) NULL, current_objfile);
 
+      /* DEC c89 produces cross references to qualified aggregate types,
+        dereference them.  */
+      while (TYPE_CODE (tp) == TYPE_CODE_PTR
+            || TYPE_CODE (tp) == TYPE_CODE_ARRAY)
+       tp = tp->target_type;
+
       /* Make sure that TYPE_CODE(tp) has an expected type code.
         Any type may be returned from cross_ref if file indirect entries
         are corrupted.  */
@@ -1695,6 +1712,7 @@ parse_procedure (pr, search_symtab, first_off)
       if (pr->isym == -1)
        {
          /* Static procedure at address pr->adr.  Sigh. */
+         /* FIXME-32x64.  assuming pr->adr fits in long.  */
          complain (&pdr_static_symbol_complaint, (unsigned long) pr->adr);
          return;
        }
@@ -2161,7 +2179,7 @@ parse_partial_symbols (objfile, section_offsets)
          ms_type = mst_unknown;
          complain (&unknown_ext_complaint, name);
        }
-      prim_record_minimal_symbol (name, ext_in->asym.value, ms_type);
+      prim_record_minimal_symbol (name, ext_in->asym.value, ms_type, objfile);
     }
 
   /* Pass 3 over files, over local syms: fill in static symbols */
@@ -2333,7 +2351,8 @@ parse_partial_symbols (objfile, section_offsets)
                  /* I believe this is used only for file-local functions.
                     The comment in symconst.h ("load time only static procs")
                     isn't particularly clear on this point.  */
-                 prim_record_minimal_symbol (name, sh.value, mst_file_text);
+                 prim_record_minimal_symbol (name, sh.value, mst_file_text,
+                                             objfile);
                  /* FALLTHROUGH */
 
                case stProc:    /* Asm labels apparently */
@@ -2378,9 +2397,11 @@ parse_partial_symbols (objfile, section_offsets)
 
                case stStatic:  /* Variable */
                  if (sh.sc == scData || sh.sc == scSData || sh.sc == scRData)
-                   prim_record_minimal_symbol (name, sh.value, mst_file_data);
+                   prim_record_minimal_symbol (name, sh.value, mst_file_data,
+                                               objfile);
                  else
-                   prim_record_minimal_symbol (name, sh.value, mst_file_bss);
+                   prim_record_minimal_symbol (name, sh.value, mst_file_bss,
+                                               objfile);
                  class = LOC_STATIC;
                  break;
 
@@ -2702,8 +2723,15 @@ psymtab_to_symtab_1 (pst, filename)
          if (ECOFF_IS_STAB (&sh))
            {
              int type_code = ECOFF_UNMARK_STAB (sh.index);
-             process_one_symbol (type_code, 0, valu, name,
-                                 pst->section_offsets, pst->objfile);
+
+             /* We should never get non N_STAB symbols here, but they
+                should be harmless, so keep process_one_symbol from
+                complaining about them.  */
+             if (type_code & N_STAB)
+               {
+                 process_one_symbol (type_code, 0, valu, name,
+                                     pst->section_offsets, pst->objfile);
+               }
              if (type_code == N_FUN)
                {
                  /* Make up special symbol to contain
@@ -2720,10 +2748,17 @@ psymtab_to_symtab_1 (pst, filename)
                  add_symbol_to_list (s, &local_symbols);
                }
            }
-         else if (sh.st == stLabel && sh.index != indexNil)
+         else if (sh.st == stLabel)
            {
-             /* Handle encoded stab line number. */
-             record_line (current_subfile, sh.index, valu);
+             if (sh.index == indexNil)
+               {
+                 /* This is what the gcc2_compiled and __gnu_compiled_*
+                    show up as.  So don't complain.  */
+                 ;
+               }
+             else
+               /* Handle encoded stab line number. */
+               record_line (current_subfile, sh.index, valu);
            }
          else if (sh.st == stProc || sh.st == stStaticProc || sh.st == stEnd)
            /* These are generated by gcc-2.x, do not complain */
@@ -3212,6 +3247,10 @@ add_line (lt, lineno, adr, last)
      CORE_ADDR adr;
      int last;
 {
+  /* DEC c89 sometimes produces zero linenos which confuse gdb.
+     Change them to something sensible. */
+  if (lineno == 0)
+    lineno = 1;
   if (last == 0)
     last = -2;                 /* make sure we record first line */
 
This page took 0.024637 seconds and 4 git commands to generate.