Sun Oct 31 09:28:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * symfile.h (sym_fns), symfile.c (find_sym_fns), xcoffread.c,
+ coffread.c, dbxread.c, elfread.c, mipsread.c, nlmread.c, paread.c:
+ Change from using bfd target name to using the flavour.
+
* objfiles.h, infcmd.c, symfile.c: Add comments about how various
objfiles get created and when we should blow them away.
static struct sym_fns coff_sym_fns =
{
- "coff", /* sym_name: name or name prefix of BFD target type */
- 4, /* sym_namelen: number of significant sym_name chars */
+ bfd_target_coff_flavour,
coff_new_init, /* sym_new_init: init anything gbl to entire symtab */
coff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
coff_symfile_read, /* sym_read: read a symbol file into symtab */
return section_offsets;
}
\f
-/* Register our willingness to decode symbols for SunOS and a.out and
- NetBSD and b.out files handled by BFD... */
-static struct sym_fns sunos_sym_fns =
-{
- "sunOs", /* sym_name: name or name prefix of BFD target type */
- 6, /* sym_namelen: number of significant sym_name chars */
- dbx_new_init, /* sym_new_init: init anything gbl to entire symtab */
- dbx_symfile_init, /* sym_init: read initial info, setup for sym_read() */
- dbx_symfile_read, /* sym_read: read a symbol file into symtab */
- dbx_symfile_finish, /* sym_finish: finished with file, cleanup */
- dbx_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */
- NULL /* next: pointer to next struct sym_fns */
-};
-
static struct sym_fns aout_sym_fns =
{
- "a.out", /* sym_name: name or name prefix of BFD target type */
- 5, /* sym_namelen: number of significant sym_name chars */
- dbx_new_init, /* sym_new_init: init anything gbl to entire symtab */
- dbx_symfile_init, /* sym_init: read initial info, setup for sym_read() */
- dbx_symfile_read, /* sym_read: read a symbol file into symtab */
- dbx_symfile_finish, /* sym_finish: finished with file, cleanup */
- dbx_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */
- NULL /* next: pointer to next struct sym_fns */
-};
-
-static struct sym_fns bout_sym_fns =
-{
- "b.out", /* sym_name: name or name prefix of BFD target type */
- 5, /* sym_namelen: number of significant sym_name chars */
+ bfd_target_aout_flavour,
dbx_new_init, /* sym_new_init: init anything gbl to entire symtab */
dbx_symfile_init, /* sym_init: read initial info, setup for sym_read() */
dbx_symfile_read, /* sym_read: read a symbol file into symtab */
void
_initialize_dbxread ()
{
- add_symtab_fns(&sunos_sym_fns);
add_symtab_fns(&aout_sym_fns);
- add_symtab_fns(&bout_sym_fns);
}
static struct sym_fns elf_sym_fns =
{
- "elf", /* sym_name: name or name prefix of BFD target type */
- 3, /* sym_namelen: number of significant sym_name chars */
+ bfd_target_elf_flavour,
elf_new_init, /* sym_new_init: init anything gbl to entire symtab */
elf_symfile_init, /* sym_init: read initial info, setup for sym_read() */
elf_symfile_read, /* sym_read: read a symbol file into symtab */
static struct sym_fns ecoff_sym_fns =
{
- "ecoff", /* sym_name: name or name prefix of BFD target type */
- 5, /* sym_namelen: number of significant sym_name chars */
+ bfd_target_ecoff_flavour,
mipscoff_new_init, /* sym_new_init: init anything gbl to entire symtab */
mipscoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
mipscoff_symfile_read, /* sym_read: read a symbol file into symtab */
static struct sym_fns nlm_sym_fns =
{
- "nlm", /* sym_name: name or name prefix of BFD target type */
- 3, /* sym_namelen: number of significant sym_name chars */
+ bfd_target_nlm_flavour,
nlm_new_init, /* sym_new_init: init anything gbl to entire symtab */
nlm_symfile_init, /* sym_init: read initial info, setup for sym_read() */
nlm_symfile_read, /* sym_read: read a symbol file into symtab */
static struct sym_fns pa_sym_fns =
{
- "som", /* sym_name: name or name prefix of BFD target type */
- 3, /* sym_namelen: number of significant sym_name chars */
+ bfd_target_som_flavour
pa_new_init, /* sym_new_init: init anything gbl to entire symtab */
pa_symfile_init, /* sym_init: read initial info, setup for sym_read() */
pa_symfile_read, /* sym_read: read a symbol file into symtab */
struct objfile *objfile;
{
struct sym_fns *sf;
+ enum bfd_flavour our_flavour = bfd_get_flavour (objfile -> obfd);
+
+ /* Special kludge for RS/6000. See xcoffread.c. */
+ if (STREQ (bfd_get_target (objfile -> obfd), "aixcoff-rs6000"))
+ our_flavour = (enum bfd_flavour)-1;
for (sf = symtab_fns; sf != NULL; sf = sf -> next)
{
- if (strncmp (bfd_get_target (objfile -> obfd),
- sf -> sym_name, sf -> sym_namelen) == 0)
+ if (our_flavour == sf -> sym_flavour)
{
objfile -> sf = sf;
return;
return section_offsets;
}
-/* Register our ability to parse symbols for xcoff BFD files. */
+
+/* Register our ability to parse symbols for xcoff BFD files. */
static struct sym_fns xcoff_sym_fns =
{
- "aixcoff-rs6000", /* sym_name: name or name prefix of BFD target type */
- 15, /* sym_namelen: number of significant sym_name chars */
+
+ /* Because the bfd uses coff_flavour, we need to specially kludge
+ the flavour. FIXME: coff and xcoff and fundamentally similar
+ except for debug format, and we should see if we can merge this
+ file with coffread.c. For example, the extra storage classes
+ used for stabs could presumably be recognized in any COFF file. */
+
+ (bfd_flavour)-1,
+
xcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */
xcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
xcoff_symfile_read, /* sym_read: read a symbol file into symtab */