#include "symtab.h"
#include "breakpoint.h"
#include "target.h"
-#include "gdbcore.h" /* for bfd stuff */
-#include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */
+#include "gdbcore.h"
+#include "libaout.h"
#include "filenames.h"
#include "objfiles.h"
#include "buildsym-legacy.h"
#include "cp-abi.h"
#include "cp-support.h"
#include "c-lang.h"
-#include "psympriv.h"
+#include "psymtab.h"
#include "block.h"
#include "aout/aout64.h"
-#include "aout/stab_gnu.h" /* We always use GNU stabs, not
- native, now. */
+#include "aout/stab_gnu.h"
\f
/* Key for dbx-associated data. */
Record it as global even if it's local, not global, so
lookup_minimal_symbol can find it. We don't check symbol_leading_char
because for SunOS4 it always is '_'. */
- if (name[8] == 'C' && strcmp ("__DYNAMIC", name) == 0)
+ if (strcmp ("__DYNAMIC", name) == 0)
ms_type = mst_data;
/* Same with virtual function tables, both global and static. */
{
const char *tempstring = name;
- if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd.get ()))
+ if (*tempstring != '\0'
+ && *tempstring == bfd_get_symbol_leading_char (objfile->obfd.get ()))
++tempstring;
if (is_vtable_name (tempstring))
ms_type = mst_data;
perror_with_name (name);
memset (size_temp, 0, sizeof (size_temp));
- val = bfd_bread (size_temp, sizeof (size_temp), sym_bfd);
+ val = bfd_read (size_temp, sizeof (size_temp), sym_bfd);
if (val < 0)
{
perror_with_name (name);
val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, SEEK_SET);
if (val < 0)
perror_with_name (name);
- val = bfd_bread (DBX_STRINGTAB (objfile),
- DBX_STRINGTAB_SIZE (objfile),
- sym_bfd);
+ val = bfd_read (DBX_STRINGTAB (objfile),
+ DBX_STRINGTAB_SIZE (objfile),
+ sym_bfd);
if (val != DBX_STRINGTAB_SIZE (objfile))
perror_with_name (name);
}
else if (symbuf_sections == NULL)
{
count = sizeof (symbuf);
- nbytes = bfd_bread (symbuf, count, sym_bfd);
+ nbytes = bfd_read (symbuf, count, sym_bfd);
}
else
{
count = symbuf_left;
if (count > sizeof (symbuf))
count = sizeof (symbuf);
- nbytes = bfd_bread (symbuf, count, sym_bfd);
+ nbytes = bfd_read (symbuf, count, sym_bfd);
}
if (nbytes < 0)
symbuf_left -= sym_offset;
}
else
- bfd_seek (symfile_bfd, sym_offset, SEEK_CUR);
+ if (bfd_seek (symfile_bfd, sym_offset, SEEK_CUR) != 0)
+ perror_with_name (bfd_get_filename (symfile_bfd));
}
#define INTERNALIZE_SYMBOL(intern, extern, abfd) \
{
case 'S':
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ pst->add_psymbol (std::string_view (sym_name, sym_len), true,
VAR_DOMAIN, LOC_STATIC,
data_sect_index,
psymbol_placement::STATIC,
/* The addresses in these entries are reported to be
wrong. See the code that reads 'G's for symtabs. */
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ pst->add_psymbol (std::string_view (sym_name, sym_len), true,
VAR_DOMAIN, LOC_STATIC,
data_sect_index,
psymbol_placement::GLOBAL,
&& namestring[0] != ' '))
{
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+ pst->add_psymbol (std::string_view (sym_name, sym_len),
true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
unrelocated_addr (0),
{
/* Also a typedef with the same name. */
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+ pst->add_psymbol (std::string_view (sym_name, sym_len),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
unrelocated_addr (0),
if (p != namestring) /* a name is there, not just :T... */
{
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+ pst->add_psymbol (std::string_view (sym_name, sym_len),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
unrelocated_addr (0),
/* Note that the value doesn't matter for
enum constants in psymtabs, just in symtabs. */
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (p, q - p), true,
+ pst->add_psymbol (std::string_view (p, q - p), true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC,
unrelocated_addr (0),
case 'c':
/* Constant, e.g. from "const" in Pascal. */
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ pst->add_psymbol (std::string_view (sym_name, sym_len), true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC,
unrelocated_addr (0),
textlow_not_set = 0;
}
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ pst->add_psymbol (std::string_view (sym_name, sym_len), true,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
psymbol_placement::STATIC,
textlow_not_set = 0;
}
if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ pst->add_psymbol (std::string_view (sym_name, sym_len), true,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
psymbol_placement::GLOBAL,
symbol_size = SYMBOL_SIZE (pst);
/* Read in this file's symbols. */
- bfd_seek (objfile->obfd.get (), SYMBOL_OFFSET (pst), SEEK_SET);
- read_ofile_symtab (objfile, pst);
+ if (bfd_seek (objfile->obfd.get (), SYMBOL_OFFSET (pst), SEEK_SET) == 0)
+ read_ofile_symtab (objfile, pst);
}
pst->readin = true;
processing_gcc_compilation = 1;
else if (strcmp (namestring, GCC2_COMPILED_FLAG_SYMBOL) == 0)
processing_gcc_compilation = 2;
- if (tempstring[0] == bfd_get_symbol_leading_char (symfile_bfd))
+ if (*tempstring != '\0'
+ && *tempstring == bfd_get_symbol_leading_char (symfile_bfd))
++tempstring;
if (startswith (tempstring, "__gnu_compiled"))
processing_gcc_compilation = 2;
case N_NBSTS:
case N_NBLCS:
unknown_symtype_complaint (hex_string (type));
- /* FALLTHROUGH */
define_a_symbol:
+ [[fallthrough]];
/* These symbol types don't need the address field relocated,
since it is either unused, or is absolute. */
case N_GSYM: /* Global variable. */
val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET);
if (val < 0)
perror_with_name (name);
- val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
+ val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
if (val != stabstrsize)
perror_with_name (name);
val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET);
if (val < 0)
perror_with_name (name);
- val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
+ val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
if (val != stabstrsize)
perror_with_name (name);