diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 2000-11-09 09:49:00 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 2000-11-09 09:49:00 +0000 |
commit | 63f58cc52974c191fe73f2e32ca1178b1b9f31ed (patch) | |
tree | 614ec4679cbab879f60f5050803913c9b4dd0868 /gdb/rs6000-nat.c | |
parent | c11c3a98c0b59a9b883970b0b7b658fdfdc06050 (diff) | |
download | gdb-63f58cc52974c191fe73f2e32ca1178b1b9f31ed.zip gdb-63f58cc52974c191fe73f2e32ca1178b1b9f31ed.tar.gz gdb-63f58cc52974c191fe73f2e32ca1178b1b9f31ed.tar.bz2 |
Add auto-solib-add support for AIX, remove obsolete and unused
SOLIB_SYMBOLS_MANUAL code, cleanup of AIX shared library handling code.
* rs6000-nat.c (vmap_symtab): Do not try to modify offsets
if symbols are not yet loaded.
(vmap_add_symbols): New function to add symbols for a vmap entry.
(add_vmap): Turn errors into warnings, return NULL vmap upon
failure. Add symbols via vmap_add_symbols only if requested.
(xcoff_relocate_core): Allow debugging of core files without an
executable file. Handle NULL returns from add_vmap gracefully.
* xcoffsolib.c (solib_add): Remove, no longer needed.
(solib_info): Do not check for new shared libraries if there is no
inferior process.
(sharedlibrary_command): Made static.
Do not check for new shared libraries if there is no inferior process.
Add symbols for requested shared libraries via vmap_add_symbols.
(_initialize_solib): Add `set auto-solib-add' command.
* xcoffsolib.h (vmap_add_symbols): Add prototype declaration.
* config/rs6000/tm-rs6000.h (PC_LOAD_SEGMENT): Move from here ...
* config/rs6000/nm-rs6000.h: ... to here, this is an AIX native
feature.
* config/powerpc/tm-macos.h, config/powerpc/tm-ppc-eabi.h,
config/powerpc/tm-ppc-nw.h, config/rs6000/tm-rs6000ly.h:
Remove #undef PC_LOAD_SEGMENT.
* config/powerpc/aix.mt, config/rs6000/aix4.mt, config/rs6000/rs6000.mt
(TDEPFILES): Move xcoffsolib.o from here ...
* config/powerpc/aix.mh, config/rs6000/aix4.mh, config/rs6000/rs6000.mh
(NATDEPFILES): ... to here, xcoffsolib.o contains AIX native code
only.
* rs6000-tdep.c: Remove #include xcoffsolib.h, no longer needed.
* xcoffsolib.h (xcoff_relocate_symtab_hook): Remove declaration.
* rs6000-nat.c (_initialize_core_rs6000): Remove setting of
xcoff_relocate_symtab_hook, no longer needed.
* xcoffsolib.c (solib_info, sharedlibrary_command): Remove
xcoff_relocate_symtab_hook indirection, call xcoff_relocate_symtab
directly, as xcoffsolib.c is now compiled in native AIX configurations
only.
* Makefile.in: Update dependencies for rs6000-tdep.o, rs6000-nat.o
and xcoffsolib.o.
Diffstat (limited to 'gdb/rs6000-nat.c')
-rw-r--r-- | gdb/rs6000-nat.c | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 6fa4560..f44d0c1 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -605,6 +605,9 @@ vmap_symtab (struct vmap *vp) return; objfile = symfile_objfile; } + else if (!vp->loaded) + /* If symbols are not yet loaded, offsets are not yet valid. */ + return; new_offsets = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS); @@ -632,6 +635,23 @@ objfile_symbol_add (void *arg) return 1; } +/* Add symbols for a vmap. Return zero upon error. */ + +int +vmap_add_symbols (struct vmap *vp) +{ + if (catch_errors (objfile_symbol_add, vp->objfile, + "Error while reading shared library symbols:\n", + RETURN_MASK_ALL)) + { + /* Note this is only done if symbol reading was successful. */ + vp->loaded = 1; + vmap_symtab (vp); + return 1; + } + return 0; +} + /* Add a new vmap entry based on ldinfo() information. If ldi->ldinfo_fd is not valid (e.g. this struct ld_info is from a @@ -666,8 +686,11 @@ add_vmap (LdInfo *ldi) else abfd = bfd_fdopenr (objname, gnutarget, fd); if (!abfd) - error ("Could not open `%s' as an executable file: %s", - objname, bfd_errmsg (bfd_get_error ())); + { + warning ("Could not open `%s' as an executable file: %s", + objname, bfd_errmsg (bfd_get_error ())); + return NULL; + } /* make sure we have an object file */ @@ -684,41 +707,35 @@ add_vmap (LdInfo *ldi) if (!last) { + warning ("\"%s\": member \"%s\" missing.", objname, mem); bfd_close (abfd); - /* FIXME -- should be error */ - warning ("\"%s\": member \"%s\" missing.", abfd->filename, mem); - return 0; + return NULL; } if (!bfd_check_format (last, bfd_object)) { - bfd_close (last); /* XXX??? */ - goto obj_err; + warning ("\"%s\": member \"%s\" not in executable format: %s.", + objname, mem, bfd_errmsg (bfd_get_error ())); + bfd_close (last); + bfd_close (abfd); + return NULL; } vp = map_vmap (last, abfd); } else { - obj_err: + warning ("\"%s\": not in executable format: %s.", + objname, bfd_errmsg (bfd_get_error ())); bfd_close (abfd); - error ("\"%s\": not in executable format: %s.", - objname, bfd_errmsg (bfd_get_error ())); - /*NOTREACHED */ + return NULL; } obj = allocate_objfile (vp->bfd, 0); vp->objfile = obj; -#ifndef SOLIB_SYMBOLS_MANUAL - if (catch_errors (objfile_symbol_add, obj, - "Error while reading shared library symbols:\n", - RETURN_MASK_ALL)) - { - /* Note this is only done if symbol reading was successful. */ - vmap_symtab (vp); - vp->loaded = 1; - } -#endif + /* Always add symbols for the main objfile. */ + if (vp == vmap || auto_solib_add) + vmap_add_symbols (vp); return vp; } @@ -985,12 +1002,6 @@ xcoff_relocate_core (struct target_ops *target) char *buffer = xmalloc (buffer_size); struct cleanup *old = make_cleanup (free_current_contents, &buffer); - /* FIXME, this restriction should not exist. For now, though I'll - avoid coredumps with error() pending a real fix. */ - if (vmap == NULL) - error - ("Can't debug a core file without an executable file (on the RS/6000)"); - ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo"); if (ldinfo_sec == NULL) { @@ -1036,12 +1047,16 @@ xcoff_relocate_core (struct target_ops *target) ldi->l32.ldinfo_fd = -1; /* The first ldinfo is for the exec file, allocated elsewhere. */ - if (offset == 0) + if (offset == 0 && vmap != NULL) vp = vmap; else vp = add_vmap (ldi); + /* Process next shared library upon error. */ offset += LDI_NEXT (ldi, arch64); + if (vp == NULL) + continue; + vmap_secs (vp, ldi, arch64); /* Unless this is the exec file, @@ -1125,9 +1140,5 @@ _initialize_core_rs6000 (void) starting a child process. */ rs6000_set_host_arch_hook = set_host_arch; - /* 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); } |