diff options
author | Fred Fish <fnf@specifix.com> | 1996-05-02 01:32:41 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1996-05-02 01:32:41 +0000 |
commit | 062cb0d30dd7402562c621ce9c3b6e630445b33c (patch) | |
tree | 8c2296e006db66fdee4e35798ebf4731b64b40bd | |
parent | 0a0d1bdd6e71c2fdb862e5c88e83dab65728e399 (diff) | |
download | gdb-062cb0d30dd7402562c621ce9c3b6e630445b33c.zip gdb-062cb0d30dd7402562c621ce9c3b6e630445b33c.tar.gz gdb-062cb0d30dd7402562c621ce9c3b6e630445b33c.tar.bz2 |
* Makefile.in (rs6000-nat.o): Dependant on xcoffsolib.h.
* config/rs6000/rs6000.mh (NATDEPFILES): Move xcoffread.o ...
* config/rs6000/rs6000.mt (TDEPFILES): ... to here
* xcoffsolib.c (xcoff_relocate_symtab_hook): Define and initialize.
(solib_info): Call xcoff_relocate_symtab via the hook.
(sharedlibrary_command): Ditto.
* xcoffread.c: Remove all FAKING_RS6000 comments and defines.
(xcoff_add_toc_to_loadinfo_hook): Define and initialize here.
(xcoff_init_loadinfo_hook): Define and initialize here.
(scan_xcoff_symtab): Call xcoff_add_toc_to_loadinfo via the hook.
(xcoff_initial_scan): Call xcoff_init_loadinfo via the hook.
* xcoffsolib.h (xcoff_relocate_symtab_hook): Declare extern func.
* rs6000-tdep.c (_initialize_rs6000_tdep): Add initializations
of xcoff_add_toc_to_loadinfo_hook and xcoff_init_loadinfo_hook.
* rs6000-nat.c (_initialize_core_rs6000): Add initialization
of xcoff_relocate_symtab_hook.
-rw-r--r-- | gdb/ChangeLog | 19 | ||||
-rw-r--r-- | gdb/Makefile.in | 3 | ||||
-rw-r--r-- | gdb/rs6000-nat.c | 4 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 15 | ||||
-rw-r--r-- | gdb/xcoffread.c | 28 | ||||
-rw-r--r-- | gdb/xcoffsolib.c | 12 | ||||
-rw-r--r-- | gdb/xcoffsolib.h | 5 |
7 files changed, 69 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e9db65f..6d143eb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +Wed May 1 17:29:18 1996 Fred Fish <fnf@cygnus.com> + + * Makefile.in (rs6000-nat.o): Dependant on xcoffsolib.h. + * config/rs6000/rs6000.mh (NATDEPFILES): Move xcoffread.o ... + * config/rs6000/rs6000.mt (TDEPFILES): ... to here + * xcoffsolib.c (xcoff_relocate_symtab_hook): Define and initialize. + (solib_info): Call xcoff_relocate_symtab via the hook. + (sharedlibrary_command): Ditto. + * xcoffread.c: Remove all FAKING_RS6000 comments and defines. + (xcoff_add_toc_to_loadinfo_hook): Define and initialize here. + (xcoff_init_loadinfo_hook): Define and initialize here. + (scan_xcoff_symtab): Call xcoff_add_toc_to_loadinfo via the hook. + (xcoff_initial_scan): Call xcoff_init_loadinfo via the hook. + * xcoffsolib.h (xcoff_relocate_symtab_hook): Declare extern func. + * rs6000-tdep.c (_initialize_rs6000_tdep): Add initializations + of xcoff_add_toc_to_loadinfo_hook and xcoff_init_loadinfo_hook. + * rs6000-nat.c (_initialize_core_rs6000): Add initialization + of xcoff_relocate_symtab_hook. + Tue Apr 30 13:22:02 1996 Michael Meissner <meissner@tiktok.cygnus.com> * configure (powerpcle-*-solaris*): Add Solaris support. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 2752008..cd6cf67 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1408,7 +1408,8 @@ remote-nrom.o: remote-nrom.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \ rom68k-rom.o: rom68k-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) target.h serial.h terminal.h -rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) target.h +rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) target.h \ + xcoffsolib.h rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ target.h xcoffsolib.h diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index b9ad387..5772fe0 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -818,5 +818,9 @@ static struct core_fns rs6000_core_fns = void _initialize_core_rs6000 () { + /* For native configurations, where this module is included, inform + the xcoffsolib module where it can find the function for symbol table + relocation at runtime. */ + xcoff_relocate_symtab_hook = &xcoff_relocate_symtab; add_core_fns (&rs6000_core_fns); } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 614a282..f2acdf6 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1268,6 +1268,21 @@ gdb_print_insn_powerpc (memaddr, info) void _initialize_rs6000_tdep () { + /* Initialize hook in xcoffread for recording the toc offset value + of a symbol table into the ldinfo structure, for native rs6000 + config. */ + { + extern void (*xcoff_add_toc_to_loadinfo_hook) PARAMS ((unsigned long)); + xcoff_add_toc_to_loadinfo_hook = &xcoff_add_toc_to_loadinfo; + } + + /* Initialize hook in xcoffread for calling xcoff_init_loadinfo in + a native rs6000 config. */ + { + extern void (*xcoff_init_loadinfo_hook) PARAMS ((void)); + xcoff_init_loadinfo_hook = &xcoff_init_loadinfo; + } + /* FIXME, this should not be decided via ifdef. */ #ifdef GDB_TARGET_POWERPC tm_print_insn = gdb_print_insn_powerpc; diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 7704a5f..b0b9612 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -20,12 +20,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* RS/6000 and PowerPC only: - Needs xcoff_add_toc_to_loadinfo and xcoff_init_loadinfo in - rs6000-tdep.c from target. - However, if you define FAKING_RS6000, then this code will link with - any target. */ - #include "defs.h" #include "bfd.h" @@ -94,6 +88,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This is output from LD. */ #define N_SETV 0x1C /* Pointer to set vector in data area. */ + +/* Hook for recording the toc offset value of a symbol table into + the ldinfo structure. */ + +void (*xcoff_add_toc_to_loadinfo_hook) PARAMS ((unsigned long)) = NULL; + +/* Hook for recording how to call xcoff_init_loadinfo for a native + rs6000 config only. */ + +void (*xcoff_init_loadinfo_hook) PARAMS ((void)) = NULL; + /* We put a pointer to this structure in the read_symtab_private field of the psymtab. */ @@ -2570,9 +2575,8 @@ scan_xcoff_symtab (section_offsets, objfile) If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain this information would be file auxiliary header. */ -#ifndef FAKING_RS6000 - xcoff_add_toc_to_loadinfo (toc_offset); -#endif + if (xcoff_add_toc_to_loadinfo_hook != NULL) + (*xcoff_add_toc_to_loadinfo_hook) ((unsigned long) toc_offset); } /* Scan and build partial symbols for a symbol file. @@ -2601,11 +2605,9 @@ xcoff_initial_scan (objfile, section_offsets, mainline) char *name; unsigned int size; -#ifndef FAKING_RS6000 /* Initialize load info structure. */ - if (mainline) - xcoff_init_loadinfo (); -#endif + if (mainline && xcoff_init_loadinfo_hook != NULL) + (*xcoff_init_loadinfo_hook) (); info = (struct coff_symfile_info *) objfile -> sym_private; symfile_bfd = abfd = objfile->obfd; diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c index edcfda1..45ed2b3 100644 --- a/gdb/xcoffsolib.c +++ b/gdb/xcoffsolib.c @@ -28,6 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "xcoffsolib.h" #include "inferior.h" +/* Hook to relocate symbols at runtime. If gdb is build natively, this + hook is initialized in by rs6000-nat.c. If not, it is currently left + NULL and never called. */ + +void (*xcoff_relocate_symtab_hook) PARAMS ((unsigned int)) = NULL; + #ifdef SOLIB_SYMBOLS_MANUAL extern struct symtab *current_source_symtab; @@ -159,7 +165,8 @@ solib_info (args, from_tty) struct vmap *vp = vmap; /* Check for new shared libraries loaded with load (). */ - xcoff_relocate_symtab (inferior_pid); + if (xcoff_relocate_symtab_hook != NULL) + (*xcoff_relocate_symtab_hook) (inferior_pid); if (vp == NULL || vp->nxt == NULL) { @@ -194,7 +201,8 @@ sharedlibrary_command (args, from_tty) dont_repeat (); /* Check for new shared libraries loaded with load (). */ - xcoff_relocate_symtab (inferior_pid); + if (xcoff_relocate_symtab_hook != NULL) + (*xcoff_relocate_symtab_hook) (inferior_pid); #ifdef SOLIB_SYMBOLS_MANUAL solib_add (args, from_tty, (struct target_ops *)0); diff --git a/gdb/xcoffsolib.h b/gdb/xcoffsolib.h index 9d10b2e..2b75d22 100644 --- a/gdb/xcoffsolib.h +++ b/gdb/xcoffsolib.h @@ -51,6 +51,9 @@ struct vmap_and_bfd { extern struct vmap *vmap; -void +extern void add_text_to_loadinfo PARAMS ((CORE_ADDR textaddr, CORE_ADDR dataaddr)); +/* Hook for symbol table relocation at runtime. */ + +extern void (*xcoff_relocate_symtab_hook) PARAMS ((unsigned int)); |