+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.
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
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! */
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 */
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");
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)
{
}
xfree (hfiles);
}
- xfree (objfile->sym_stab_info);
+ xfree (objfile->deprecated_sym_stab_info);
}
free_header_files ();
}
/* 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;
/* 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. */
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)
/* 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)
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);
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;
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);
}
}
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;
};
/* 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
{
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)
/* 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)
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;
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);
}
}
\f
/* 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. */
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);
}
}
/* 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;
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
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);
}
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));
{
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. */
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)
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;
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];
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)
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
{
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");
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;
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
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. */
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",
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. */
}
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;
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)
{
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. */
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;
}
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;
}
}
}
- ((struct coff_symfile_info *) objfile->sym_private)->debugsec =
+ ((struct coff_symfile_info *) objfile->deprecated_sym_private)->debugsec =
debugsec;
}
}
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");