2004-10-23 Andrew Cagney <cagney@gnu.org>

* objfiles.h (struct objfile): Rename obj_private to
	deprecated_obj_private, sym_private to deprecated_sym_private, and
	sym_stab_info to deprecated_sym_stab_info.
	* gdb-stabs.h: Update.
	* elfread.c: Update.
	* dbxread.c: Update.
	* coffread.c: Update.
	* xcoffread.c: Update.
	* symfile.c: Update.
	* somread.c: Update.
	* nlmread.c: Update.
	* mdebugread.c: Update.
	* hpread.c: Update.
	* coffread.c: Update.
This commit is contained in:
Andrew Cagney 2004-10-23 16:18:09 +00:00
parent 384ee23f42
commit 0a6ddd0822
12 changed files with 100 additions and 75 deletions

View File

@ -1,3 +1,20 @@
2004-10-23 Andrew Cagney <cagney@gnu.org>
* objfiles.h (struct objfile): Rename obj_private to
deprecated_obj_private, sym_private to deprecated_sym_private, and
sym_stab_info to deprecated_sym_stab_info.
* gdb-stabs.h: Update.
* elfread.c: Update.
* dbxread.c: Update.
* coffread.c: Update.
* xcoffread.c: Update.
* symfile.c: Update.
* somread.c: Update.
* nlmread.c: Update.
* mdebugread.c: Update.
* hpread.c: Update.
* coffread.c: Update.
2004-10-23 Mark Kettenis <kettenis@gnu.org>
* mips64obsd-nat.c, mips64obsd-tdep.c: New files.

View File

@ -436,16 +436,16 @@ static void
coff_symfile_init (struct objfile *objfile)
{
/* Allocate struct to keep track of stab reading. */
objfile->sym_stab_info = (struct dbx_symfile_info *)
objfile->deprecated_sym_stab_info = (struct dbx_symfile_info *)
xmalloc (sizeof (struct dbx_symfile_info));
memset (objfile->sym_stab_info, 0,
memset (objfile->deprecated_sym_stab_info, 0,
sizeof (struct dbx_symfile_info));
/* Allocate struct to keep track of the symfile */
objfile->sym_private = xmalloc (sizeof (struct coff_symfile_info));
objfile->deprecated_sym_private = xmalloc (sizeof (struct coff_symfile_info));
memset (objfile->sym_private, 0, sizeof (struct coff_symfile_info));
memset (objfile->deprecated_sym_private, 0, sizeof (struct coff_symfile_info));
/* COFF objects may be reordered, so set OBJF_REORDERED. If we
find this causes a significant slowdown in gdb then we could
@ -512,8 +512,8 @@ coff_symfile_read (struct objfile *objfile, int mainline)
int len;
char * target;
info = (struct coff_symfile_info *) objfile->sym_private;
dbxinfo = objfile->sym_stab_info;
info = (struct coff_symfile_info *) objfile->deprecated_sym_private;
dbxinfo = objfile->deprecated_sym_stab_info;
symfile_bfd = abfd; /* Kludge for swap routines */
/* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
@ -659,9 +659,9 @@ coff_new_init (struct objfile *ignore)
static void
coff_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
if (objfile->deprecated_sym_private != NULL)
{
xfree (objfile->sym_private);
xfree (objfile->deprecated_sym_private);
}
/* Let stabs reader clean up */

View File

@ -623,9 +623,9 @@ dbx_symfile_init (struct objfile *objfile)
unsigned char size_temp[DBX_STRINGTAB_SIZE_SIZE];
/* Allocate struct to keep track of the symfile */
objfile->sym_stab_info = (struct dbx_symfile_info *)
objfile->deprecated_sym_stab_info = (struct dbx_symfile_info *)
xmalloc (sizeof (struct dbx_symfile_info));
memset (objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
memset (objfile->deprecated_sym_stab_info, 0, sizeof (struct dbx_symfile_info));
DBX_TEXT_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
DBX_DATA_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".data");
@ -733,7 +733,7 @@ dbx_symfile_init (struct objfile *objfile)
static void
dbx_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_stab_info != NULL)
if (objfile->deprecated_sym_stab_info != NULL)
{
if (HEADER_FILES (objfile) != NULL)
{
@ -747,7 +747,7 @@ dbx_symfile_finish (struct objfile *objfile)
}
xfree (hfiles);
}
xfree (objfile->sym_stab_info);
xfree (objfile->deprecated_sym_stab_info);
}
free_header_files ();
}
@ -3239,7 +3239,7 @@ coffstab_build_psymtabs (struct objfile *objfile, int mainline,
/* There is already a dbx_symfile_info allocated by our caller.
It might even contain some info from the coff symtab to help us. */
info = objfile->sym_stab_info;
info = objfile->deprecated_sym_stab_info;
DBX_TEXT_ADDR (objfile) = textaddr;
DBX_TEXT_SIZE (objfile) = textsize;
@ -3331,7 +3331,7 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline,
/* There is already a dbx_symfile_info allocated by our caller.
It might even contain some info from the ELF symtab to help us. */
info = objfile->sym_stab_info;
info = objfile->deprecated_sym_stab_info;
/* Find the first and last text address. dbx_symfile_read seems to
want this. */
@ -3423,9 +3423,9 @@ stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name,
error ("stabsect_build_psymtabs: Found stabs (%s), but not string section (%s)",
stab_name, stabstr_name);
objfile->sym_stab_info = (struct dbx_symfile_info *)
objfile->deprecated_sym_stab_info = (struct dbx_symfile_info *)
xmalloc (sizeof (struct dbx_symfile_info));
memset (objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
memset (objfile->deprecated_sym_stab_info, 0, sizeof (struct dbx_symfile_info));
text_sect = bfd_get_section_by_name (sym_bfd, text_name);
if (!text_sect)

View File

@ -162,7 +162,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
/* Name of filesym, as saved on the objfile_obstack. */
char *filesymname = obsavestring ("", 0, &objfile->objfile_obstack);
#endif
struct dbx_symfile_info *dbx = objfile->sym_stab_info;
struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info;
int stripped = (bfd_get_symcount (objfile->obfd) == 0);
if (dynamic)
@ -498,13 +498,13 @@ elf_symfile_read (struct objfile *objfile, int mainline)
memset ((char *) &ei, 0, sizeof (ei));
/* Allocate struct to keep track of the symfile */
objfile->sym_stab_info = (struct dbx_symfile_info *)
objfile->deprecated_sym_stab_info = (struct dbx_symfile_info *)
xmalloc (sizeof (struct dbx_symfile_info));
memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
memset ((char *) objfile->deprecated_sym_stab_info, 0, sizeof (struct dbx_symfile_info));
make_cleanup (free_elfinfo, (void *) objfile);
/* Process the normal ELF symbol table first. This may write some
chain of info into the dbx_symfile_info in objfile->sym_stab_info,
chain of info into the dbx_symfile_info in objfile->deprecated_sym_stab_info,
which can later be used by elfstab_offset_sections. */
elf_symtab_read (objfile, 0);
@ -594,14 +594,15 @@ elf_symfile_read (struct objfile *objfile, int mainline)
dwarf2_build_frame_info (objfile);
}
/* This cleans up the objfile's sym_stab_info pointer, and the chain of
stab_section_info's, that might be dangling from it. */
/* This cleans up the objfile's deprecated_sym_stab_info pointer, and
the chain of stab_section_info's, that might be dangling from
it. */
static void
free_elfinfo (void *objp)
{
struct objfile *objfile = (struct objfile *) objp;
struct dbx_symfile_info *dbxinfo = objfile->sym_stab_info;
struct dbx_symfile_info *dbxinfo = objfile->deprecated_sym_stab_info;
struct stab_section_info *ssi, *nssi;
ssi = dbxinfo->stab_section_info;
@ -637,9 +638,9 @@ elf_new_init (struct objfile *ignore)
static void
elf_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_stab_info != NULL)
if (objfile->deprecated_sym_stab_info != NULL)
{
xfree (objfile->sym_stab_info);
xfree (objfile->deprecated_sym_stab_info);
}
}
@ -673,7 +674,7 @@ void
elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
{
char *filename = pst->filename;
struct dbx_symfile_info *dbx = objfile->sym_stab_info;
struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info;
struct stab_section_info *maybe = dbx->stab_section_info;
struct stab_section_info *questionable = 0;
int i;

View File

@ -44,8 +44,8 @@ struct stab_section_info
};
/* Information is passed among various dbxread routines for accessing
symbol files. A pointer to this structure is kept in the sym_stab_info
field of the objfile struct. */
symbol files. A pointer to this structure is kept in the
deprecated_sym_stab_info field of the objfile struct. */
struct dbx_symfile_info
{
@ -74,7 +74,7 @@ struct dbx_symfile_info
asection *stab_section;
};
#define DBX_SYMFILE_INFO(o) ((o)->sym_stab_info)
#define DBX_SYMFILE_INFO(o) ((o)->deprecated_sym_stab_info)
#define DBX_TEXT_ADDR(o) (DBX_SYMFILE_INFO(o)->text_addr)
#define DBX_TEXT_SIZE(o) (DBX_SYMFILE_INFO(o)->text_size)
#define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount)

View File

@ -75,7 +75,7 @@ struct hpread_symfile_info
/* Accessor macros to get at the fields. */
#define HPUX_SYMFILE_INFO(o) \
((struct hpread_symfile_info *)((o)->sym_private))
((struct hpread_symfile_info *)((o)->deprecated_sym_private))
#define GNTT(o) (HPUX_SYMFILE_INFO(o)->gntt)
#define LNTT(o) (HPUX_SYMFILE_INFO(o)->lntt)
#define SLT(o) (HPUX_SYMFILE_INFO(o)->slt)
@ -1667,9 +1667,9 @@ hpread_symfile_init (struct objfile *objfile)
asection *vt_section, *slt_section, *lntt_section, *gntt_section;
/* Allocate struct to keep track of the symfile */
objfile->sym_private =
objfile->deprecated_sym_private =
xmalloc (sizeof (struct hpread_symfile_info));
memset (objfile->sym_private, 0, sizeof (struct hpread_symfile_info));
memset (objfile->deprecated_sym_private, 0, sizeof (struct hpread_symfile_info));
/* We haven't read in any types yet. */
DNTT_TYPE_VECTOR (objfile) = 0;
@ -2284,9 +2284,9 @@ hpread_build_psymtabs (struct objfile *objfile, int mainline)
void
hpread_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
if (objfile->deprecated_sym_private != NULL)
{
xfree (objfile->sym_private);
xfree (objfile->deprecated_sym_private);
}
}

View File

@ -536,9 +536,9 @@ struct mdebug_pending
/* The pending information is kept for an entire object file, and used
to be in the sym_private field. I took it out when I split
mdebugread from mipsread, because this might not be the only type
of symbols read from an object file. Instead, we allocate the
to be in the deprecated_sym_private field. I took it out when I
split mdebugread from mipsread, because this might not be the only
type of symbols read from an object file. Instead, we allocate the
pending information table when we create the partial symbols, and
we store a pointer to the single table in each psymtab. */

View File

@ -211,9 +211,9 @@ nlm_symfile_read (struct objfile *objfile, int mainline)
static void
nlm_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
if (objfile->deprecated_sym_private != NULL)
{
xfree (objfile->sym_private);
xfree (objfile->deprecated_sym_private);
}
}

View File

@ -338,26 +338,35 @@ struct objfile
/* Information about stabs. Will be filled in with a dbx_symfile_info
struct by those readers that need it. */
/* NOTE: cagney/2004-10-23: This has been replaced by per-objfile
data points implemented using "data" and "num_data" below. For
an example of how to use this replacement, see "objfile_data"
in "mips-tdep.c". */
struct dbx_symfile_info *sym_stab_info;
struct dbx_symfile_info *deprecated_sym_stab_info;
/* Hook for information for use by the symbol reader (currently used
for information shared by sym_init and sym_read). It is
typically a pointer to malloc'd memory. The symbol reader's finish
function is responsible for freeing the memory thusly allocated. */
/* NOTE: cagney/2004-10-23: This has been replaced by per-objfile
data points implemented using "data" and "num_data" below. For
an example of how to use this replacement, see "objfile_data"
in "mips-tdep.c". */
void *sym_private;
void *deprecated_sym_private;
/* Hook for target-architecture-specific information. This must
point to memory allocated on one of the obstacks in this objfile,
so that it gets freed automatically when reading a new object
file. */
void *obj_private;
void *deprecated_obj_private;
/* Per objfile data-pointers required by other GDB modules. */
/* FIXME: kettenis/20030711: This mechanism could replace
sym_stab_info, sym_private and obj_private entirely. */
deprecated_sym_stab_info, deprecated_sym_private and
deprecated_obj_private entirely. */
void **data;
unsigned num_data;

View File

@ -378,7 +378,7 @@ som_symfile_read (struct objfile *objfile, int mainline)
hpread_build_psymtabs (objfile, mainline);
/* Force hppa-tdep.c to re-read the unwind descriptors. */
objfile->obj_private = NULL;
objfile->deprecated_obj_private = NULL;
}
/* Initialize anything that needs initializing when a completely new symbol
@ -402,9 +402,9 @@ som_new_init (struct objfile *ignore)
static void
som_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_stab_info != NULL)
if (objfile->deprecated_sym_stab_info != NULL)
{
xfree (objfile->sym_stab_info);
xfree (objfile->deprecated_sym_stab_info);
}
hpread_symfile_finish (objfile);
}

View File

@ -1908,7 +1908,7 @@ reread_symbols (void)
objfile->free_psymtabs = NULL;
objfile->cp_namespace_symtab = NULL;
objfile->msymbols = NULL;
objfile->sym_private = NULL;
objfile->deprecated_sym_private = NULL;
objfile->minimal_symbol_count = 0;
memset (&objfile->msymbol_hash, 0,
sizeof (objfile->msymbol_hash));

View File

@ -553,7 +553,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
{
int offset, ii;
file_ptr max_offset =
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
((struct coff_symfile_info *) this_symtab_psymtab->objfile->deprecated_sym_private)
->max_lineno_offset;
/* subfile structure for the main compilation unit. */
@ -762,7 +762,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff
return;
curoffset = beginoffset;
limit_offset =
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
((struct coff_symfile_info *) this_symtab_psymtab->objfile->deprecated_sym_private)
->max_lineno_offset;
if (endoffset != 0)
@ -882,7 +882,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
else if (symbol.n_sclass & 0x80)
{
retval =
((struct coff_symfile_info *) objfile->sym_private)->debugsec
((struct coff_symfile_info *) objfile->deprecated_sym_private)->debugsec
+ symbol.n_offset;
raw_symbol +=
coff_data (objfile->obfd)->local_symesz;
@ -907,9 +907,9 @@ read_xcoff_symtab (struct partial_symtab *pst)
struct objfile *objfile = pst->objfile;
bfd *abfd = objfile->obfd;
char *raw_auxptr; /* Pointer to first raw aux entry for sym */
char *strtbl = ((struct coff_symfile_info *) objfile->sym_private)->strtbl;
char *strtbl = ((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl;
char *debugsec =
((struct coff_symfile_info *) objfile->sym_private)->debugsec;
((struct coff_symfile_info *) objfile->deprecated_sym_private)->debugsec;
char *debugfmt = bfd_xcoff_is_xcoff64 (abfd) ? "XCOFF64" : "XCOFF";
struct internal_syment symbol[1];
@ -955,7 +955,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
first_object_file_end = 0;
raw_symbol =
((struct coff_symfile_info *) objfile->sym_private)->symtbl
((struct coff_symfile_info *) objfile->deprecated_sym_private)->symtbl
+ symnum * local_symesz;
while (symnum < max_symnum)
@ -1581,7 +1581,7 @@ coff_getfilename (union internal_auxent *aux_entry, struct objfile *objfile)
if (aux_entry->x_file.x_n.x_zeroes == 0)
strcpy (buffer,
((struct coff_symfile_info *) objfile->sym_private)->strtbl
((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl
+ aux_entry->x_file.x_n.x_offset);
else
{
@ -1596,11 +1596,9 @@ static void
read_symbol (struct internal_syment *symbol, int symno)
{
int nsyms =
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
->symtbl_num_syms;
((struct coff_symfile_info *) this_symtab_psymtab->objfile->deprecated_sym_private)->symtbl_num_syms;
char *stbl =
((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
->symtbl;
((struct coff_symfile_info *) this_symtab_psymtab->objfile->deprecated_sym_private)->symtbl;
if (symno < 0 || symno >= nsyms)
{
complaint (&symfile_complaints, "Invalid symbol offset");
@ -1635,7 +1633,7 @@ read_symbol_lineno (int symno)
int xcoff64 = bfd_xcoff_is_xcoff64 (objfile->obfd);
struct coff_symfile_info *info =
(struct coff_symfile_info *)objfile->sym_private;
(struct coff_symfile_info *)objfile->deprecated_sym_private;
int nsyms = info->symtbl_num_syms;
char *stbl = info->symtbl;
char *strtbl = info->strtbl;
@ -1838,7 +1836,7 @@ static void
xcoff_symfile_init (struct objfile *objfile)
{
/* Allocate struct to keep track of the symfile */
objfile->sym_private = xmalloc (sizeof (struct coff_symfile_info));
objfile->deprecated_sym_private = xmalloc (sizeof (struct coff_symfile_info));
/* XCOFF objects may be reordered, so set OBJF_REORDERED. If we
find this causes a significant slowdown in gdb then we could
@ -1856,9 +1854,9 @@ xcoff_symfile_init (struct objfile *objfile)
static void
xcoff_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
if (objfile->deprecated_sym_private != NULL)
{
xfree (objfile->sym_private);
xfree (objfile->deprecated_sym_private);
}
/* Start with a fresh include table for the next objfile. */
@ -1879,7 +1877,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
unsigned char lengthbuf[4];
char *strtbl;
((struct coff_symfile_info *) objfile->sym_private)->strtbl = NULL;
((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl = NULL;
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
error ("cannot seek to string table in %s: %s",
@ -1898,7 +1896,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
as long as we have its symbol table around. */
strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length);
((struct coff_symfile_info *) objfile->sym_private)->strtbl = strtbl;
((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl = strtbl;
/* Copy length buffer, the first byte is usually zero and is
used for stabs with a name length of zero. */
@ -2093,12 +2091,12 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
}
else if (symbol->n_sclass & 0x80)
{
*name = ((struct coff_symfile_info *) objfile->sym_private)->debugsec
*name = ((struct coff_symfile_info *) objfile->deprecated_sym_private)->debugsec
+ symbol->n_offset;
}
else
{
*name = ((struct coff_symfile_info *) objfile->sym_private)->strtbl
*name = ((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl
+ symbol->n_offset;
}
++*symnump;
@ -2173,8 +2171,8 @@ scan_xcoff_symtab (struct objfile *objfile)
abfd = objfile->obfd;
sraw_symbol = ((struct coff_symfile_info *) objfile->sym_private)->symtbl;
nsyms = ((struct coff_symfile_info *) objfile->sym_private)->symtbl_num_syms;
sraw_symbol = ((struct coff_symfile_info *) objfile->deprecated_sym_private)->symtbl;
nsyms = ((struct coff_symfile_info *) objfile->deprecated_sym_private)->symtbl_num_syms;
ssymnum = 0;
while (ssymnum < nsyms)
{
@ -2823,7 +2821,7 @@ scan_xcoff_symtab (struct objfile *objfile)
If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain
this information would be file auxiliary header. */
((struct coff_symfile_info *) objfile->sym_private)->toc_offset = toc_offset;
((struct coff_symfile_info *) objfile->deprecated_sym_private)->toc_offset = toc_offset;
}
/* Return the toc offset value for a given objfile. */
@ -2832,7 +2830,7 @@ CORE_ADDR
get_toc_offset (struct objfile *objfile)
{
if (objfile)
return ((struct coff_symfile_info *) objfile->sym_private)->toc_offset;
return ((struct coff_symfile_info *) objfile->deprecated_sym_private)->toc_offset;
return 0;
}
@ -2859,7 +2857,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline)
char *name;
unsigned int size;
info = (struct coff_symfile_info *) objfile->sym_private;
info = (struct coff_symfile_info *) objfile->deprecated_sym_private;
symfile_bfd = abfd = objfile->obfd;
name = objfile->name;
@ -2900,7 +2898,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline)
}
}
}
((struct coff_symfile_info *) objfile->sym_private)->debugsec =
((struct coff_symfile_info *) objfile->deprecated_sym_private)->debugsec =
debugsec;
}
}
@ -2912,12 +2910,12 @@ xcoff_initial_scan (struct objfile *objfile, int mainline)
error ("Error reading symbols from %s: %s",
name, bfd_errmsg (bfd_get_error ()));
size = coff_data (abfd)->local_symesz * num_symbols;
((struct coff_symfile_info *) objfile->sym_private)->symtbl =
((struct coff_symfile_info *) objfile->deprecated_sym_private)->symtbl =
obstack_alloc (&objfile->objfile_obstack, size);
((struct coff_symfile_info *) objfile->sym_private)->symtbl_num_syms =
((struct coff_symfile_info *) objfile->deprecated_sym_private)->symtbl_num_syms =
num_symbols;
val = bfd_bread (((struct coff_symfile_info *) objfile->sym_private)->symtbl,
val = bfd_bread (((struct coff_symfile_info *) objfile->deprecated_sym_private)->symtbl,
size, abfd);
if (val != size)
perror_with_name ("reading symbol table");