From 3a42e9d0622736d6ad84c37a2d4f4f54a0c30469 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 20 Sep 2001 03:03:40 +0000 Subject: [PATCH] * coffread.c: Replace all occurrences of bfd_read with bfd_bread. * dbxread.c: Likewise. * dwarf2read.c: Likewise. * dwarfread.c: Likewise. * somread.c: Likewise. * ultra3-nat.c: Likewise. * xcoffread.c: Likewise. --- gdb/ChangeLog | 10 ++++++++++ gdb/coffread.c | 15 ++++++++------- gdb/dbxread.c | 13 +++++++------ gdb/dwarf2read.c | 2 +- gdb/dwarfread.c | 10 +++++----- gdb/somread.c | 6 +++--- gdb/ultra3-nat.c | 2 +- gdb/xcoffread.c | 13 ++++++------- 8 files changed, 41 insertions(+), 30 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d4ef106f3cc..238e7326be6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2001-09-20 Alan Modra + + * coffread.c: Replace all occurrences of bfd_read with bfd_bread. + * dbxread.c: Likewise. + * dwarf2read.c: Likewise. + * dwarfread.c: Likewise. + * somread.c: Likewise. + * ultra3-nat.c: Likewise. + * xcoffread.c: Likewise. + 2001-09-19 Andrew Cagney * cris-tdep.c (cris_get_signed_offset): Change return type to an diff --git a/gdb/coffread.c b/gdb/coffread.c index 60ef89640a8..7b93f3d4d88 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1,6 +1,6 @@ /* Read coff symbol tables and convert to internal format, for GDB. Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000 + 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu). @@ -1154,18 +1154,18 @@ read_one_sym (register struct coff_symbol *cs, int i; cs->c_symnum = symnum; - bfd_read (temp_sym, local_symesz, 1, nlist_bfd_global); + bfd_bread (temp_sym, local_symesz, nlist_bfd_global); bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym); cs->c_naux = sym->n_numaux & 0xff; if (cs->c_naux >= 1) { - bfd_read (temp_aux, local_auxesz, 1, nlist_bfd_global); + bfd_bread (temp_aux, local_auxesz, nlist_bfd_global); bfd_coff_swap_aux_in (symfile_bfd, temp_aux, sym->n_type, sym->n_sclass, 0, cs->c_naux, (char *) aux); /* If more than one aux entry, read past it (only the first aux is important). */ for (i = 1; i < cs->c_naux; i++) - bfd_read (temp_aux, local_auxesz, 1, nlist_bfd_global); + bfd_bread (temp_aux, local_auxesz, nlist_bfd_global); } cs->c_name = getsymname (sym); cs->c_value = sym->n_value; @@ -1232,7 +1232,7 @@ init_stringtab (bfd *abfd, long offset) if (bfd_seek (abfd, offset, 0) < 0) return -1; - val = bfd_read ((char *) lengthbuf, sizeof lengthbuf, 1, abfd); + val = bfd_bread ((char *) lengthbuf, sizeof lengthbuf, abfd); length = bfd_h_get_32 (symfile_bfd, lengthbuf); /* If no string table is needed, then the file may end immediately @@ -1247,7 +1247,8 @@ init_stringtab (bfd *abfd, long offset) if (length == sizeof length) /* Empty table -- just the count */ return 0; - val = bfd_read (stringtab + sizeof lengthbuf, length - sizeof lengthbuf, 1, abfd); + val = bfd_bread (stringtab + sizeof lengthbuf, length - sizeof lengthbuf, + abfd); if (val != length - sizeof lengthbuf || stringtab[length - 1] != '\0') return -1; @@ -1346,7 +1347,7 @@ init_lineno (bfd *abfd, long offset, int size) /* Allocate the desired table, plus a sentinel */ linetab = (char *) xmalloc (size + local_linesz); - val = bfd_read (linetab, size, 1, abfd); + val = bfd_bread (linetab, size, abfd); if (val != size) return -1; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 04acd4ebc5d..ca688d890c3 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -700,7 +700,7 @@ dbx_symfile_init (struct objfile *objfile) perror_with_name (name); memset ((PTR) size_temp, 0, sizeof (size_temp)); - val = bfd_read ((PTR) size_temp, sizeof (size_temp), 1, sym_bfd); + val = bfd_bread ((PTR) size_temp, sizeof (size_temp), sym_bfd); if (val < 0) { perror_with_name (name); @@ -739,8 +739,9 @@ dbx_symfile_init (struct objfile *objfile) val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, SEEK_SET); if (val < 0) perror_with_name (name); - val = bfd_read (DBX_STRINGTAB (objfile), DBX_STRINGTAB_SIZE (objfile), 1, - sym_bfd); + val = bfd_bread (DBX_STRINGTAB (objfile), + DBX_STRINGTAB_SIZE (objfile), + sym_bfd); if (val != DBX_STRINGTAB_SIZE (objfile)) perror_with_name (name); } @@ -931,7 +932,7 @@ fill_symbuf (bfd *sym_bfd) count = sizeof (symbuf); } - nbytes = bfd_read ((PTR) symbuf, count, 1, sym_bfd); + nbytes = bfd_bread ((PTR) symbuf, count, sym_bfd); if (nbytes < 0) perror_with_name (bfd_get_filename (sym_bfd)); else if (nbytes == 0) @@ -2501,7 +2502,7 @@ coffstab_build_psymtabs (struct objfile *objfile, int mainline, val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET); if (val < 0) perror_with_name (name); - val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, 1, sym_bfd); + val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd); if (val != stabstrsize) perror_with_name (name); @@ -2597,7 +2598,7 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline, val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET); if (val < 0) perror_with_name (name); - val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, 1, sym_bfd); + val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd); if (val != stabstrsize) perror_with_name (name); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 478b4671566..f9716b27701 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3030,7 +3030,7 @@ dwarf2_read_section (struct objfile *objfile, file_ptr offset, buf = (char *) obstack_alloc (&objfile->psymbol_obstack, size); if ((bfd_seek (abfd, offset, SEEK_SET) != 0) || - (bfd_read (buf, size, 1, abfd) != size)) + (bfd_bread (buf, size, abfd) != size)) { buf = NULL; error ("Dwarf Error: Can't read DWARF data from '%s'", diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index d6258b33df9..a78b199d95d 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -695,7 +695,7 @@ dwarf_build_psymtabs (struct objfile *objfile, int mainline, file_ptr dbfoff, dbbase = xmalloc (dbsize); dbroff = 0; if ((bfd_seek (abfd, dbfoff, SEEK_SET) != 0) || - (bfd_read (dbbase, dbsize, 1, abfd) != dbsize)) + (bfd_bread (dbbase, dbsize, abfd) != dbsize)) { xfree (dbbase); error ("can't read DWARF data from '%s'", bfd_get_filename (abfd)); @@ -2269,7 +2269,7 @@ read_ofile_symtab (struct partial_symtab *pst) base_section_offsets = pst->section_offsets; baseaddr = ANOFFSET (pst->section_offsets, 0); if (bfd_seek (abfd, foffset, SEEK_SET) || - (bfd_read (dbbase, dbsize, 1, abfd) != dbsize)) + (bfd_bread (dbbase, dbsize, abfd) != dbsize)) { xfree (dbbase); error ("can't read DWARF data"); @@ -2285,8 +2285,8 @@ read_ofile_symtab (struct partial_symtab *pst) if (LNFOFF (pst)) { if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) || - (bfd_read ((PTR) lnsizedata, sizeof (lnsizedata), 1, abfd) != - sizeof (lnsizedata))) + (bfd_bread ((PTR) lnsizedata, sizeof (lnsizedata), abfd) + != sizeof (lnsizedata))) { error ("can't read DWARF line number table size"); } @@ -2294,7 +2294,7 @@ read_ofile_symtab (struct partial_symtab *pst) GET_UNSIGNED, pst->objfile); lnbase = xmalloc (lnsize); if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) || - (bfd_read (lnbase, lnsize, 1, abfd) != lnsize)) + (bfd_bread (lnbase, lnsize, abfd) != lnsize)) { xfree (lnbase); error ("can't read DWARF line numbers"); diff --git a/gdb/somread.c b/gdb/somread.c index be41501fa09..5afb15c09bb 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -1,5 +1,5 @@ /* Read HP PA/Risc object files for GDB. - Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000 + Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. @@ -101,13 +101,13 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, buf = alloca (symsize * number_of_symbols); bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET); - val = bfd_read (buf, symsize * number_of_symbols, 1, abfd); + val = bfd_bread (buf, symsize * number_of_symbols, abfd); if (val != symsize * number_of_symbols) error ("Couldn't read symbol dictionary!"); stringtab = alloca (obj_som_stringtab_size (abfd)); bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET); - val = bfd_read (stringtab, obj_som_stringtab_size (abfd), 1, abfd); + val = bfd_bread (stringtab, obj_som_stringtab_size (abfd), abfd); if (val != obj_som_stringtab_size (abfd)) error ("Can't read in HP string table."); diff --git a/gdb/ultra3-nat.c b/gdb/ultra3-nat.c index 3b7368099c6..e38a42f7474 100644 --- a/gdb/ultra3-nat.c +++ b/gdb/ultra3-nat.c @@ -273,7 +273,7 @@ /* OBSOLETE if (!CANNOT_FETCH_REGISTER (regno)) */ /* OBSOLETE { */ /* OBSOLETE val = bfd_seek (core_bfd, (file_ptr) register_addr (regno, 0), SEEK_SET); */ -/* OBSOLETE if (val < 0 || (val = bfd_read (buf, sizeof buf, 1, core_bfd)) < 0) */ +/* OBSOLETE if (val != 0 || (val = bfd_bread (buf, sizeof buf, core_bfd)) != sizeof buf) */ /* OBSOLETE { */ /* OBSOLETE char *buffer = (char *) alloca (strlen (REGISTER_NAME (regno)) + 35); */ /* OBSOLETE strcpy (buffer, "Reading core register "); */ diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 5e7b93504a7..f071fda2b04 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1,6 +1,6 @@ /* Read AIX xcoff symbol tables and convert to internal format, for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000 + 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Derived from coffread.c, dbxread.c, and a lot of hacking. Contributed by IBM Corporation. @@ -817,7 +817,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff while (curoffset <= limit_offset) { bfd_seek (abfd, curoffset, SEEK_SET); - bfd_read (ext_lnno, linesz, 1, abfd); + bfd_bread (ext_lnno, linesz, abfd); bfd_coff_swap_lineno_in (abfd, ext_lnno, &int_lnno); /* Find the address this line represents. */ @@ -1923,7 +1923,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) error ("cannot seek to string table in %s: %s", bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); - val = bfd_read ((char *) lengthbuf, 1, sizeof lengthbuf, abfd); + val = bfd_bread ((char *) lengthbuf, sizeof lengthbuf, abfd); length = bfd_h_get_32 (abfd, lengthbuf); /* If no string table is needed, then the file may end immediately @@ -1944,8 +1944,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) if (length == sizeof lengthbuf) return; - val = bfd_read (strtbl + sizeof lengthbuf, 1, length - sizeof lengthbuf, - abfd); + val = bfd_bread (strtbl + sizeof lengthbuf, length - sizeof lengthbuf, abfd); if (val != length - sizeof lengthbuf) error ("cannot read string table from %s: %s", @@ -2677,8 +2676,8 @@ xcoff_initial_scan (struct objfile *objfile, int mainline) ((struct coff_symfile_info *) objfile->sym_private)->symtbl_num_syms = num_symbols; - val = bfd_read (((struct coff_symfile_info *) objfile->sym_private)->symtbl, - size, 1, abfd); + val = bfd_bread (((struct coff_symfile_info *) objfile->sym_private)->symtbl, + size, abfd); if (val != size) perror_with_name ("reading symbol table"); -- 2.30.2