This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Yank out target_ops->to_sections


GDB needs further splitting of target inferior vs target debug interface
for multi-exec/process support.  One particular tricky field in the
target_ops vector that needs going away if we want to teach GDB that
each inferior may have it's own address space, is, as the subject says,
to_sections.

At some point hopefully not too far away, we'll have some notion
of address space and symbol spaces in GDB.  When we get there,
we'll need to have a set of target sections per symbol space.

I've implemented this differently several times now, but I'm sparing
you from the other versions.  :-)

The new object I'm proposing to go in the splitting direction,
goes something like this:

/* The whole set of address range to file section mapping of a target
   address space.  Each field is managed by a different target stratum
   layer or major component.  */

struct target_sections
{
  /* Sections found in the core file, if any is loaded.  Managed by
     the core target.  */
  struct target_section_table core;

  /* Sections the target loaded and unloads dynamically.  This is
     managed by the shared library support layer.  */
  struct target_section_table dynamic;

  /* Sections found in the executable file, managed by the exec
     target.  */
  struct target_section_table exec;
};

This structure has the benefit that the dynamic loaded sections
becomes independent and properly survives target
pushes/unpushes (think thread_stratum unpushing); no need
for the weird target_resize_to_sections; survives shared library
reloads properly (see reload_shared_libraries, to see a case where
we're losing target sections).  This happens to be particularly
important for targets where the shared library list is global,
like DICOS, when mixed with wanting to set breakpoints without
any inferior --- we need to be able to read memory from that shared
libraries on file, so I've kept flexibility in mind.  This allows to
make "set trust-readonly-sections on" read from shared library bfds,
and have it behave the same on all targets, which looks like a win.

So, one adjustment made by the patch, is to drop the target_ops
argument to solib_add, we don't need it anymore, because we
don't store the target sections in target_ops anymore.  Another
adjustment done was to move the unmapped overlay handling from
xfer_memory to memory_xfer_partial, so that I could reuse
xfer_memory better.  Doing that gave birth to the new MATCHER
argument to xfer_memory, which is a filter callback function that
xfer_memory calls for each target section it iterates over.
It is used to match sections by name for unmapped overlay support,
and to match only read-only sections for "set trust-readonly-sections".

I've built this with --enable-targets=all, to try to catch as
much required adjustment as possible, and tested it on x86_64-linux,
without regressions.

An alternative step would be to make corelow.c keep core target
sections per core on an on-the-side structure; to keep
target sections per exec file loaded in the exec target, again on an
on-the-side structure; and to access struct so_list->sections
directly --- this was one of my earlier approaches.  Somehow it looked
to me that this was a smoother incremental step.

WDYT?  Too way off?

-- 
Pedro Alves

2009-05-23  Pedro Alves  <pedro@codesourcery.com>

	* target.c (default_target_section_by_addr): Declare.
	(update_current_target): Remove references to to_sections.
	Inherit and default to_section_by_addr.
	(target_section_by_addr): Reimplement, as regular target method
	dispatcher.
	(target_section_by_addr_from_table): New.
	(default_target_section_by_addr): New.
	(target_section_match_readonly): New.
	(target_section_match_name): New.
	(memory_xfer_partial): Handled unmapped overlay sections before
	handling trust-readonly-sections.  Pass appropriate matcher
	functions to xfer_memory.
	(current_target_sections_1): New global.
	(current_target_sections): New global.
	(target_resize_to_sections): Delete.
	(resize_target_section_table): New.
	(remove_target_sections): Reimplement as handling a target section
	table, not a target_ops.
	(remove_dynamic_target_sections): New.
	(remove_core_target_sections): New.
	(remove_exec_target_sections): New.
	* target.h (struct target_ops) <to_sections, to_sections_end>:
	Remove fields.
	<to_section_by_addr>: New field.
	(xfer_memory_section_matcher_func): New typedef.
	(xfer_memory): Adjust interface.
	(section_table_xfer_memory): Declare.
	(print_section_info): Take a target_section_table parameter
	instead of a target_ops.
	(struct target_section_table): New type.
	(struct target_sections): New type.
	(current_target_sections): Declare.
	(resize_target_section_table, remove_exec_target_sections)
	(remove_core_target_sections, remove_dynamic_target_sections)
	(target_section_by_addr_from_table): Declare.
	(remove_target_sections): Remove declaration.
	* bfd-target.c (target_bfd_xfer_partial): Use the target section
	table store in the to_data field.
	(target_bfd_section_by_addr): New.
	(target_bfd_xclose): Release the target section table store in the
	to_data field.
	(target_bfd_reopen): Adjust to store a target section table in the
	to_data field, instead of a bfd.
	* corelow.c (core_close): Remove the core target sections from the
	current target sections set.
	(core_open): Adjust.
	(core_files_info): Adjust.
	(core_xfer_memory): New.
	(init_core_ops): Register core_xfer_memory as
	deprecated_xfer_memory callback, instead of xfer_memory.
	* solib-svr4.c (svr4_fetch_objfile_link_map, enable_break): Adjust to new
	solib_add interface.
	* solib.c (update_solib_list): Drop TARGET argument.
	(update_solib_list): Use remove_dynamic_target_sections.
	(update_solib_list): Adjust to record the target section in the
	dynamic set of the current target sections set.
	(solib_add): Remove the target argument, and adjust.
	(clear_solib): Use remove_dynamic_target_sections.
	(sharedlibrary_command, reload_shared_libraries): Adjust to new
	solib_add interface.
	* exec.c (exec_close): Remove exec target sections from the
	current target sections set.
	(exec_file_attach): Adjust.
	(section_table_xfer_memory): Make public.  Replace SECTION_NAME
	argument by MATCHER and MATCHER_ARG arguments.  Adjust.
	(section_table_xfer_memory_partial): Adjust.  Update comments.
	(xfer_memory): Update comments.  Replace TARGET argument by
	MATCHER and MATCHER_ARG arguments.  Don't handle unmapped overlays
	here.  Walk over the whole current target sections set.
	(exec_xfer_memory): New.
	(print_section_info): Replaced target_ops argument by a
	target_section_table argument.  Adjust.
	(set_section_command): Adjust.
	(exec_set_section_address): Adjust.
	(_initialize_exec): Register exec_xfer_memory instead of
	xfer_memory.
	(post_create_inferior): Adjust to new solib_add interface.
	* infrun.c (handle_inferior_event): Adjust to new solib_add
	interface.  Update comments.
	* remote.c (remote_start_remote): Adjust to new solib_add
	interface.
	* solib.h (solib_add): Remove target_ops argument.
	* solib-frv.c (frv_fetch_objfile_link_map): Adjust to new
	solib_add interface.
	* solib-irix.c (irix_solib_create_inferior_hook): Adjust to new
	solib_add interface.
	* config/rs6000/nm-rs6000.h (SOLIB_ADD): Drop target_ops argument.
	(xcoff_relocate_core): Remove target_ops argument.
	* rs6000-nat.c (xcoff_relocate_core): Drop target_ops argument.
	Adjust to use resize_target_section_table.
	* windows-nat.c (handle_unload_dll): Adjust to new solib_add
	interface.
	* solib-osf.c (osf_solib_create_inferior_hook): Ditto.
	* solib-sunos.c (sunos_solib_create_inferior_hook): Ditto.

---
 gdb/bfd-target.c              |   37 ++++--
 gdb/config/rs6000/nm-rs6000.h |    7 -
 gdb/corelow.c                 |   27 +++-
 gdb/exec.c                    |  113 ++++++++++++--------
 gdb/infcmd.c                  |    4 
 gdb/infrun.c                  |   26 ----
 gdb/remote.c                  |    2 
 gdb/rs6000-nat.c              |    6 -
 gdb/solib-frv.c               |    2 
 gdb/solib-irix.c              |    2 
 gdb/solib-osf.c               |    2 
 gdb/solib-sunos.c             |    2 
 gdb/solib-svr4.c              |    6 -
 gdb/solib.c                   |   49 ++++-----
 gdb/solib.h                   |    2 
 gdb/target.c                  |  228 +++++++++++++++++++++++++-----------------
 gdb/target.h                  |   72 ++++++++++---
 gdb/windows-nat.c             |    2 
 18 files changed, 358 insertions(+), 231 deletions(-)

Index: src/gdb/target.c
===================================================================
--- src.orig/gdb/target.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/target.c	2009-05-23 01:02:30.000000000 +0100
@@ -91,6 +91,9 @@ static LONGEST target_xfer_partial (stru
 				    void *readbuf, const void *writebuf,
 				    ULONGEST offset, LONGEST len);
 
+static struct target_section *default_target_section_by_addr
+  (struct target_ops *ops, CORE_ADDR addr);
+
 static void init_dummy_target (void);
 
 static struct target_ops debug_target;
@@ -491,8 +494,7 @@ update_current_target (void)
       INHERIT (to_has_registers, t);
       INHERIT (to_has_execution, t);
       INHERIT (to_has_thread_control, t);
-      INHERIT (to_sections, t);
-      INHERIT (to_sections_end, t);
+      INHERIT (to_section_by_addr, t);
       INHERIT (to_can_async_p, t);
       INHERIT (to_is_async_p, t);
       INHERIT (to_async, t);
@@ -648,6 +650,8 @@ update_current_target (void)
   de_fault (to_supports_multi_process,
 	    (int (*) (void))
 	    return_zero);
+  de_fault (to_section_by_addr,
+	    default_target_section_by_addr);
 #undef de_fault
 
   /* Finally, position the target-stack beneath the squashed
@@ -1020,10 +1024,24 @@ done:
 struct target_section *
 target_section_by_addr (struct target_ops *target, CORE_ADDR addr)
 {
+  struct target_ops *t;
+
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog, "target_section_by_addr ()\n");
+
+  for (t = target; t != NULL; t = t->beneath)
+    if (t->to_section_by_addr != NULL)
+      return (*t->to_section_by_addr) (t, addr);
+
+  return 0;
+}
+
+struct target_section *
+target_section_by_addr_from_table (struct target_section_table *table,
+				   CORE_ADDR addr)
+{
   struct target_section *secp;
-  for (secp = target->to_sections;
-       secp < target->to_sections_end;
-       secp++)
+  for (secp = table->start; secp < table->end; secp++)
     {
       if (addr >= secp->addr && addr < secp->endaddr)
 	return secp;
@@ -1031,6 +1049,46 @@ target_section_by_addr (struct target_op
   return NULL;
 }
 
+/* Find a section containing ADDR.  This is the default version, which
+   operates on the current inferior's current address space.  */
+
+static struct target_section *
+default_target_section_by_addr (struct target_ops *ops, CORE_ADDR addr)
+{
+  struct target_section *section;
+  struct target_sections *tsections = current_target_sections;
+
+  section = target_section_by_addr_from_table (&tsections->core, addr);
+
+  if (section == NULL)
+    section = target_section_by_addr_from_table (&tsections->dynamic, addr);
+
+  if (section == NULL)
+    section = target_section_by_addr_from_table (&tsections->exec, addr);
+
+  return section;
+}
+
+/* Matches readonly bfd sections.  */
+
+static int
+target_section_match_readonly (struct target_section *section, void *arg)
+{
+  return (bfd_get_section_flags (section->bfd,
+				 section->the_bfd_section)
+	  & SEC_READONLY);
+}
+
+/* Matches target sections by name.  */
+
+static int
+target_section_match_name (struct target_section *section, void *arg)
+{
+  const char *section_name = arg;
+
+  return (strcmp (section_name, section->the_bfd_section->name) == 0);
+}
+
 /* Perform a partial memory transfer.  The arguments and return
    value are just as for target_xfer_partial.  */
 
@@ -1046,24 +1104,26 @@ memory_xfer_partial (struct target_ops *
   if (len == 0)
     return 0;
 
-  /* Try the executable file, if "trust-readonly-sections" is set.  */
-  if (readbuf != NULL && trust_readonly)
-    {
-      struct target_section *secp;
-
-      secp = target_section_by_addr (ops, memaddr);
-      if (secp != NULL
-	  && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)
-	      & SEC_READONLY))
-	return xfer_memory (memaddr, readbuf, len, 0, NULL, ops);
-    }
-
-  /* Likewise for accesses to unmapped overlay sections.  */
+  /* For accesses to unmapped overlay sections, read directly from
+     files.  Must do this first, as MEMADDR may need adjustment.  */
   if (readbuf != NULL && overlay_debugging)
     {
       struct obj_section *section = find_pc_overlay (memaddr);
       if (pc_in_unmapped_range (memaddr, section))
-	return xfer_memory (memaddr, readbuf, len, 0, NULL, ops);
+	{
+	  memaddr = overlay_mapped_address (memaddr, section);
+	  return xfer_memory (memaddr, readbuf, len, 0,
+			      target_section_match_name,
+			      (void *) section->the_bfd_section->name);
+	}
+    }
+
+  /* Try the executable files, if "trust-readonly-sections" is set.  */
+  if (readbuf != NULL && trust_readonly)
+    {
+      return xfer_memory (memaddr, readbuf, len, 0,
+			  target_section_match_readonly,
+			  NULL);
     }
 
   /* Try GDB's internal data cache.  */
@@ -2338,95 +2398,89 @@ return_minus_one (void)
   return -1;
 }
 
-/*
- * Resize the to_sections pointer.  Also make sure that anyone that
- * was holding on to an old value of it gets updated.
- * Returns the old size.
- */
+/* GDB only supports a single symbol/address space for the whole debug
+   session.  When that limitation is lifted, this global goes
+   away.  */
+static struct target_sections current_target_sections_1;
+
+/* The target sections (of the current address space) of the current
+   inferior.  */
+struct target_sections *current_target_sections = &current_target_sections_1;
+
+/* Resize the section table held by TABLE, by NUM_ADDED.  Returns the
+   old size.  */
 
 int
-target_resize_to_sections (struct target_ops *target, int num_added)
+resize_target_section_table (struct target_section_table *table, int num_added)
 {
-  struct target_ops **t;
   struct target_section *old_value;
   int old_count;
+  int new_count;
 
-  old_value = target->to_sections;
+  old_value = table->start;
+  old_count = table->end - table->start;
 
-  if (target->to_sections)
-    {
-      old_count = target->to_sections_end - target->to_sections;
-      target->to_sections = (struct target_section *)
-	xrealloc ((char *) target->to_sections,
-		  (sizeof (struct target_section)) * (num_added + old_count));
-    }
-  else
-    {
-      old_count = 0;
-      target->to_sections = (struct target_section *)
-	xmalloc ((sizeof (struct target_section)) * num_added);
-    }
-  target->to_sections_end = target->to_sections + (num_added + old_count);
+  new_count = num_added + old_count;
 
-  /* Check to see if anyone else was pointing to this structure.
-     If old_value was null, then no one was. */
-
-  if (old_value)
-    {
-      for (t = target_structs; t < target_structs + target_struct_size;
-	   ++t)
-	{
-	  if ((*t)->to_sections == old_value)
-	    {
-	      (*t)->to_sections = target->to_sections;
-	      (*t)->to_sections_end = target->to_sections_end;
-	    }
-	}
-      /* There is a flattened view of the target stack in current_target,
-	 so its to_sections pointer might also need updating. */
-      if (current_target.to_sections == old_value)
-	{
-	  current_target.to_sections = target->to_sections;
-	  current_target.to_sections_end = target->to_sections_end;
-	}
-    }
+  table->start
+    = xrealloc (table->start, sizeof (struct target_section) * new_count);
+  table->end = table->start + new_count;
 
   return old_count;
+}
+
+/* Remove all target sections taken from ABFD from the target section
+   table TABLE.  */
+
+static void
+remove_target_sections (struct target_section_table *table, bfd *abfd)
+{
+  struct target_section *src, *dest;
 
+  dest = table->start;
+  for (src = table->start; src < table->end; src++)
+    if (src->bfd != abfd)
+      {
+	/* Keep this section.  */
+	if (dest < src)
+	  *dest = *src;
+	dest++;
+      }
+
+  /* If we've dropped any sections, resize the section table.  */
+  if (dest < src)
+    resize_target_section_table (table, dest - src);
 }
 
-/* Remove all target sections taken from ABFD.
+/* Remove all target sections taken from ABFD from the dynamic target
+   sections of the current address space.  We use this when we notice
+   that the inferior has unloaded a shared object, for example.  */
 
-   Scan the current target stack for targets whose section tables
-   refer to sections from BFD, and remove those sections.  We use this
-   when we notice that the inferior has unloaded a shared object, for
-   example.  */
 void
-remove_target_sections (bfd *abfd)
+remove_dynamic_target_sections (bfd *abfd)
 {
-  struct target_ops **t;
+  remove_target_sections (&current_target_sections->dynamic, abfd);
+}
 
-  for (t = target_structs; t < target_structs + target_struct_size; t++)
-    {
-      struct target_section *src, *dest;
+/* Remove all target sections taken from ABFD from the core target
+   sections of the current address space.  We use this when we unload
+   core_bfd from the current address space.  */
 
-      dest = (*t)->to_sections;
-      for (src = (*t)->to_sections; src < (*t)->to_sections_end; src++)
-	if (src->bfd != abfd)
-	  {
-	    /* Keep this section.  */
-	    if (dest < src) *dest = *src;
-	    dest++;
-	  }
-
-      /* If we've dropped any sections, resize the section table.  */
-      if (dest < src)
-	target_resize_to_sections (*t, dest - src);
-    }
+void
+remove_core_target_sections (bfd *abfd)
+{
+  remove_target_sections (&current_target_sections->core, abfd);
 }
 
+/* Remove all target sections taken from ABFD from the core target
+   sections of the current address space.  We use this when we unload
+   exec_bfd from the current address space.  */
 
-
+void
+remove_exec_target_sections (bfd *abfd)
+{
+  remove_target_sections (&current_target_sections->exec, abfd);
+}
 
 /* Find a single runnable target in the stack and return it.  If for
    some reason there is more than one, return NULL.  */
Index: src/gdb/target.h
===================================================================
--- src.orig/gdb/target.h	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/target.h	2009-05-23 01:02:30.000000000 +0100
@@ -30,6 +30,7 @@ struct mem_attrib;
 struct target_ops;
 struct bp_target_info;
 struct regcache;
+struct target_section_table;
 
 /* This include file defines the interface between the main part
    of the debugger, and the part which is target-specific, or
@@ -420,10 +421,9 @@ struct target_ops
     int to_has_execution;
     int to_has_thread_control;	/* control thread execution */
     int to_attach_no_wait;
-    struct target_section
-     *to_sections;
-    struct target_section
-     *to_sections_end;
+
+    struct target_section *(*to_section_by_addr) (struct target_ops *,
+						  CORE_ADDR);
     /* ASYNC target controls */
     int (*to_can_async_p) (void);
     int (*to_is_async_p) (void);
@@ -668,8 +668,17 @@ extern int target_read_memory (CORE_ADDR
 extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
 				int len);
 
+typedef int (*xfer_memory_section_matcher_func) (struct target_section *section, void *arg);
+
 extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
-			struct mem_attrib *, struct target_ops *);
+			xfer_memory_section_matcher_func, void *);
+
+extern int section_table_xfer_memory (CORE_ADDR, gdb_byte *,
+				      int, int,
+				      struct target_section *,
+				      struct target_section *,
+				      xfer_memory_section_matcher_func,
+				      void *);
 
 /* Fetches the target's memory map.  If one is found it is sorted
    and returned, after some consistency checking.  Otherwise, NULL
@@ -735,7 +744,7 @@ extern int inferior_has_execd (ptid_t pi
 
 /* From exec.c */
 
-extern void print_section_info (struct target_ops *, bfd *);
+extern void print_section_info (struct target_section_table *, bfd *);
 
 /* Print a line about the current target.  */
 
@@ -1208,9 +1217,51 @@ struct target_section
     bfd *bfd;			/* BFD file pointer */
   };
 
+/* Holds an array of target sections.  Defined by [START,END[.  */
+
+struct target_section_table
+{
+  struct target_section *start;
+  struct target_section *end;
+};
+
+/* The whole set of address range to file section mapping of a target
+   address space.  Each field is managed by a different target stratum
+   layer or major component.  */
+
+struct target_sections
+{
+  /* Sections found in the core file, if any is loaded.  Managed by
+     the core target.  */
+  struct target_section_table core;
+
+  /* Sections the target loaded and unloads dynamically.  This is
+     managed by the shared library support layer.  */
+  struct target_section_table dynamic;
+
+  /* Sections found in the executable file, managed by the exec
+     target.  */
+  struct target_section_table exec;
+};
+
+/* The current set of target sections matching the sections mapped
+   into the current inferior's address space.  */
+extern struct target_sections *current_target_sections;
+
+extern int resize_target_section_table (struct target_section_table *, int);
+
+extern void remove_exec_target_sections (bfd *abfd);
+
+extern void remove_core_target_sections (bfd *abfd);
+
+extern void remove_dynamic_target_sections (bfd *abfd);
+
 /* Return the "section" containing the specified address.  */
-struct target_section *target_section_by_addr (struct target_ops *target,
-					       CORE_ADDR addr);
+extern struct target_section *target_section_by_addr (struct target_ops *ops,
+						      CORE_ADDR addr);
+
+extern struct target_section *target_section_by_addr_from_table
+  (struct target_section_table *table, CORE_ADDR addr);
 
 /* From mem-break.c */
 
@@ -1242,11 +1293,6 @@ extern struct target_ops *find_core_targ
 
 extern struct target_ops *find_target_beneath (struct target_ops *);
 
-extern int target_resize_to_sections (struct target_ops *target,
-				      int num_added);
-
-extern void remove_target_sections (bfd *abfd);
-
 /* Read OS data object of type TYPE from the target, and return it in
    XML format.  The result is NUL-terminated and returned as a string,
    allocated using xmalloc.  If an error occurs or the transfer is
Index: src/gdb/bfd-target.c
===================================================================
--- src.orig/gdb/bfd-target.c	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/bfd-target.c	2009-05-23 01:02:30.000000000 +0100
@@ -32,35 +32,52 @@ target_bfd_xfer_partial (struct target_o
   switch (object)
     {
     case TARGET_OBJECT_MEMORY:
-      return section_table_xfer_memory_partial (readbuf, writebuf, offset, len,
-						ops->to_sections,
-						ops->to_sections_end);
+      {
+	struct target_section_table *table = ops->to_data;
+	return section_table_xfer_memory_partial (readbuf, writebuf, offset, len,
+						  table->start,
+						  table->end);
+      }
     default:
       return -1;
     }
 }
 
+struct target_section *
+target_bfd_section_by_addr (struct target_ops *ops, CORE_ADDR addr)
+{
+  struct target_section_table *table = ops->to_data;
+  return target_section_by_addr_from_table (table, addr);
+}
+
 static void
 target_bfd_xclose (struct target_ops *t, int quitting)
 {
-  bfd_close (t->to_data);
-  xfree (t->to_sections);
+  struct target_section_table *table = t->to_data;
+  if (table->start)
+    bfd_close (table->start->bfd);
+  xfree (table->start);
+  xfree (table);
   xfree (t);
 }
 
 struct target_ops *
 target_bfd_reopen (struct bfd *bfd)
 {
-  struct target_ops *t = XZALLOC (struct target_ops);
+  struct target_ops *t;
+  struct target_section_table *table;
+
+  table = XZALLOC (struct target_section_table);
+  build_section_table (bfd, &table->start, &table->end);
+
+  t = XZALLOC (struct target_ops);
   t->to_shortname = "bfd";
   t->to_longname = _("BFD backed target");
   t->to_doc = _("You should never see this");
+  t->to_section_by_addr = target_bfd_section_by_addr;
   t->to_xfer_partial = target_bfd_xfer_partial;
   t->to_xclose = target_bfd_xclose;
-  t->to_data = bfd;
+  t->to_data = table;
 
-  build_section_table (bfd,
-		       &t->to_sections,
-		       &t->to_sections_end);
   return t;
 }
Index: src/gdb/corelow.c
===================================================================
--- src.orig/gdb/corelow.c	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/corelow.c	2009-05-23 01:02:30.000000000 +0100
@@ -203,18 +203,15 @@ core_close (int quitting)
          comments in clear_solib in solib.c. */
       clear_solib ();
 
+      /* Remove the core bfd's sections from the address space.  */
+      remove_core_target_sections (core_bfd);
+
       name = bfd_get_filename (core_bfd);
       if (!bfd_close (core_bfd))
 	warning (_("cannot close \"%s\": %s"),
 		 name, bfd_errmsg (bfd_get_error ()));
       xfree (name);
       core_bfd = NULL;
-      if (core_ops.to_sections)
-	{
-	  xfree (core_ops.to_sections);
-	  core_ops.to_sections = NULL;
-	  core_ops.to_sections_end = NULL;
-	}
     }
   core_vec = NULL;
   core_gdbarch = NULL;
@@ -348,8 +345,9 @@ core_open (char *filename, int from_tty)
   validate_files ();
 
   /* Find the data section */
-  if (build_section_table (core_bfd, &core_ops.to_sections,
-			   &core_ops.to_sections_end))
+  if (build_section_table (core_bfd,
+			   &current_target_sections->core.start,
+			   &current_target_sections->core.end))
     error (_("\"%s\": Can't find sections: %s"),
 	   bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
 
@@ -562,7 +560,7 @@ get_core_registers (struct target_ops *o
 static void
 core_files_info (struct target_ops *t)
 {
-  print_section_info (t, core_bfd);
+  print_section_info (&current_target_sections->core, core_bfd);
 }
 
 static LONGEST
@@ -665,6 +663,15 @@ core_xfer_partial (struct target_ops *op
     }
 }
 
+static int
+core_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
+		  struct mem_attrib *attrib, struct target_ops *target)
+{
+  return section_table_xfer_memory (memaddr, myaddr, len, write,
+				    current_target_sections->core.start,
+				    current_target_sections->core.end,
+				    NULL, NULL);
+}
 
 /* If mourn is being called in all the right places, this could be say
    `gdb internal error' (since generic_mourn calls breakpoint_init_inferior).  */
@@ -738,7 +745,7 @@ init_core_ops (void)
   core_ops.to_detach = core_detach;
   core_ops.to_fetch_registers = get_core_registers;
   core_ops.to_xfer_partial = core_xfer_partial;
-  core_ops.deprecated_xfer_memory = xfer_memory;
+  core_ops.deprecated_xfer_memory = core_xfer_memory;
   core_ops.to_files_info = core_files_info;
   core_ops.to_insert_breakpoint = ignore;
   core_ops.to_remove_breakpoint = ignore;
Index: src/gdb/solib-svr4.c
===================================================================
--- src.orig/gdb/solib-svr4.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/solib-svr4.c	2009-05-23 01:02:30.000000000 +0100
@@ -1133,7 +1133,7 @@ svr4_fetch_objfile_link_map (struct objf
 
   /* Cause svr4_current_sos() to be run if it hasn't been already.  */
   if (info->main_lm_addr == 0)
-    solib_add (NULL, 0, &current_target, auto_solib_add);
+    solib_add (NULL, 0, auto_solib_add);
 
   /* svr4_current_sos() will set main_lm_addr for the main executable.  */
   if (objfile == symfile_objfile)
@@ -1266,7 +1266,7 @@ enable_break (struct svr4_info *info)
      mean r_brk has already been relocated.  Assume the dynamic linker
      is the object containing r_brk.  */
 
-  solib_add (NULL, 0, &current_target, auto_solib_add);
+  solib_add (NULL, 0, auto_solib_add);
   sym_addr = 0;
   if (info->debug_base && solib_svr4_r_map (info) != 0)
     sym_addr = solib_svr4_r_brk (info);
@@ -1390,7 +1390,7 @@ enable_break (struct svr4_info *info)
 	  info->debug_loader_name = xstrdup (interp_name);
 	  info->debug_loader_offset_p = 1;
 	  info->debug_loader_offset = load_addr;
-	  solib_add (NULL, 0, &current_target, auto_solib_add);
+	  solib_add (NULL, 0, auto_solib_add);
 	}
 
       /* Record the relocated start and end address of the dynamic linker
Index: src/gdb/solib.c
===================================================================
--- src.orig/gdb/solib.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/solib.c	2009-05-23 01:02:30.000000000 +0100
@@ -513,7 +513,7 @@ solib_read_symbols (struct so_list *so, 
 
    SYNOPSIS
 
-   void update_solib_list (int from_tty, struct target_ops *TARGET)
+   void update_solib_list (int from_tty)
 
    Extract the list of currently loaded shared objects from the
    inferior, and compare it with the list of shared objects currently
@@ -537,7 +537,7 @@ solib_read_symbols (struct so_list *so, 
    processes we've just attached to, so that's okay.  */
 
 static void
-update_solib_list (int from_tty, struct target_ops *target)
+update_solib_list (int from_tty)
 {
   struct target_so_ops *ops = solib_ops (target_gdbarch);
   struct so_list *inferior = ops->current_sos();
@@ -634,7 +634,7 @@ update_solib_list (int from_tty, struct 
 
 	  /* Some targets' section tables might be referring to
 	     sections from so->abfd; remove them.  */
-	  remove_target_sections (gdb->abfd);
+	  remove_dynamic_target_sections (gdb->abfd);
 
 	  free_so (gdb);
 	  gdb = *gdb_link;
@@ -654,6 +654,8 @@ update_solib_list (int from_tty, struct 
       /* Fill in the rest of each of the `struct so_list' nodes.  */
       for (i = inferior; i; i = i->next)
 	{
+	  int count;
+
 	  i->from_tty = from_tty;
 
 	  /* Fill in the rest of the `struct so_list' node.  */
@@ -661,20 +663,20 @@ update_solib_list (int from_tty, struct 
 			"Error while mapping shared library sections:\n",
 			RETURN_MASK_ALL);
 
-	  /* If requested, add the shared object's sections to the TARGET's
-	     section table.  Do this immediately after mapping the object so
-	     that later nodes in the list can query this object, as is needed
-	     in solib-osf.c.  */
-	  if (target)
+	  /* Add the shared object's sections to the section table.
+	     Do this immediately after mapping the object so that
+	     later nodes in the list can query this object, as is
+	     needed in solib-osf.c.  */
+	  count = (i->sections_end - i->sections);
+	  if (count > 0)
 	    {
-	      int count = (i->sections_end - i->sections);
-	      if (count > 0)
-		{
-		  int space = target_resize_to_sections (target, count);
-		  memcpy (target->to_sections + space,
-			  i->sections,
-			  count * sizeof (i->sections[0]));
-		}
+	      struct target_section_table *dynamic
+		= &current_target_sections->dynamic;
+	      int space
+		= resize_target_section_table (dynamic, count);
+	      memcpy (dynamic->start + space,
+		      i->sections,
+		      count * sizeof (i->sections[0]));
 	    }
 
 	  /* Notify any observer that the shared object has been
@@ -711,8 +713,7 @@ libpthread_solib_p (struct so_list *so)
 
    SYNOPSIS
 
-   void solib_add (char *pattern, int from_tty, struct target_ops
-   *TARGET, int readsyms)
+   void solib_add (char *pattern, int from_tty, int readsyms)
 
    DESCRIPTION
 
@@ -726,7 +727,7 @@ libpthread_solib_p (struct so_list *so)
    FROM_TTY and TARGET are as described for update_solib_list, above.  */
 
 void
-solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms)
+solib_add (char *pattern, int from_tty, int readsyms)
 {
   struct so_list *gdb;
 
@@ -738,7 +739,7 @@ solib_add (char *pattern, int from_tty, 
 	error (_("Invalid regexp: %s"), re_err);
     }
 
-  update_solib_list (from_tty, target);
+  update_solib_list (from_tty);
 
   /* Walk the list of currently loaded shared libraries, and read
      symbols for any that match the pattern --- or any whose symbols
@@ -807,7 +808,7 @@ info_sharedlibrary_command (char *ignore
   /* "0x", a little whitespace, and two hex digits per byte of pointers.  */
   addr_width = 4 + (gdbarch_ptr_bit (target_gdbarch) / 4);
 
-  update_solib_list (from_tty, 0);
+  update_solib_list (from_tty);
 
   for (so = so_list_head; so; so = so->next)
     {
@@ -929,7 +930,7 @@ clear_solib (void)
       so_list_head = so->next;
       observer_notify_solib_unloaded (so);
       if (so->abfd)
-	remove_target_sections (so->abfd);
+	remove_dynamic_target_sections (so->abfd);
       free_so (so);
     }
 
@@ -999,7 +1000,7 @@ static void
 sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
-  solib_add (args, from_tty, (struct target_ops *) 0, 1);
+  solib_add (args, from_tty, 1);
 }
 
 /* LOCAL FUNCTION
@@ -1031,7 +1032,7 @@ reload_shared_libraries (char *ignored, 
 			 struct cmd_list_element *e)
 {
   no_shared_libraries (NULL, from_tty);
-  solib_add (NULL, from_tty, NULL, auto_solib_add);
+  solib_add (NULL, from_tty, auto_solib_add);
   /* Creating inferior hooks here has two purposes. First, if we reload 
      shared libraries then the address of solib breakpoint we've computed
      previously might be no longer valid.  For example, if we forgot to set
Index: src/gdb/exec.c
===================================================================
--- src.orig/gdb/exec.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/exec.c	2009-05-23 01:02:30.000000000 +0100
@@ -128,6 +128,8 @@ exec_close (int quitting)
 
   vmap = NULL;
 
+  remove_exec_target_sections (exec_bfd);
+
   if (exec_bfd)
     {
       char *name = bfd_get_filename (exec_bfd);
@@ -139,13 +141,6 @@ exec_close (int quitting)
       exec_bfd = NULL;
       exec_bfd_mtime = 0;
     }
-
-  if (exec_ops.to_sections)
-    {
-      xfree (exec_ops.to_sections);
-      exec_ops.to_sections = NULL;
-      exec_ops.to_sections_end = NULL;
-    }
 }
 
 void
@@ -254,8 +249,9 @@ exec_file_attach (char *filename, int fr
 	}
 #endif /* DEPRECATED_IBM6000_TARGET */
 
-      if (build_section_table (exec_bfd, &exec_ops.to_sections,
-			       &exec_ops.to_sections_end))
+      if (build_section_table (exec_bfd,
+			       &current_target_sections->exec.start,
+			       &current_target_sections->exec.end))
 	{
 	  /* Make sure to close exec_bfd, or else "run" might try to use
 	     it.  */
@@ -454,8 +450,11 @@ map_vmap (bfd *abfd, bfd *arch)
    SECTIONS and SECTIONS_END defines a section table holding sections
    from possibly multiple BFDs.
 
-   If SECTION_NAME is not NULL, only access sections with that same
-   name.
+   MATCHER is a filter function that is called for each target section
+   in the table defined by SECTION-SECTIONS_END.  If NULL all sections
+   are considered.  If not NULL, then the section is only considered
+   if the MATCHER returns true.  MATCHER_ARG is passed to MATCHER
+   unmodified.
 
    Result is a length:
 
@@ -467,12 +466,13 @@ map_vmap (bfd *abfd, bfd *arch)
    < 0:  We cannot handle this address, but if somebody
    else handles (-N) bytes, we can start from there.  */
 
-static int
+int
 section_table_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
 			   int len, int write,
 			   struct target_section *sections,
 			   struct target_section *sections_end,
-			   const char *section_name)
+			   xfer_memory_section_matcher_func matcher,
+			   void *matcher_arg)
 {
   int res;
   struct target_section *p;
@@ -486,7 +486,7 @@ section_table_xfer_memory (CORE_ADDR mem
 
   for (p = sections; p < sections_end; p++)
     {
-      if (section_name && strcmp (section_name, p->the_bfd_section->name) != 0)
+      if (matcher != NULL && !(*matcher) (p, matcher_arg))
 	continue;		/* not the section we need */
       if (memaddr >= p->addr)
         {
@@ -541,17 +541,23 @@ section_table_xfer_memory_partial (gdb_b
 {
   if (readbuf != NULL)
     return section_table_xfer_memory (offset, readbuf, len, 0,
-				      sections, sections_end, NULL);
+				      sections, sections_end, NULL, NULL);
   else
     return section_table_xfer_memory (offset, (gdb_byte *) writebuf, len, 1,
-				      sections, sections_end, NULL);
+				      sections, sections_end, NULL, NULL);
 }
 
-/* Read or write the exec file.
+/* Read or write from executable files.
 
    Args are address within a BFD file, address within gdb address-space,
    length, and a flag indicating whether to read or write.
 
+   MATCHER is a filter function that is called for each target section
+   in the current address space.  If NULL, all sections are
+   considered.  If not NULL, then the section is only considered if
+   the MATCHER returns true.  MATCHER_ARG is passed to MATCHER
+   unmodified.
+
    Result is a length:
 
    0:    We cannot handle this address and length.
@@ -560,42 +566,53 @@ section_table_xfer_memory_partial (gdb_b
    to handle more bytes beyond this length, but no
    promises.
    < 0:  We cannot handle this address, but if somebody
-   else handles (-N) bytes, we can start from there.
-
-   The same routine is used to handle both core and exec files;
-   we just tail-call it with more arguments to select between them.  */
+   else handles (-N) bytes, we can start from there.  */
 
 int
 xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
-	     struct mem_attrib *attrib, struct target_ops *target)
+	     xfer_memory_section_matcher_func matcher, void *matcher_arg)
 {
   int res;
-  const char *section_name = NULL;
 
-  if (len <= 0)
-    internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
-
-  if (overlay_debugging)
-    {
-      struct obj_section *section = find_pc_overlay (memaddr);
-
-      if (section != NULL)
-	{
-	  if (pc_in_unmapped_range (memaddr, section))
-	    memaddr = overlay_mapped_address (memaddr, section);
-	  section_name = section->the_bfd_section->name;
-	}
-    }
+  res = section_table_xfer_memory (memaddr, myaddr, len, write,
+				   current_target_sections->core.start,
+				   current_target_sections->core.end,
+				   matcher,
+				   matcher_arg);
+  if (res > 0)
+    return res;
+
+  res = section_table_xfer_memory (memaddr, myaddr, len, write,
+				   current_target_sections->dynamic.start,
+				   current_target_sections->dynamic.end,
+				   matcher,
+				   matcher_arg);
+
+  if (res > 0)
+    return res;
+
+  res = section_table_xfer_memory (memaddr, myaddr, len, write,
+				   current_target_sections->exec.start,
+				   current_target_sections->exec.end,
+				   matcher,
+				   matcher_arg);
+  return res;
+}
 
+static int
+exec_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
+		  struct mem_attrib *attrib, struct target_ops *target)
+{
   return section_table_xfer_memory (memaddr, myaddr, len, write,
-				    target->to_sections,
-				    target->to_sections_end,
-				    section_name);
+				    current_target_sections->exec.start,
+				    current_target_sections->exec.end,
+				    NULL, NULL);
 }
+
 
 
 void
-print_section_info (struct target_ops *t, bfd *abfd)
+print_section_info (struct target_section_table *t, bfd *abfd)
 {
   struct target_section *p;
   /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64.  */
@@ -607,7 +624,7 @@ print_section_info (struct target_ops *t
   if (abfd == exec_bfd)
     printf_filtered (_("\tEntry point: %s\n"),
                      paddress (bfd_get_start_address (abfd)));
-  for (p = t->to_sections; p < t->to_sections_end; p++)
+  for (p = t->start; p < t->end; p++)
     {
       printf_filtered ("\t%s", hex_string_custom (p->addr, wid));
       printf_filtered (" - %s", hex_string_custom (p->endaddr, wid));
@@ -631,7 +648,7 @@ print_section_info (struct target_ops *t
 static void
 exec_files_info (struct target_ops *t)
 {
-  print_section_info (t, exec_bfd);
+  print_section_info (&current_target_sections->exec, exec_bfd);
 
   if (vmap)
     {
@@ -667,6 +684,7 @@ set_section_command (char *args, int fro
   unsigned long secaddr;
   char secprint[100];
   long offset;
+  struct target_section_table *exec_table;
 
   if (args == 0)
     error (_("Must specify section name and its virtual address"));
@@ -678,7 +696,8 @@ set_section_command (char *args, int fro
   /* Parse out new virtual address */
   secaddr = parse_and_eval_address (args);
 
-  for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
+  exec_table = &current_target_sections->exec;
+  for (p = exec_table->start; p < exec_table->end; p++)
     {
       if (!strncmp (secname, bfd_section_name (exec_bfd, p->the_bfd_section), seclen)
 	  && bfd_section_name (exec_bfd, p->the_bfd_section)[seclen] == '\0')
@@ -705,8 +724,10 @@ void
 exec_set_section_address (const char *filename, int index, CORE_ADDR address)
 {
   struct target_section *p;
+  struct target_section_table *exec_table;
 
-  for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
+  exec_table = &current_target_sections->exec;
+  for (p = exec_table->start; p < exec_table->end; p++)
     {
       if (strcmp (filename, p->bfd->filename) == 0
 	  && index == p->the_bfd_section->index)
@@ -754,7 +775,7 @@ Specify the filename of the executable f
   exec_ops.to_open = exec_open;
   exec_ops.to_close = exec_close;
   exec_ops.to_attach = find_default_attach;
-  exec_ops.deprecated_xfer_memory = xfer_memory;
+  exec_ops.deprecated_xfer_memory = exec_xfer_memory;
   exec_ops.to_files_info = exec_files_info;
   exec_ops.to_insert_breakpoint = ignore;
   exec_ops.to_remove_breakpoint = ignore;
Index: src/gdb/infcmd.c
===================================================================
--- src.orig/gdb/infcmd.c	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/infcmd.c	2009-05-23 01:02:30.000000000 +0100
@@ -404,9 +404,9 @@ post_create_inferior (struct target_ops 
 	 If we made all the inferior hook methods consistent,
 	 this call could be removed.  */
 #ifdef SOLIB_ADD
-      SOLIB_ADD (NULL, from_tty, target, auto_solib_add);
+      SOLIB_ADD (NULL, from_tty, auto_solib_add);
 #else
-      solib_add (NULL, from_tty, target, auto_solib_add);
+      solib_add (NULL, from_tty, auto_solib_add);
 #endif
     }
 
Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/infrun.c	2009-05-23 01:02:30.000000000 +0100
@@ -2308,19 +2308,10 @@ handle_inferior_event (struct execution_
 	     operations such as address => section name and hence
 	     require the table to contain all sections (including
 	     those found in shared libraries).  */
-	  /* NOTE: cagney/2003-11-25: Pass current_target and not
-	     exec_ops to SOLIB_ADD.  This is because current GDB is
-	     only tooled to propagate section_table changes out from
-	     the "current_target" (see target_resize_to_sections), and
-	     not up from the exec stratum.  This, of course, isn't
-	     right.  "infrun.c" should only interact with the
-	     exec/process stratum, instead relying on the target stack
-	     to propagate relevant changes (stop, section table
-	     changed, ...) up to other layers.  */
 #ifdef SOLIB_ADD
-	  SOLIB_ADD (NULL, 0, &current_target, auto_solib_add);
+	  SOLIB_ADD (NULL, 0, auto_solib_add);
 #else
-	  solib_add (NULL, 0, &current_target, auto_solib_add);
+	  solib_add (NULL, 0, auto_solib_add);
 #endif
 	  target_terminal_inferior ();
 
@@ -3293,19 +3284,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	     operations such as address => section name and hence
 	     require the table to contain all sections (including
 	     those found in shared libraries).  */
-	  /* NOTE: cagney/2003-11-25: Pass current_target and not
-	     exec_ops to SOLIB_ADD.  This is because current GDB is
-	     only tooled to propagate section_table changes out from
-	     the "current_target" (see target_resize_to_sections), and
-	     not up from the exec stratum.  This, of course, isn't
-	     right.  "infrun.c" should only interact with the
-	     exec/process stratum, instead relying on the target stack
-	     to propagate relevant changes (stop, section table
-	     changed, ...) up to other layers.  */
 #ifdef SOLIB_ADD
-	  SOLIB_ADD (NULL, 0, &current_target, auto_solib_add);
+	  SOLIB_ADD (NULL, 0, auto_solib_add);
 #else
-	  solib_add (NULL, 0, &current_target, auto_solib_add);
+	  solib_add (NULL, 0, auto_solib_add);
 #endif
 	  target_terminal_inferior ();
 
Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/remote.c	2009-05-23 01:02:30.000000000 +0100
@@ -2650,7 +2650,7 @@ remote_start_remote (struct ui_out *uiou
   /* On OSs where the list of libraries is global to all
      processes, we fetch them early.  */
   if (gdbarch_has_global_solist (target_gdbarch))
-    solib_add (NULL, args->from_tty, args->target, auto_solib_add);
+    solib_add (NULL, args->from_tty, auto_solib_add);
 
   if (non_stop)
     {
Index: src/gdb/solib.h
===================================================================
--- src.orig/gdb/solib.h	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/solib.h	2009-05-23 01:02:30.000000000 +0100
@@ -33,7 +33,7 @@ extern void clear_solib (void);
 
 /* Called to add symbols from a shared library to gdb's symbol table. */
 
-extern void solib_add (char *, int, struct target_ops *, int);
+extern void solib_add (char *, int, int);
 extern int solib_read_symbols (struct so_list *, int);
 
 /* Function to be called when the inferior starts up, to discover the
Index: src/gdb/solib-frv.c
===================================================================
--- src.orig/gdb/solib-frv.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/solib-frv.c	2009-05-23 01:02:30.000000000 +0100
@@ -1249,7 +1249,7 @@ frv_fetch_objfile_link_map (struct objfi
 
   /* Cause frv_current_sos() to be run if it hasn't been already.  */
   if (main_lm_addr == 0)
-    solib_add (0, 0, 0, 1);
+    solib_add (0, 0, 1);
 
   /* frv_current_sos() will set main_lm_addr for the main executable.  */
   if (objfile == symfile_objfile)
Index: src/gdb/solib-irix.c
===================================================================
--- src.orig/gdb/solib-irix.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/solib-irix.c	2009-05-23 01:02:30.000000000 +0100
@@ -467,7 +467,7 @@ irix_solib_create_inferior_hook (void)
      and will put out an annoying warning.
      Delaying the resetting of stop_soon until after symbol loading
      suppresses the warning.  */
-  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
+  solib_add ((char *) 0, 0, auto_solib_add);
   inf->stop_soon = NO_STOP_QUIETLY;
 }
 
Index: src/gdb/config/rs6000/nm-rs6000.h
===================================================================
--- src.orig/gdb/config/rs6000/nm-rs6000.h	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/config/rs6000/nm-rs6000.h	2009-05-23 01:02:30.000000000 +0100
@@ -29,17 +29,16 @@
 /* When a target process or core-file has been attached, we sneak in
    and figure out where the shared libraries have got to.  */
 
-#define	SOLIB_ADD(a, b, c, d)	\
+#define	SOLIB_ADD(a, b, c)	\
   if (PIDGET (inferior_ptid))	\
     /* Attach to process.  */  \
     xcoff_relocate_symtab (PIDGET (inferior_ptid)); \
   else		\
     /* Core file.  */ \
-    xcoff_relocate_core (c);
+    xcoff_relocate_core ();
 
 extern void xcoff_relocate_symtab (unsigned int);
-struct target_ops;
-extern void xcoff_relocate_core (struct target_ops *);
+extern void xcoff_relocate_core (void);
 
 /* If ADDR lies in a shared library, return its name.  */
 
Index: src/gdb/rs6000-nat.c
===================================================================
--- src.orig/gdb/rs6000-nat.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/rs6000-nat.c	2009-05-23 01:02:30.000000000 +0100
@@ -1081,7 +1081,7 @@ xcoff_relocate_symtab (unsigned int pid)
    from the core file.  */
 
 void
-xcoff_relocate_core (struct target_ops *target)
+xcoff_relocate_core (void)
 {
   struct bfd_section *ldinfo_sec;
   int offset = 0;
@@ -1160,8 +1160,8 @@ xcoff_relocate_core (struct target_ops *
 	{
 	  struct target_section *stp;
 
-	  target_resize_to_sections (target, 2);
-	  stp = target->to_sections_end - 2;
+	  resize_target_section_table (&current_target_sections->core, 2);
+	  stp = current_target_sections->core.end - 2;
 
 	  stp->bfd = vp->bfd;
 	  stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".text");
Index: src/gdb/windows-nat.c
===================================================================
--- src.orig/gdb/windows-nat.c	2009-05-23 00:33:07.000000000 +0100
+++ src/gdb/windows-nat.c	2009-05-23 01:02:30.000000000 +0100
@@ -775,7 +775,7 @@ handle_unload_dll (void *dummy)
 	DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n", sodel->so_name));
 
 	windows_free_so (sodel);
-	solib_add (NULL, 0, NULL, auto_solib_add);
+	solib_add (NULL, 0, auto_solib_add);
 	return 1;
       }
 
Index: src/gdb/solib-osf.c
===================================================================
--- src.orig/gdb/solib-osf.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/solib-osf.c	2009-05-23 01:02:30.000000000 +0100
@@ -354,7 +354,7 @@ osf_solib_create_inferior_hook (void)
      and will put out an annoying warning.
      Delaying the resetting of stop_soon until after symbol loading
      suppresses the warning.  */
-  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
+  solib_add ((char *) 0, 0, auto_solib_add);
   inf->stop_soon = NO_STOP_QUIETLY;
 }
 
Index: src/gdb/solib-sunos.c
===================================================================
--- src.orig/gdb/solib-sunos.c	2009-05-23 00:45:37.000000000 +0100
+++ src/gdb/solib-sunos.c	2009-05-23 01:02:30.000000000 +0100
@@ -799,7 +799,7 @@ sunos_solib_create_inferior_hook (void)
       warning (_("shared library handler failed to disable breakpoint"));
     }
 
-  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
+  solib_add ((char *) 0, 0, auto_solib_add);
 }
 
 static void


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]