From 0eed42deeea0a78b272402f77644be0239f5ffb6 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Sun, 31 Oct 1993 18:54:28 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 4 ++++ gdb/coffread.c | 3 +-- gdb/dbxread.c | 31 +------------------------------ gdb/elfread.c | 3 +-- gdb/mipsread.c | 3 +-- gdb/nlmread.c | 3 +-- gdb/paread.c | 3 +-- gdb/symfile.c | 8 ++++++-- gdb/xcoffread.c | 14 +++++++++++--- 9 files changed, 27 insertions(+), 45 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 270b573be45..88dcf3f5c27 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 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. diff --git a/gdb/coffread.c b/gdb/coffread.c index 102d752fcd9..26d60c135db 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -2062,8 +2062,7 @@ coff_symfile_offsets (objfile, addr) 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 */ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index d423eec5e6e..b3c08d157db 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2188,36 +2188,9 @@ dbx_symfile_offsets (objfile, addr) return section_offsets; } -/* 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 */ @@ -2229,7 +2202,5 @@ static struct sym_fns bout_sym_fns = void _initialize_dbxread () { - add_symtab_fns(&sunos_sym_fns); add_symtab_fns(&aout_sym_fns); - add_symtab_fns(&bout_sym_fns); } diff --git a/gdb/elfread.c b/gdb/elfread.c index bbf4655fd26..1a0eee5c2a8 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -699,8 +699,7 @@ elfstab_offset_sections (objfile, pst) 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 */ diff --git a/gdb/mipsread.c b/gdb/mipsread.c index eb19789c67b..3a744e8fb7c 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -3633,8 +3633,7 @@ mipscoff_symfile_offsets (objfile, addr) 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 */ diff --git a/gdb/nlmread.c b/gdb/nlmread.c index 2ce4c2e2770..f3455039dd1 100644 --- a/gdb/nlmread.c +++ b/gdb/nlmread.c @@ -286,8 +286,7 @@ nlm_symfile_offsets (objfile, addr) 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 */ diff --git a/gdb/paread.c b/gdb/paread.c index ce19622991d..843e3723330 100644 --- a/gdb/paread.c +++ b/gdb/paread.c @@ -504,8 +504,7 @@ pa_symfile_offsets (objfile, addr) 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 */ diff --git a/gdb/symfile.c b/gdb/symfile.c index 8430ae9438c..fd8298dde76 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -796,11 +796,15 @@ find_sym_fns (objfile) 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; diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index e93991f7a39..5e0df413f5b 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2140,12 +2140,20 @@ xcoff_symfile_offsets (objfile, addr) 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 */ -- 2.30.2