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]

struct section_table is not really a table per se.


It has itched me much that struct section_table is called
section_table, because a single instance of this object isn't
really a table.  I kept scratching my head at what to call
an object that really held target section tables...

I think it's just best to rename the offender.  Here goes,
built with --enable-targets=all, tested on x86_64-linux,
grepped for left over instances (found none), and applied.

Notice how the return type of target_section_by_addr doesn't
look out of place anymore.

-- 
Pedro Alves

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

	* target.h (struct section_table): Rename to ...
	(struct target_section): ... this.
	* exec.c: Adjust all references.
	* exec.h: Adjust all references.
	* nto-tdep.c: Adjust all references.
	* nto-tdep.h: Adjust all references.
	* ppc-linux-tdep.c: Adjust all references.
	* rs6000-nat.c: Adjust all references.
	* s390-tdep.c: Adjust all references.
	* solib-darwin.c: Adjust all references.
	* solib-frv.c: Adjust all references.
	* solib-irix.c: Adjust all references.
	* solib-null.c: Adjust all references.
	* solib-osf.c: Adjust all references.
	* solib-pa64.c: Adjust all references.
	* solib-som.c: Adjust all references.
	* solib-sunos.c: Adjust all references.
	* solib-svr4.c: Adjust all references.
	* solib-target.c: Adjust all references.
	* solib.c: Adjust all references.
	* solist.h: Adjust all references.
	* symfile.c: Adjust all references.
	* symfile.h: Adjust all references.
	* target.c: Adjust all references.

---
 gdb/exec.c           |   24 ++++++++++++------------
 gdb/exec.h           |   10 +++++-----
 gdb/nto-tdep.c       |    2 +-
 gdb/nto-tdep.h       |    2 +-
 gdb/ppc-linux-tdep.c |    2 +-
 gdb/rs6000-nat.c     |    2 +-
 gdb/s390-tdep.c      |    2 +-
 gdb/solib-darwin.c   |    2 +-
 gdb/solib-frv.c      |    2 +-
 gdb/solib-irix.c     |    2 +-
 gdb/solib-null.c     |    2 +-
 gdb/solib-osf.c      |    2 +-
 gdb/solib-pa64.c     |    2 +-
 gdb/solib-som.c      |    2 +-
 gdb/solib-sunos.c    |    2 +-
 gdb/solib-svr4.c     |    2 +-
 gdb/solib-target.c   |    2 +-
 gdb/solib.c          |    4 ++--
 gdb/solist.h         |    6 +++---
 gdb/symfile.c        |    6 +++---
 gdb/symfile.h        |    6 +++---
 gdb/target.c         |   18 +++++++++---------
 gdb/target.h         |   13 ++++++-------
 23 files changed, 58 insertions(+), 59 deletions(-)

Index: src/gdb/exec.c
===================================================================
--- src.orig/gdb/exec.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/exec.c	2009-05-23 00:33:07.000000000 +0100
@@ -351,7 +351,7 @@ static void
 add_to_section_table (bfd *abfd, struct bfd_section *asect,
 		      void *table_pp_char)
 {
-  struct section_table **table_pp = (struct section_table **) table_pp_char;
+  struct target_section **table_pp = (struct target_section **) table_pp_char;
   flagword aflag;
 
   /* Check the section flags, but do not discard zero-length sections, since
@@ -374,15 +374,15 @@ add_to_section_table (bfd *abfd, struct 
    Returns 0 if OK, 1 on error.  */
 
 int
-build_section_table (struct bfd *some_bfd, struct section_table **start,
-		     struct section_table **end)
+build_section_table (struct bfd *some_bfd, struct target_section **start,
+		     struct target_section **end)
 {
   unsigned count;
 
   count = bfd_count_sections (some_bfd);
   if (*start)
     xfree (* start);
-  *start = (struct section_table *) xmalloc (count * sizeof (**start));
+  *start = (struct target_section *) xmalloc (count * sizeof (**start));
   *end = *start;
   bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
   if (*end > *start + count)
@@ -470,12 +470,12 @@ map_vmap (bfd *abfd, bfd *arch)
 static int
 section_table_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
 			   int len, int write,
-			   struct section_table *sections,
-			   struct section_table *sections_end,
+			   struct target_section *sections,
+			   struct target_section *sections_end,
 			   const char *section_name)
 {
   int res;
-  struct section_table *p;
+  struct target_section *p;
   CORE_ADDR nextsectaddr, memend;
 
   if (len <= 0)
@@ -536,8 +536,8 @@ section_table_xfer_memory (CORE_ADDR mem
 int
 section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
 				   ULONGEST offset, LONGEST len,
-				   struct section_table *sections,
-				   struct section_table *sections_end)
+				   struct target_section *sections,
+				   struct target_section *sections_end)
 {
   if (readbuf != NULL)
     return section_table_xfer_memory (offset, readbuf, len, 0,
@@ -597,7 +597,7 @@ xfer_memory (CORE_ADDR memaddr, gdb_byte
 void
 print_section_info (struct target_ops *t, bfd *abfd)
 {
-  struct section_table *p;
+  struct target_section *p;
   /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64.  */
   int wid = gdbarch_addr_bit (gdbarch_from_bfd (abfd)) <= 32 ? 8 : 16;
 
@@ -661,7 +661,7 @@ exec_files_info (struct target_ops *t)
 static void
 set_section_command (char *args, int from_tty)
 {
-  struct section_table *p;
+  struct target_section *p;
   char *secname;
   unsigned seclen;
   unsigned long secaddr;
@@ -704,7 +704,7 @@ set_section_command (char *args, int fro
 void
 exec_set_section_address (const char *filename, int index, CORE_ADDR address)
 {
-  struct section_table *p;
+  struct target_section *p;
 
   for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
     {
Index: src/gdb/exec.h
===================================================================
--- src.orig/gdb/exec.h	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/exec.h	2009-05-23 00:33:07.000000000 +0100
@@ -22,7 +22,7 @@
 
 #include "target.h"
 
-struct section_table;
+struct target_section;
 struct target_ops;
 struct bfd;
 
@@ -31,8 +31,8 @@ extern struct target_ops exec_ops;
 /* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
    Returns 0 if OK, 1 on error.  */
 
-extern int build_section_table (struct bfd *, struct section_table **,
-				struct section_table **);
+extern int build_section_table (struct bfd *, struct target_section **,
+				struct target_section **);
 
 /* Request to transfer up to LEN 8-bit bytes of the target sections
    defined by SECTIONS and SECTIONS_END.  The OFFSET specifies the
@@ -49,8 +49,8 @@ extern int build_section_table (struct b
 
 extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
 					      ULONGEST, LONGEST,
-					      struct section_table *,
-					      struct section_table *);
+					      struct target_section *,
+					      struct target_section *);
 
 /* Set the loaded address of a section.  */
 extern void exec_set_section_address (const char *, int, CORE_ADDR);
Index: src/gdb/nto-tdep.c
===================================================================
--- src.orig/gdb/nto-tdep.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/nto-tdep.c	2009-05-22 19:00:04.000000000 +0100
@@ -318,7 +318,7 @@ find_load_phdr (bfd *abfd)
 }
 
 void
-nto_relocate_section_addresses (struct so_list *so, struct section_table *sec)
+nto_relocate_section_addresses (struct so_list *so, struct target_section *sec)
 {
   /* Neutrino treats the l_addr base address field in link.h as different than
      the base address in the System V ABI and so the offset needs to be
Index: src/gdb/nto-tdep.h
===================================================================
--- src.orig/gdb/nto-tdep.h	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/nto-tdep.h	2009-05-22 19:00:04.000000000 +0100
@@ -150,7 +150,7 @@ char **nto_parse_redirection (char *star
 int proc_iterate_over_mappings (int (*func) (int, CORE_ADDR));
 
 void nto_relocate_section_addresses (struct so_list *,
-				     struct section_table *);
+				     struct target_section *);
 
 int nto_map_arch_to_cputype (const char *);
 
Index: src/gdb/ppc-linux-tdep.c
===================================================================
--- src.orig/gdb/ppc-linux-tdep.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/ppc-linux-tdep.c	2009-05-23 00:33:07.000000000 +0100
@@ -621,7 +621,7 @@ ppc64_linux_convert_from_func_ptr_addr (
 					CORE_ADDR addr,
 					struct target_ops *targ)
 {
-  struct section_table *s = target_section_by_addr (targ, addr);
+  struct target_section *s = target_section_by_addr (targ, addr);
 
   /* Check if ADDR points to a function descriptor.  */
   if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
Index: src/gdb/rs6000-nat.c
===================================================================
--- src.orig/gdb/rs6000-nat.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/rs6000-nat.c	2009-05-23 00:33:07.000000000 +0100
@@ -1158,7 +1158,7 @@ xcoff_relocate_core (struct target_ops *
          add our sections to the section table for the core target.  */
       if (vp != vmap)
 	{
-	  struct section_table *stp;
+	  struct target_section *stp;
 
 	  target_resize_to_sections (target, 2);
 	  stp = target->to_sections_end - 2;
Index: src/gdb/s390-tdep.c
===================================================================
--- src.orig/gdb/s390-tdep.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/s390-tdep.c	2009-05-23 00:33:07.000000000 +0100
@@ -772,7 +772,7 @@ s390_load (struct s390_prologue_data *da
      we're analyzing the code to unwind past that frame.  */
   if (pv_is_constant (addr))
     {
-      struct section_table *secp;
+      struct target_section *secp;
       secp = target_section_by_addr (&current_target, addr.k);
       if (secp != NULL
           && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)
Index: src/gdb/solib-darwin.c
===================================================================
--- src.orig/gdb/solib-darwin.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solib-darwin.c	2009-05-22 19:00:04.000000000 +0100
@@ -379,7 +379,7 @@ darwin_free_so (struct so_list *so)
    Relocate these VMAs according to solib info.  */
 static void
 darwin_relocate_section_addresses (struct so_list *so,
-				   struct section_table *sec)
+				   struct target_section *sec)
 {
   sec->addr += so->lm_info->lm_addr;
   sec->endaddr += so->lm_info->lm_addr;
Index: src/gdb/solib-frv.c
===================================================================
--- src.orig/gdb/solib-frv.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/solib-frv.c	2009-05-23 00:33:07.000000000 +0100
@@ -998,7 +998,7 @@ frv_free_so (struct so_list *so)
 
 static void
 frv_relocate_section_addresses (struct so_list *so,
-                                 struct section_table *sec)
+                                 struct target_section *sec)
 {
   int seg;
   struct int_elf32_fdpic_loadmap *map;
Index: src/gdb/solib-irix.c
===================================================================
--- src.orig/gdb/solib-irix.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/solib-irix.c	2009-05-23 00:33:07.000000000 +0100
@@ -687,7 +687,7 @@ irix_special_symbol_handling (void)
 
 static void
 irix_relocate_section_addresses (struct so_list *so,
-				 struct section_table *sec)
+				 struct target_section *sec)
 {
   sec->addr += so->lm_info->reloc_offset;
   sec->endaddr += so->lm_info->reloc_offset;
Index: src/gdb/solib-null.c
===================================================================
--- src.orig/gdb/solib-null.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solib-null.c	2009-05-22 19:00:04.000000000 +0100
@@ -50,7 +50,7 @@ null_free_so (struct so_list *so)
 
 static void
 null_relocate_section_addresses (struct so_list *so,
-                                 struct section_table *sec)
+                                 struct target_section *sec)
 {
 }
 
Index: src/gdb/solib-osf.c
===================================================================
--- src.orig/gdb/solib-osf.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solib-osf.c	2009-05-23 00:33:07.000000000 +0100
@@ -234,7 +234,7 @@ fetch_sec_names (struct lm_info *lmi)
 
 static void
 osf_relocate_section_addresses (struct so_list *so,
-				struct section_table *sec)
+				struct target_section *sec)
 {
   struct lm_info *lmi;
   struct lm_sec lms_key, *lms;
Index: src/gdb/solib-pa64.c
===================================================================
--- src.orig/gdb/solib-pa64.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solib-pa64.c	2009-05-22 19:00:04.000000000 +0100
@@ -80,7 +80,7 @@ read_dynamic_info (asection *dyninfo_sec
 
 static void
 pa64_relocate_section_addresses (struct so_list *so,
-				 struct section_table *sec)
+				 struct target_section *sec)
 {
   asection *asec = sec->the_bfd_section;
   CORE_ADDR load_offset;
Index: src/gdb/solib-som.c
===================================================================
--- src.orig/gdb/solib-som.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solib-som.c	2009-05-22 19:00:04.000000000 +0100
@@ -111,7 +111,7 @@ dld_cache;
 
 static void
 som_relocate_section_addresses (struct so_list *so,
-				struct section_table *sec)
+				struct target_section *sec)
 {
   flagword aflag = bfd_get_section_flags(so->abfd, sec->the_bfd_section);
 
Index: src/gdb/solib-sunos.c
===================================================================
--- src.orig/gdb/solib-sunos.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/solib-sunos.c	2009-05-23 00:33:07.000000000 +0100
@@ -817,7 +817,7 @@ sunos_free_so (struct so_list *so)
 
 static void
 sunos_relocate_section_addresses (struct so_list *so,
-                                 struct section_table *sec)
+				  struct target_section *sec)
 {
   sec->addr += LM_ADDR (so);
   sec->endaddr += LM_ADDR (so);
Index: src/gdb/solib-svr4.c
===================================================================
--- src.orig/gdb/solib-svr4.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solib-svr4.c	2009-05-23 00:33:07.000000000 +0100
@@ -1747,7 +1747,7 @@ svr4_truncate_ptr (CORE_ADDR addr)
 
 static void
 svr4_relocate_section_addresses (struct so_list *so,
-                                 struct section_table *sec)
+                                 struct target_section *sec)
 {
   sec->addr    = svr4_truncate_ptr (sec->addr    + LM_ADDR_CHECK (so,
 								  sec->bfd));
Index: src/gdb/solib-target.c
===================================================================
--- src.orig/gdb/solib-target.c	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solib-target.c	2009-05-22 19:00:04.000000000 +0100
@@ -328,7 +328,7 @@ solib_target_free_so (struct so_list *so
 
 static void
 solib_target_relocate_section_addresses (struct so_list *so,
-					 struct section_table *sec)
+					 struct target_section *sec)
 {
   int flags = bfd_get_section_flags (sec->bfd, sec->the_bfd_section);
   CORE_ADDR offset;
Index: src/gdb/solib.c
===================================================================
--- src.orig/gdb/solib.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/solib.c	2009-05-23 00:33:07.000000000 +0100
@@ -347,7 +347,7 @@ solib_map_sections (void *arg)
 {
   struct so_list *so = (struct so_list *) arg;	/* catch_errors bogon */
   char *filename;
-  struct section_table *p;
+  struct target_section *p;
   struct cleanup *old_chain;
   bfd *abfd;
 
@@ -849,7 +849,7 @@ int
 solib_contains_address_p (const struct so_list *const solib,
 			  CORE_ADDR address)
 {
-  struct section_table *p;
+  struct target_section *p;
 
   for (p = solib->sections; p < solib->sections_end; p++)
     if (p->addr <= address && address < p->endaddr)
Index: src/gdb/solist.h
===================================================================
--- src.orig/gdb/solist.h	2009-05-22 18:58:47.000000000 +0100
+++ src/gdb/solist.h	2009-05-22 19:00:04.000000000 +0100
@@ -62,8 +62,8 @@ struct so_list
     char symbols_loaded;	/* flag: symbols read in yet? */
     char from_tty;		/* flag: print msgs? */
     struct objfile *objfile;	/* objfile for loaded lib */
-    struct section_table *sections;
-    struct section_table *sections_end;
+    struct target_section *sections;
+    struct target_section *sections_end;
 
     /* Record the range of addresses belonging to this shared library.
        There may not be just one (e.g. if two segments are relocated
@@ -76,7 +76,7 @@ struct target_so_ops
     /* Adjust the section binding addresses by the base address at
        which the object was actually mapped.  */
     void (*relocate_section_addresses) (struct so_list *so,
-                                        struct section_table *);
+                                        struct target_section *);
 
     /* Free the the link map info and any other private data
        structures associated with a so_list entry.  */
Index: src/gdb/symfile.c
===================================================================
--- src.orig/gdb/symfile.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/symfile.c	2009-05-22 19:00:04.000000000 +0100
@@ -369,11 +369,11 @@ copy_section_addr_info (struct section_a
    an existing section table. */
 
 extern struct section_addr_info *
-build_section_addr_info_from_section_table (const struct section_table *start,
-                                            const struct section_table *end)
+build_section_addr_info_from_section_table (const struct target_section *start,
+                                            const struct target_section *end)
 {
   struct section_addr_info *sap;
-  const struct section_table *stp;
+  const struct target_section *stp;
   int oidx;
 
   sap = alloc_section_addr_info (end - start);
Index: src/gdb/symfile.h
===================================================================
--- src.orig/gdb/symfile.h	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/symfile.h	2009-05-22 19:00:04.000000000 +0100
@@ -26,7 +26,7 @@
 #include "symtab.h"
 
 /* Opaque declarations.  */
-struct section_table;
+struct target_section;
 struct objfile;
 struct obj_section;
 struct obstack;
@@ -237,9 +237,9 @@ extern struct section_addr_info *(copy_s
    existing section table.  */
 
 extern struct section_addr_info
-  *build_section_addr_info_from_section_table (const struct section_table
+  *build_section_addr_info_from_section_table (const struct target_section
 					       *start,
-					       const struct section_table
+					       const struct target_section
 					       *end);
 
 /* Free all memory allocated by
Index: src/gdb/target.c
===================================================================
--- src.orig/gdb/target.c	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/target.c	2009-05-23 00:33:07.000000000 +0100
@@ -1017,10 +1017,10 @@ done:
 }
 
 /* Find a section containing ADDR.  */
-struct section_table *
+struct target_section *
 target_section_by_addr (struct target_ops *target, CORE_ADDR addr)
 {
-  struct section_table *secp;
+  struct target_section *secp;
   for (secp = target->to_sections;
        secp < target->to_sections_end;
        secp++)
@@ -1049,7 +1049,7 @@ memory_xfer_partial (struct target_ops *
   /* Try the executable file, if "trust-readonly-sections" is set.  */
   if (readbuf != NULL && trust_readonly)
     {
-      struct section_table *secp;
+      struct target_section *secp;
 
       secp = target_section_by_addr (ops, memaddr);
       if (secp != NULL
@@ -2348,7 +2348,7 @@ int
 target_resize_to_sections (struct target_ops *target, int num_added)
 {
   struct target_ops **t;
-  struct section_table *old_value;
+  struct target_section *old_value;
   int old_count;
 
   old_value = target->to_sections;
@@ -2356,15 +2356,15 @@ target_resize_to_sections (struct target
   if (target->to_sections)
     {
       old_count = target->to_sections_end - target->to_sections;
-      target->to_sections = (struct section_table *)
+      target->to_sections = (struct target_section *)
 	xrealloc ((char *) target->to_sections,
-		  (sizeof (struct section_table)) * (num_added + old_count));
+		  (sizeof (struct target_section)) * (num_added + old_count));
     }
   else
     {
       old_count = 0;
-      target->to_sections = (struct section_table *)
-	xmalloc ((sizeof (struct section_table)) * num_added);
+      target->to_sections = (struct target_section *)
+	xmalloc ((sizeof (struct target_section)) * num_added);
     }
   target->to_sections_end = target->to_sections + (num_added + old_count);
 
@@ -2408,7 +2408,7 @@ remove_target_sections (bfd *abfd)
 
   for (t = target_structs; t < target_structs + target_struct_size; t++)
     {
-      struct section_table *src, *dest;
+      struct target_section *src, *dest;
 
       dest = (*t)->to_sections;
       for (src = (*t)->to_sections; src < (*t)->to_sections_end; src++)
Index: src/gdb/target.h
===================================================================
--- src.orig/gdb/target.h	2009-05-22 18:58:48.000000000 +0100
+++ src/gdb/target.h	2009-05-23 00:33:07.000000000 +0100
@@ -420,9 +420,9 @@ struct target_ops
     int to_has_execution;
     int to_has_thread_control;	/* control thread execution */
     int to_attach_no_wait;
-    struct section_table
+    struct target_section
      *to_sections;
-    struct section_table
+    struct target_section
      *to_sections_end;
     /* ASYNC target controls */
     int (*to_can_async_p) (void);
@@ -1194,11 +1194,11 @@ void target_mark_running (struct target_
 
 void target_mark_exited (struct target_ops *);
 
-/* Struct section_table maps address ranges to file sections.  It is
+/* Struct target_section maps address ranges to file sections.  It is
    mostly used with BFD files, but can be used without (e.g. for handling
    raw disks, or files not in formats handled by BFD).  */
 
-struct section_table
+struct target_section
   {
     CORE_ADDR addr;		/* Lowest address in section */
     CORE_ADDR endaddr;		/* 1+highest address in section */
@@ -1209,9 +1209,8 @@ struct section_table
   };
 
 /* Return the "section" containing the specified address.  */
-struct section_table *target_section_by_addr (struct target_ops *target,
-					      CORE_ADDR addr);
-
+struct target_section *target_section_by_addr (struct target_ops *target,
+					       CORE_ADDR addr);
 
 /* From mem-break.c */
 


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