* gdb.texinfo (Continuing and Stepping): When talking about "step"
[deliverable/binutils-gdb.git] / gdb / dbxread.c
index b3c08d157dbe48ca1d4bf41e7f5421843fc95e8a..b2bcb32ea621cabce9dad0e421b995ea1dddf375 100644 (file)
@@ -108,25 +108,6 @@ struct symloc {
 #define IGNORE_SYMBOL(type)  (type == (int)N_NSYMS)
 #endif
 
-/* Macro for name of symbol to indicate a file compiled with gcc. */
-#ifndef GCC_COMPILED_FLAG_SYMBOL
-#define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled."
-#endif
-
-/* Macro for name of symbol to indicate a file compiled with gcc2. */
-#ifndef GCC2_COMPILED_FLAG_SYMBOL
-#define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled."
-#endif
-
-/* Define this as 1 if a pcc declaration of a char or short argument
-   gives the correct address.  Otherwise assume pcc gives the
-   address of the corresponding int, which is not the same on a
-   big-endian machine.  */
-
-#ifndef BELIEVE_PCC_PROMOTION
-#define BELIEVE_PCC_PROMOTION 0
-#endif
-
 /* Remember what we deduced to be the source language of this psymtab. */
 
 static enum language psymtab_language = language_unknown;
@@ -170,7 +151,7 @@ struct complaint unknown_symtype_complaint =
   {"unknown symbol type %s", 0, 0};
 
 struct complaint unknown_symchar_complaint =
-  {"unknown symbol type character `%c'", 0, 0};
+  {"unknown symbol descriptor `%c'", 0, 0};
 
 struct complaint lbrac_rbrac_complaint =
   {"block start larger than block end", 0, 0};
@@ -436,24 +417,6 @@ record_minimal_symbol (name, address, type, objfile)
       break;
 #endif
     case N_TEXT:
-      /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into
-        the minimal symbols, because if there is also another symbol
-        at the same address (e.g. the first function of the file),
-        lookup_minimal_symbol_by_pc would have no way of getting the
-        right one.  */
-      if (name[0] == 'g'
-         && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0
-             || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0))
-       return;
-
-      {
-       char *tempstring = name;
-       if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd))
-         ++tempstring;
-       if (STREQN (tempstring, "__gnu_compiled", 14))
-         return;
-      }
-
     case N_NBTEXT:
     case N_FN:
     case N_FN_SEQ:
@@ -490,7 +453,8 @@ record_minimal_symbol (name, address, type, objfile)
   prim_record_minimal_symbol
     (obsavestring (name, strlen (name), &objfile -> symbol_obstack),
      address,
-     ms_type);
+     ms_type,
+     objfile);
 }
 \f
 /* Scan and build partial symbols for a symbol file.
@@ -1071,6 +1035,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
       LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst);
   pst->texthigh = capping_text;
 
+#ifdef N_SO_ADDRESS_MAYBE_MISSING
   /* Under Solaris, the N_SO symbols always have a value of 0,
      instead of the usual address of the .o file.  Therefore,
      we have to do some tricks to fill in texthigh and textlow.
@@ -1137,6 +1102,9 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
 
   /* this test will be true if the last .o file is only data */
   if (pst->textlow == 0)
+    /* This loses if the text section really starts at address zero
+       (generally true when we are debugging a .o file, for example).
+       That is why this whole thing is inside N_SO_ADDRESS_MIGHT_LIE.  */
     pst->textlow = pst->texthigh;
 
   /* If we know our own starting text address, then walk through all other
@@ -1156,7 +1124,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
   }
 
   /* End of kludge for patching Solaris textlow and texthigh.  */
-
+#endif /* NO_SO_ADDRESS_MAYBE_MISSING.  */
 
   pst->n_global_syms =
     objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset);
@@ -1254,7 +1222,7 @@ dbx_psymtab_to_symtab_1 (pst)
 
   if (pst->readin)
     {
-      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
+      fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
               pst->filename);
       return;
     }
@@ -1266,13 +1234,13 @@ dbx_psymtab_to_symtab_1 (pst)
        /* Inform about additional files that need to be read in.  */
        if (info_verbose)
          {
-           fputs_filtered (" ", stdout);
+           fputs_filtered (" ", gdb_stdout);
            wrap_here ("");
-           fputs_filtered ("and ", stdout);
+           fputs_filtered ("and ", gdb_stdout);
            wrap_here ("");
            printf_filtered ("%s...", pst->dependencies[i]->filename);
            wrap_here ("");             /* Flush output */
-           fflush (stdout);
+           gdb_flush (gdb_stdout);
          }
        dbx_psymtab_to_symtab_1 (pst->dependencies[i]);
       }
@@ -1311,7 +1279,7 @@ dbx_psymtab_to_symtab (pst)
 
   if (pst->readin)
     {
-      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
+      fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
               pst->filename);
       return;
     }
@@ -1323,7 +1291,7 @@ dbx_psymtab_to_symtab (pst)
       if (info_verbose)
        {
          printf_filtered ("Reading in symbols for %s...", pst->filename);
-         fflush (stdout);
+         gdb_flush (gdb_stdout);
        }
 
       sym_bfd = pst->objfile->obfd;
@@ -1554,7 +1522,8 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
      since it would be silly to do things differently from Solaris), and
      false for SunOS4 and other a.out file formats.  */
   block_address_function_relative =
-    0 == strncmp (bfd_get_target (objfile->obfd), "elf", 3);
+    (0 == strncmp (bfd_get_target (objfile->obfd), "elf", 3))
+     || (0 == strncmp (bfd_get_target (objfile->obfd), "som", 3));
 
   if (!block_address_function_relative)
     /* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the
@@ -1643,33 +1612,38 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
       if (!VARIABLES_INSIDE_BLOCK(desc, processing_gcc_compilation))
        local_symbols = new->locals;
 
-      /* If this is not the outermost LBRAC...RBRAC pair in the
-        function, its local symbols preceded it, and are the ones
-        just recovered from the context stack.  Defined the block for them.
-
-        If this is the outermost LBRAC...RBRAC pair, there is no
-        need to do anything; leave the symbols that preceded it
-        to be attached to the function's own block.  However, if
-        it is so, we need to indicate that we just moved outside
-        of the function.  */
-      if (local_symbols
-         && (context_stack_depth
-             > !VARIABLES_INSIDE_BLOCK(desc, processing_gcc_compilation)))
+      if (context_stack_depth
+         > !VARIABLES_INSIDE_BLOCK(desc, processing_gcc_compilation))
        {
-         /* FIXME Muzzle a compiler bug that makes end < start.  */
-         if (new->start_addr > valu)
+         /* This is not the outermost LBRAC...RBRAC pair in the function,
+            its local symbols preceded it, and are the ones just recovered
+            from the context stack.  Define the block for them (but don't
+            bother if the block contains no symbols.  Should we complain
+            on blocks without symbols?  I can't think of any useful purpose
+            for them).  */
+         if (local_symbols != NULL)
            {
-             complain (&lbrac_rbrac_complaint);
-             new->start_addr = valu;
+             /* Muzzle a compiler bug that makes end < start.  (which
+                compilers?  Is this ever harmful?).  */
+             if (new->start_addr > valu)
+               {
+                 complain (&lbrac_rbrac_complaint);
+                 new->start_addr = valu;
+               }
+             /* Make a block for the local symbols within.  */
+             finish_block (0, &local_symbols, new->old_blocks,
+                           new->start_addr, valu, objfile);
            }
-         /* Make a block for the local symbols within.  */
-         finish_block (0, &local_symbols, new->old_blocks,
-                       new->start_addr, valu, objfile);
        }
       else
        {
+         /* This is the outermost LBRAC...RBRAC pair.  There is no
+            need to do anything; leave the symbols that preceded it
+            to be attached to the function's own block.  We need to
+            indicate that we just moved outside of the function.  */
          within_function = 0;
        }
+
       if (VARIABLES_INSIDE_BLOCK(desc, processing_gcc_compilation))
        /* Now pop locals of block just finished.  */
        local_symbols = new->locals;
@@ -1787,9 +1761,17 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
        p = strchr (name, ':');
        if (p != 0 && p[1] == 'S')
          {
-           /* The linker relocated it.  There used to be a kludge here
-              to add the text offset, but that will break if we ever
-              start using the text offset (currently it is always zero).  */
+           /* The linker relocated it.  We don't want to add an
+              elfstab_offset_sections-type offset, but we *do* want
+              to add whatever solib.c passed to symbol_file_add as
+              addr (this is known to affect SunOS4, and I suspect ELF
+              too).  Since elfstab_offset_sections currently does not
+              muck with the text offset (there is no Ttext.text
+              symbol), we can get addr from the text offset.  If
+              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);
            goto define_a_symbol;
          }
        /* Since it's not the kludge case, re-dispatch to the right handler. */
@@ -2158,6 +2140,9 @@ pastab_build_psymtabs (objfile, section_offsets, mainline)
   free_header_files ();
   init_header_files ();
 
+  /* This is needed to debug objects assembled with gas2.  */
+  processing_acc_compilation = 1;
+
   /* In a PA file, we've already installed the minimal symbols that came
      from the PA (non-stab) symbol table, so always act like an
      incremental load here. */
This page took 0.026255 seconds and 4 git commands to generate.