reimplement AIX shared-lib support (v2)

Joel Brobecker brobecker@adacore.com
Fri Mar 29 07:35:00 GMT 2013


Hello,

This is version 2 of the patch first shown at:
    FYI/prototype: re-implement relocs on ppc-aix
    http://www.sourceware.org/ml/gdb-patches/2013-03/msg00818.html

Compared to the first prototype, I believe this version is ready
to be checked in (except for one tiny bit, which I will explain
below). The new versions adds:
  - proper memory management of the various structures allocated
    on the heap;
  - separation of the tdep and nat modules, so that the solib-aix
    module no longer directly depends on the rs6000-nat module;
  - documentation of all the new code;
  - as a bonus, per-inferior caching of the loader info in order
    to avoid repeated calls to ptrace in order to retrieve it.

The tiny bit mentioned above is a hunk in solib.c which should
become OBE soon, because I expect this code to be removed
entirely before this patch goes in
(http://www.sourceware.org/ml/gdb-patches/2013-03/msg01076.html):

    +#ifdef FIXME_CAUSES_US_TO_DISPLAY_MEMBER_NAME_ONLY
    +  /* FIXME: Why are we overwriting the so_name, here?
    +     Because of that, "info sharedlibrary" prints shared object name
    +     as "shr.o" instead of what we set it to ("/lib/libc.a(shr.o)").
    +     Perhaps we can use abfd->my_archive??? But this would affect
    +     Darwin, I believe, so to be checked.  */
       strcpy (so->so_name, bfd_get_filename (abfd));
    +#endif

There are a couple of things that could be improved, but I do not
think it's necessary to work on them right away (the biggie being
the issue with the so_name which is actually a combination of two
names, not just one).

gdb/ChangeLog:

        * target.h (TARGET_OBJECT_AIX_LIBRARIES): New target_object enum.
        * features/library-list-aix.dtd: New file.
        * solib-aix.h, solib-aix.c: New file.
        * rs6000-aix-tdep.c: #include "solib.h" and "solib-aix.h".
        (rs6000_find_toc_address_hook): Delete.
        (rs6000_push_dummy_call): Rewrite code setting the TOC value.
        (rs6000_aix_init_osabi): Register solib_aix_so_ops.
        * rs6000-nat.c: Remove "xcoffsolib.h" include.  Include
        "xml-utils.h".
        (map_vmap, vmap_exec, vmap_ldinfo, add_vmap, objfile_symbol_add)
        (vmap_symtab, fixup_breakpoints): Delete.
        (rs6000_xfer_shared_libraries): New function.
        (rs6000_xfer_partial): Add TARGET_OBJECT_AIX_LIBRARIES handling.
        (vmap_secs, bss_data_overlap, vmap_add_symbols): Delete.
        (xcoff_relocate_symtab, xcoff_relocate_core): Delete.
        (rs6000_ptrace_ldinfo, rs6000_core_ldinfo)
        (rs6000_xfer_shared_library): New function.
        (find_toc_address): Delete.
        (_initialize_rs6000_nat): Do not set rs6000_find_toc_address_hook.
        * rs6000-tdep.h (rs6000_find_toc_address_hook): Remove.
        xcoffread.c (record_minimal_symbol): Reloate symbol address
        before creating minimal symbol.  Adjust function description
        accordingly.
        (scan_xcoff_symtab): Replace call to
        prim_record_minimal_symbol_and_info by call to record_minimal_symbol.
        (xcoff_symfile_offsets): Reimplement mostly as a wrapper
        around default_symfile_offsets.
        * configure.tgt: Add solib-aix.o to gdb_target_obs for
        powerpc-aix targets.
        * config/rs6000/nm-rs6000.h: Delete.
        * config/powerpc/aix.mh (NAT_FILE): Delete.
        (NATDEPFILES): Remove xcoffsolib.o.
        * Makefile.in (XMLFILES): Add library-list-aix.dtd.
        (ALL_TARGET_OBS): Add solib-aix.o.
        (HFILES_NO_SRCDIR): Remove xcoffsolib.h and
        config/rs6000/nm-rs6000.h.  Add solib-aix.h.
        (ALLDEPFILES): Add solib-aix.c.  Remove xcoffsolib.c.
        * xcoffsolib.h, xcoffsolib.c: Delete.

        * solib.c (reload_shared_libraries): Remove reference to
        SOLIB_CREATE_INFERIOR_HOOK.
        * breakpoint.c (handle_solib_event): Remove reference to SOLIB_ADD.
        (disable_breakpoints_in_shlibs): Remove reference to PC_SOLIB.
        (momentary_bkpt_re_set): Replace SOLIB_ADD by solib_add in
        comment.
        * corelow.c (deprecated_core_resize_section_table): Delete.
        * exec.c: Remove include of xcoffsolib.h".
        (map_vmap, vmap): Delete.
        (exec_close_1): Remove references to vmap.
        (exec_file_attach): Remove vmap handling code, and reference
        to DEPRECATED_IBM6000_TARGET.
        (bfdsec_to_vmap): Delete.
        (exec_files_info): Remove block of code handling VMAP.
        * infcmd.c (post_create_inferior): Remove reference to
        SOLIB_CREATE_INFERIOR_HOOK and SOLIB_ADD.
        * infrun.c (follow_exec): Remove reference to
        SOLIB_CREATE_INFERIOR_HOOK.
        * stack.c (print_frame): Remove reference to PC_SOLIB.
        * solib-dsbt.c (dsbt_current_sos): Adjust comment.
        (dsbt_relocate_main_executable): Likewise.
        * solib-frv.c (frv_current_sos): Likewise.

gdb/doc/ChangeLog:

        * gdbint.texinfo (Algorithms): Remove entries documenting
        DEPRECATED_IBM6000_TARGET, SOLIB_ADD, and
        SOLIB_CREATE_INFERIOR_HOOK.

My plan is to let this patch sit for review and comments all of
next week. When I come back, I will also push it to AdaCore's
repository for additional internal testing across all platforms.
If all is well, then I will commit to mainline, roughtly 2 weeks
from now.

This would normally require a doco review as well, although the changes
are fairly obvious.

Any comments? Suggestions?

-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Reimplement-shared-library-support-on-ppc-aix.patch
Type: text/x-diff
Size: 96245 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20130329/71047ec2/attachment.bin>


More information about the Gdb-patches mailing list