aboutsummaryrefslogtreecommitdiff
path: root/gdb/xcoffread.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2013-05-06 14:15:50 +0000
committerJoel Brobecker <brobecker@gnat.com>2013-05-06 14:15:50 +0000
commit4d1eb6b4d299f3e46aab18e08fe4ef3063a39565 (patch)
tree3f3c26c9dc0c529c96fc4d2b5ddfa6ca61fabc1d /gdb/xcoffread.c
parent0c4f667cfe5118bf3a2690502a9a40ff3309abed (diff)
downloadgdb-4d1eb6b4d299f3e46aab18e08fe4ef3063a39565.zip
gdb-4d1eb6b4d299f3e46aab18e08fe4ef3063a39565.tar.gz
gdb-4d1eb6b4d299f3e46aab18e08fe4ef3063a39565.tar.bz2
Reimplement shared library support on ppc-aix...
... using the target_so_ops framework. 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.
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r--gdb/xcoffread.c83
1 files changed, 41 insertions, 42 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 2b5f9b7..48b6935 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -907,11 +907,16 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
/* Create a new minimal symbol (using prim_record_minimal_symbol_and_info).
+ Creation of all new minimal symbols should go through this function
+ rather than calling the various prim_record_[...] functions in order
+ to make sure that all symbol addresses get properly relocated.
+
Arguments are:
NAME - the symbol's name (but if NAME starts with a period, that
leading period is discarded).
- ADDRESS - the symbol's address.
+ ADDRESS - the symbol's address, prior to relocation. This function
+ relocates the address before recording the minimal symbol.
MS_TYPE - the symbol's type.
N_SCNUM - the symbol's XCOFF section number.
OBJFILE - the objfile associated with the minimal symbol. */
@@ -922,9 +927,12 @@ record_minimal_symbol (const char *name, CORE_ADDR address,
int n_scnum,
struct objfile *objfile)
{
+ int section = secnum_to_section (n_scnum, objfile);
+
if (name[0] == '.')
++name;
+ address += ANOFFSET (objfile->section_offsets, section);
prim_record_minimal_symbol_and_info (name, address, ms_type,
secnum_to_section (n_scnum, objfile),
objfile);
@@ -2339,11 +2347,10 @@ scan_xcoff_symtab (struct objfile *objfile)
/* Data variables are recorded in the minimal symbol
table, except for section symbols. */
if (*namestring != '.')
- prim_record_minimal_symbol_and_info
+ record_minimal_symbol
(namestring, symbol.n_value,
sclass == C_HIDEXT ? mst_file_data : mst_data,
- secnum_to_section (symbol.n_scnum, objfile),
- objfile);
+ symbol.n_scnum, objfile);
break;
case XMC_TC0:
@@ -2416,11 +2423,10 @@ scan_xcoff_symtab (struct objfile *objfile)
typically be XMC_RW; I suspect XMC_RO and
XMC_BS might be possible too. */
if (*namestring != '.')
- prim_record_minimal_symbol_and_info
+ record_minimal_symbol
(namestring, symbol.n_value,
sclass == C_HIDEXT ? mst_file_data : mst_data,
- secnum_to_section (symbol.n_scnum, objfile),
- objfile);
+ symbol.n_scnum, objfile);
break;
}
break;
@@ -2433,11 +2439,10 @@ scan_xcoff_symtab (struct objfile *objfile)
/* Common variables are recorded in the minimal symbol
table, except for section symbols. */
if (*namestring != '.')
- prim_record_minimal_symbol_and_info
+ record_minimal_symbol
(namestring, symbol.n_value,
sclass == C_HIDEXT ? mst_file_bss : mst_bss,
- secnum_to_section (symbol.n_scnum, objfile),
- objfile);
+ symbol.n_scnum, objfile);
break;
}
break;
@@ -3035,44 +3040,38 @@ static void
xcoff_symfile_offsets (struct objfile *objfile,
struct section_addr_info *addrs)
{
- asection *sect = NULL;
- int i;
+ const char *first_section_name;
- objfile->num_sections = bfd_count_sections (objfile->obfd);
- objfile->section_offsets = (struct section_offsets *)
- obstack_alloc (&objfile->objfile_obstack,
- SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
+ default_symfile_offsets (objfile, addrs);
- /* Initialize the section indexes for future use. */
- sect = bfd_get_section_by_name (objfile->obfd, ".text");
- if (sect)
- objfile->sect_index_text = sect->index;
+ /* Oneof the weird side-effects of default_symfile_offsets is that
+ it sometimes sets some section indices to zero for sections that,
+ in fact do not exist. See the body of default_symfile_offsets
+ for more info on when that happens. Undo that, as this then allows
+ us to test whether the associated section exists or not, and then
+ access it quickly (without searching it again). */
- sect = bfd_get_section_by_name (objfile->obfd, ".data");
- if (sect)
- objfile->sect_index_data = sect->index;
+ if (objfile->num_sections == 0)
+ return; /* Is that even possible? Better safe than sorry. */
- sect = bfd_get_section_by_name (objfile->obfd, ".bss");
- if (sect)
- objfile->sect_index_bss = sect->index;
+ first_section_name
+ = bfd_section_name (objfile->obfd, objfile->sections[0].the_bfd_section);
- sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
- if (sect)
- objfile->sect_index_rodata = sect->index;
+ if (objfile->sect_index_text == 0
+ && strcmp (first_section_name, ".text") != 0)
+ objfile->sect_index_text = -1;
- for (i = 0; i < objfile->num_sections; ++i)
- {
- /* syms_from_objfile kindly subtracts from addr the
- bfd_section_vma of the .text section. This strikes me as
- wrong--whether the offset to be applied to symbol reading is
- relative to the start address of the section depends on the
- symbol format. In any event, this whole "addr" concept is
- pretty broken (it doesn't handle any section but .text
- sensibly), so just ignore the addr parameter and use 0.
- rs6000-nat.c will set the correct section offsets via
- objfile_relocate. */
- (objfile->section_offsets)->offsets[i] = 0;
- }
+ if (objfile->sect_index_data == 0
+ && strcmp (first_section_name, ".data") != 0)
+ objfile->sect_index_data = -1;
+
+ if (objfile->sect_index_bss == 0
+ && strcmp (first_section_name, ".bss") != 0)
+ objfile->sect_index_bss = -1;
+
+ if (objfile->sect_index_rodata == 0
+ && strcmp (first_section_name, ".rodata") != 0)
+ objfile->sect_index_rodata = -1;
}
/* Register our ability to parse symbols for xcoff BFD files. */