Lint around file_ptr's (bfd's off_t's) and bfd_seek.

* dbxread.c (read_dbx_symtab):  Use L_SET as bfd_seek arg.
(elfstab_build_psymtabs):  staboffset and stabstroffset args are
file_ptr's.
* dwarfread.c (struct dwfinfo):  Convert dbfoff, lnfoff to file_ptr.
(scan_compilation_units):  Punt unused filename arg.  dbfoff,
lnoffset, and curlnoffset are file_ptr's now.
(dwarf_build_psymtabs):  Drop desc and filename args; use
objfile.  dbfoff and lnoffset are file_ptr's now.
(read_ofile_symtab):  foffset is now file_ptr.  Use L_SET in bfd_seek.
* elfread.c (struct elfinfo):  dboffset and lnoffset are file_ptr's.
(elf_symfile_read):  Skip desc and filename args to
dwarf_build_psymtabs.  Pass file_ptr's to elfstab_build_psymtabs.
* gdb-stabs.h:  Use file_ptr rather than off_t.
* mipsread.c (fixup_symtab): f_ptr is a file_ptr.  Re-enable
compile-time debug check that someone turned off as "unused".
(read_the_mips_symtab):  st_filptr is a file_ptr.  Fix bfd_seek call.
* symfile.h:  Update dwarf_build_psymtabs and
elfstab_build_psymtabs prototypes.
* xcoffread.c (init_stringtab, init_lineno, xcoff_symfile_read):
Use file_ptr offsets.  bfd_seeks use L_SET.
This commit is contained in:
John Gilmore 1992-10-15 13:40:40 +00:00
parent 6803d8186f
commit d5931d797d
6 changed files with 106 additions and 64 deletions

View File

@ -1,3 +1,43 @@
Thu Oct 15 02:59:30 1992 John Gilmore (gnu@cygnus.com)
* Makefile.in (VERSION): Roll to 4.6.8.
(OBS): Put version.o first, so Makefile rebuild happens early.
* command.h: Publicize prototype for not_just_help_class_command.
* command.c: Remove proto.
* maint.c (maintenance_init): Mark "mt" as an abbrev, to avoid
duplicated help output. Move "maint info" from class info to
class maintenance, and improve text.
* infrun.c (): Move "stop" to class_obscure, and give it a
function so it will not be seen as a global help topic. FIXME,
it should be possible to set these attributes independently.
* core.c (core_command): Make nicer error message for no core support.
Lint around file_ptr's (bfd's off_t's) and bfd_seek.
* dbxread.c (read_dbx_symtab): Use L_SET as bfd_seek arg.
(elfstab_build_psymtabs): staboffset and stabstroffset args are
file_ptr's.
* dwarfread.c (struct dwfinfo): Convert dbfoff, lnfoff to file_ptr.
(scan_compilation_units): Punt unused filename arg. dbfoff,
lnoffset, and curlnoffset are file_ptr's now.
(dwarf_build_psymtabs): Drop desc and filename args; use
objfile. dbfoff and lnoffset are file_ptr's now.
(read_ofile_symtab): foffset is now file_ptr. Use L_SET in bfd_seek.
* elfread.c (struct elfinfo): dboffset and lnoffset are file_ptr's.
(elf_symfile_read): Skip desc and filename args to
dwarf_build_psymtabs. Pass file_ptr's to elfstab_build_psymtabs.
* gdb-stabs.h: Use file_ptr rather than off_t.
* mipsread.c (fixup_symtab): f_ptr is a file_ptr. Re-enable
compile-time debug check that someone turned off as "unused".
(read_the_mips_symtab): st_filptr is a file_ptr. Fix bfd_seek call.
* symfile.h: Update dwarf_build_psymtabs and
elfstab_build_psymtabs prototypes.
* xcoffread.c (init_stringtab, init_lineno, xcoff_symfile_read):
Use file_ptr offsets. bfd_seeks use L_SET.
Thu Oct 15 01:27:32 1992 Stu Grossman (grossman at cygnus.com)
* mips-tdep.c, mipsread.c, tm-mips.h: Get rid of ".gdbinfo."
@ -92,7 +132,8 @@ Fri Oct 9 00:31:33 1992 K. Richard Pixley (rich@sendai.cygnus.com)
* config/irix4.mh (XDEPFILES): removed procfs.o fork-child.o.
(NAT_FILE, NATDEPFILES): new macros for native support.
(CC): supply default compiler switches.
* config/irix3.mh (XDEPFILES): removed infptrace.o inftarg.o fork-child.o coredep.o.
* config/irix3.mh (XDEPFILES): removed infptrace.o inftarg.o
fork-child.o coredep.o.
(NAT_FILE, NATDEPFILES): new macros for native support. Note that
irix3 is untested.
* config/decstation.mh (XDEPFILES): removed infptrace.o inftarg.o

View File

@ -41,10 +41,6 @@ other things to work on, if you get bored. :-)
*/
#include "defs.h"
#include <varargs.h>
#include <fcntl.h>
#include <string.h>
#include "bfd.h"
#include "symtab.h"
#include "gdbtypes.h"
@ -55,6 +51,18 @@ other things to work on, if you get bored. :-)
#include "buildsym.h"
#include "demangle.h"
#include <varargs.h>
#include <fcntl.h>
#include <string.h>
#ifndef NO_SYS_FILE
#include <sys/file.h>
#endif
/* FIXME -- convert this to SEEK_SET a la POSIX, move to config files. */
#ifndef L_SET
#define L_SET 0
#endif
#ifdef MAINTENANCE /* Define to 1 to compile in some maintenance stuff */
#define SQUAWK(stuff) dwarfwarn stuff
#else
@ -253,10 +261,10 @@ static struct section_offsets *base_section_offsets;
*/
struct dwfinfo {
int dbfoff; /* Absolute file offset to start of .debug section */
file_ptr dbfoff; /* Absolute file offset to start of .debug section */
int dbroff; /* Relative offset from start of .debug section */
int dblength; /* Size of the chunk of DIE's being examined */
int lnfoff; /* Absolute file offset to line table fragment */
file_ptr lnfoff; /* Absolute file offset to line table fragment */
};
#define DBFOFF(p) (((struct dwfinfo *)((p)->read_symtab_private))->dbfoff)
@ -342,8 +350,8 @@ static void
scan_partial_symbols PARAMS ((char *, char *, struct objfile *));
static void
scan_compilation_units PARAMS ((char *, char *, char *, unsigned int,
unsigned int, struct objfile *));
scan_compilation_units PARAMS ((char *, char *, file_ptr,
file_ptr, struct objfile *));
static void
add_partial_symbol PARAMS ((struct dieinfo *, struct objfile *));
@ -498,18 +506,17 @@ GLOBAL FUNCTION
SYNOPSIS
void dwarf_build_psymtabs (int desc, char *filename,
void dwarf_build_psymtabs (struct objfile *objfile,
struct section_offsets *section_offsets,
int mainline, unsigned int dbfoff, unsigned int dbfsize,
unsigned int lnoffset, unsigned int lnsize,
struct objfile *objfile)
int mainline, file_ptr dbfoff, unsigned int dbfsize,
file_ptr lnoffset, unsigned int lnsize)
DESCRIPTION
This function is called upon to build partial symtabs from files
containing DIE's (Dwarf Information Entries) and DWARF line numbers.
It is passed a file descriptor for an open file containing the DIES
It is passed a bfd* containing the DIES
and line number information, the corresponding filename for that
file, a base address for relocating the symbols, a flag indicating
whether or not this debugging information is from a "main symbol
@ -524,29 +531,28 @@ RETURNS
*/
void
dwarf_build_psymtabs (desc, filename, section_offsets, mainline, dbfoff, dbfsize,
lnoffset, lnsize, objfile)
int desc;
char *filename;
dwarf_build_psymtabs (objfile, section_offsets, mainline, dbfoff, dbfsize,
lnoffset, lnsize)
struct objfile *objfile;
struct section_offsets *section_offsets;
int mainline;
unsigned int dbfoff;
file_ptr dbfoff;
unsigned int dbfsize;
unsigned int lnoffset;
file_ptr lnoffset;
unsigned int lnsize;
struct objfile *objfile;
{
bfd *abfd = objfile->obfd;
struct cleanup *back_to;
current_objfile = objfile;
dbsize = dbfsize;
dbbase = xmalloc (dbsize);
dbroff = 0;
if ((lseek (desc, dbfoff, 0) != dbfoff) ||
(read (desc, dbbase, dbsize) != dbsize))
if ((bfd_seek (abfd, dbfoff, L_SET) != 0) ||
(bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
{
free (dbbase);
error ("can't read DWARF data from '%s'", filename);
error ("can't read DWARF data from '%s'", bfd_get_filename (abfd));
}
back_to = make_cleanup (free, dbbase);
@ -569,8 +575,7 @@ dwarf_build_psymtabs (desc, filename, section_offsets, mainline, dbfoff, dbfsize
table entry for each one. Save enough information about each compilation
unit to locate the full DWARF information later. */
scan_compilation_units (filename, dbbase, dbbase + dbsize,
dbfoff, lnoffset, objfile);
scan_compilation_units (dbbase, dbbase + dbsize, dbfoff, lnoffset, objfile);
do_cleanups (back_to);
current_objfile = NULL;
@ -2083,7 +2088,7 @@ read_ofile_symtab (pst)
{
struct cleanup *back_to;
unsigned long lnsize;
int foffset;
file_ptr foffset;
bfd *abfd;
char lnsizedata[SIZEOF_LINETBL_LENGTH];
@ -2100,7 +2105,7 @@ read_ofile_symtab (pst)
foffset = DBFOFF(pst) + dbroff;
base_section_offsets = pst->section_offsets;
baseaddr = ANOFFSET (pst->section_offsets, 0);
if (bfd_seek (abfd, foffset, 0) ||
if (bfd_seek (abfd, foffset, L_SET) ||
(bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
{
free (dbbase);
@ -2116,7 +2121,7 @@ read_ofile_symtab (pst)
lnbase = NULL;
if (LNFOFF (pst))
{
if (bfd_seek (abfd, LNFOFF (pst), 0) ||
if (bfd_seek (abfd, LNFOFF (pst), L_SET) ||
(bfd_read ((PTR) lnsizedata, sizeof (lnsizedata), 1, abfd) !=
sizeof (lnsizedata)))
{
@ -2125,7 +2130,7 @@ read_ofile_symtab (pst)
lnsize = target_to_host (lnsizedata, SIZEOF_LINETBL_LENGTH,
GET_UNSIGNED, pst -> objfile);
lnbase = xmalloc (lnsize);
if (bfd_seek (abfd, LNFOFF (pst), 0) ||
if (bfd_seek (abfd, LNFOFF (pst), L_SET) ||
(bfd_read (lnbase, lnsize, 1, abfd) != lnsize))
{
free (lnbase);
@ -2637,12 +2642,11 @@ RETURNS
*/
static void
scan_compilation_units (filename, thisdie, enddie, dbfoff, lnoffset, objfile)
char *filename;
scan_compilation_units (thisdie, enddie, dbfoff, lnoffset, objfile)
char *thisdie;
char *enddie;
unsigned int dbfoff;
unsigned int lnoffset;
file_ptr dbfoff;
file_ptr lnoffset;
struct objfile *objfile;
{
char *nextdie;
@ -2650,7 +2654,7 @@ scan_compilation_units (filename, thisdie, enddie, dbfoff, lnoffset, objfile)
struct partial_symtab *pst;
int culength;
int curoff;
int curlnoffset;
file_ptr curlnoffset;
while (thisdie < enddie)
{

View File

@ -42,8 +42,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symfile.h"
#include "objfiles.h"
#include "buildsym.h"
#include <sys/types.h> /* For off_t for gdb-stabs.h */
#include "gdb-stabs.h"
#define STREQ(a,b) (strcmp((a),(b))==0)
@ -53,9 +51,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
It's local to elf_symfile_read. */
struct elfinfo {
unsigned int dboffset; /* Offset to dwarf debug section */
file_ptr dboffset; /* Offset to dwarf debug section */
unsigned int dbsize; /* Size of dwarf debug section */
unsigned int lnoffset; /* Offset to dwarf line number section */
file_ptr lnoffset; /* Offset to dwarf line number section */
unsigned int lnsize; /* Size of dwarf line number section */
asection *stabsect; /* Section pointer for .stab section */
asection *stabindexsect; /* Section pointer for .stab.index section */
@ -464,11 +462,10 @@ elf_symfile_read (objfile, section_offsets, mainline)
if (ei.dboffset && ei.lnoffset)
{
/* DWARF sections */
dwarf_build_psymtabs (fileno ((FILE *)(abfd -> iostream)),
bfd_get_filename (abfd),
dwarf_build_psymtabs (objfile,
section_offsets, mainline,
ei.dboffset, ei.dbsize,
ei.lnoffset, ei.lnsize, objfile);
ei.lnoffset, ei.lnsize);
}
if (ei.stabsect)
{
@ -489,7 +486,7 @@ elf_symfile_read (objfile, section_offsets, mainline)
mainline,
ei.stabsect->filepos, /* .stab offset */
bfd_get_section_size_before_reloc (ei.stabsect),/* .stab size */
elf_sect->sh_offset, /* .stabstr offset */
(file_ptr) elf_sect->sh_offset, /* .stabstr offset */
elf_sect->sh_size); /* .stabstr size */
}

View File

@ -59,15 +59,15 @@ struct dbx_symfile_info {
int symcount; /* How many symbols are there in the file */
char *stringtab; /* The actual string table */
int stringtab_size; /* Its size */
off_t symtab_offset; /* Offset in file to symbol table */
file_ptr symtab_offset; /* Offset in file to symbol table */
int symbol_size; /* Bytes in a single symbol */
struct stab_section_info *stab_section_info; /* section starting points
of the original .o files before linking. */
/* FIXME: HP kludges that shouldn't be here, probably. */
/* FIXME: HP kludges that shouldn't be here. */
int hp_symcount;
char *hp_stringtab;
int hp_stringtab_size;
off_t hp_symtab_offset;
file_ptr hp_symtab_offset;
};
#define DBX_SYMFILE_INFO(o) ((struct dbx_symfile_info *)((o)->sym_private))

View File

@ -230,7 +230,7 @@ struct type *builtin_type_string;
/* Forward declarations */
static void
fixup_symtab PARAMS ((HDRR *, char *, int, bfd *));
fixup_symtab PARAMS ((HDRR *, char *, file_ptr, bfd *));
static void
read_mips_symtab PARAMS ((struct objfile *, struct section_offsets *));
@ -449,7 +449,7 @@ read_the_mips_symtab(abfd, end_of_text_segp)
CORE_ADDR *end_of_text_segp;
{
int stsize, st_hdrsize;
unsigned st_filptr;
file_ptr st_filptr;
struct hdr_ext hdr_ext;
HDRR st_hdr;
/* Header for executable/object file we read symbols from */
@ -457,7 +457,7 @@ read_the_mips_symtab(abfd, end_of_text_segp)
int val;
/* We need some info from the initial headers */
val = bfd_seek(abfd, 0L, L_SET);
val = bfd_seek(abfd, (file_ptr) 0, L_SET);
val = bfd_read((PTR)&filhdr, sizeof filhdr, 1, abfd);
if (end_of_text_segp)
@ -514,7 +514,7 @@ static void
fixup_symtab (hdr, data, f_ptr, abfd)
HDRR *hdr;
char *data;
int f_ptr;
file_ptr f_ptr;
bfd *abfd;
{
int f_idx, s_idx, i;
@ -526,8 +526,9 @@ fixup_symtab (hdr, data, f_ptr, abfd)
/* This function depends on the external and internal forms
of the MIPS symbol table taking identical space. Check this
assumption at compile-time. */
#if 0 /* FIXME: Unused */
assumption at compile-time.
DO NOT DELETE THESE ENTRIES, OR COMMENT THEM OUT, JUST BECAUSE SOME
"LINT" OR COMPILER THINKS THEY ARE UNUSED! Thank you. */
static check_hdr1[1 + sizeof (struct hdr_ext) - sizeof (HDRR)] = {0};
static check_hdr2[1 + sizeof (HDRR) - sizeof (struct hdr_ext)] = {0};
static check_fdr1[1 + sizeof (struct fdr_ext) - sizeof (FDR)] = {0};
@ -540,7 +541,6 @@ fixup_symtab (hdr, data, f_ptr, abfd)
static check_ext2[1 + sizeof (EXTR) - sizeof (struct ext_ext)] = {0};
static check_rfd1[1 + sizeof (struct rfd_ext) - sizeof (RFDT)] = {0};
static check_rfd2[1 + sizeof (RFDT) - sizeof (struct rfd_ext)] = {0};
#endif
/* Swap in the header record. */
ecoff_swap_hdr_in (abfd, hdr, hdr);

View File

@ -174,7 +174,7 @@ static int
init_debugsection PARAMS ((bfd *));
static int
init_stringtab PARAMS ((bfd *, long, struct objfile *));
init_stringtab PARAMS ((bfd *, file_ptr, struct objfile *));
static void
xcoff_symfile_init PARAMS ((struct objfile *));
@ -196,7 +196,7 @@ static struct section_offsets *
xcoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
static int
init_lineno PARAMS ((bfd *, long, int));
init_lineno PARAMS ((bfd *, file_ptr, int));
static void
find_linenos PARAMS ((bfd *, sec_ptr, PTR));
@ -2009,12 +2009,12 @@ PTR vpinfo;
static int
init_lineno (abfd, offset, size)
bfd *abfd;
long offset;
file_ptr offset;
int size;
{
int val;
if (bfd_seek(abfd, offset, 0) < 0)
if (bfd_seek(abfd, offset, L_SET) < 0)
return -1;
linetab = (char *) xmalloc(size);
@ -2150,14 +2150,14 @@ xcoff_symfile_finish (objfile)
static int
init_stringtab(abfd, offset, objfile)
bfd *abfd;
long offset;
file_ptr offset;
struct objfile *objfile;
{
long length;
int val;
unsigned char lengthbuf[4];
if (bfd_seek(abfd, offset, 0) < 0)
if (bfd_seek(abfd, offset, L_SET) < 0)
return -1;
val = bfd_read((char *)lengthbuf, 1, sizeof lengthbuf, abfd);
@ -2235,9 +2235,9 @@ xcoff_symfile_read (objfile, section_offset, mainline)
struct section_offset *section_offset;
int mainline;
{
int num_symbols; /* # of symbols */
int symtab_offset; /* symbol table and */
int stringtab_offset; /* string table file offsets */
int num_symbols; /* # of symbols */
file_ptr symtab_offset; /* symbol table and */
file_ptr stringtab_offset; /* string table file offsets */
int val;
bfd *abfd;
struct coff_symfile_info *info;
@ -2262,7 +2262,7 @@ xcoff_symfile_read (objfile, section_offset, mainline)
/* only read in the line # table if one exists */
val = init_lineno(abfd, info->min_lineno_offset,
info->max_lineno_offset - info->min_lineno_offset);
(int) (info->max_lineno_offset - info->min_lineno_offset));
if (val < 0)
error("\"%s\": error reading line numbers\n", name);
@ -2278,7 +2278,7 @@ xcoff_symfile_read (objfile, section_offset, mainline)
}
/* Position to read the symbol table. Do not read it all at once. */
val = bfd_seek(abfd, (long)symtab_offset, 0);
val = bfd_seek(abfd, symtab_offset, L_SET);
if (val < 0)
perror_with_name(name);