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]

Re: [commit] cleanup stale exec.{h|c} xfer_memory comments.


On Saturday 13 June 2009 13:24:48, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Sat, 13 Jun 2009 12:50:02 +0100
> > Cc: gdb-patches@sourceware.org
> > 
> > The other exported functions of exec.c were
> > described in the header (and the ones that are new came from
> > target.h, that describes many function in the header too, including
> > the ones related to section_table_xfer_memory_partial).  I thought
> > I'd follow suit for consistency with the surrounding code.
> 
> I didn't know that exec.c describes functions in the headers.  I'm
> traveling and have no easy access to GDB sources.  I just saw that you
> removed the description from exec.c and added the more accurate one to
> exec.h.

Close, I adjusted the one that was already there in exec.h.  True
enough, I added the original description in exec.h recently ...

> > Fine with me.  But if we're going to move the description of
> > this function, we should move all the others in exec.h too.  Shall
> > I do this, or do you want to do it?
> 
> I will be able to do that only  in a few days, when I return home.  So
> if you have time before that, please do it.  Or maybe we should wait
> for others to chime in: this is a matter of personal preferences, and
> I've been burned before asking to adhere to mine.

For modules that are isolated and used by several other components,
(e.g., gdbthread.h, breakpoints.h), as an API client, I prefer to have
functions described in the headers.  But this case doesn't qualify
much as such, so ... find below the patch that moves the comments
around.

Joel already said he prefers descriptions in .c files, so if
nobody objects, or if I hear a "go ahead", I'll commit the below
with a changelog entry, and be done with it.

-- 
Pedro Alves


---
 gdb/exec.c |   27 +++++++++++++++++++++++++--
 gdb/exec.h |   35 -----------------------------------
 2 files changed, 25 insertions(+), 37 deletions(-)

Index: src/gdb/exec.c
===================================================================
--- src.orig/gdb/exec.c	2009-06-13 14:16:34.000000000 +0100
+++ src/gdb/exec.c	2009-06-13 14:19:03.000000000 +0100
@@ -397,6 +397,9 @@ add_to_section_table (bfd *abfd, struct 
   (*table_pp)++;
 }
 
+/* Resize the section table held by TABLE, by NUM_ADDED.  Returns the
+   old size.  */
+
 int
 resize_section_table (struct target_section_table *table, int num_added)
 {
@@ -559,6 +562,22 @@ map_vmap (bfd *abfd, bfd *arch)
   return vp;
 }
 
+/* Read or write from mappable sections of BFD executable files.
+
+   Request to transfer up to LEN 8-bit bytes of the target sections
+   defined by SECTIONS and SECTIONS_END.  The OFFSET specifies the
+   starting address.
+   If SECTION_NAME is not NULL, only access sections with that same
+   name.
+
+   Return the number of bytes actually transfered, or zero when no
+   data is available for the requested range.
+
+   This function is intended to be used from target_xfer_partial
+   implementations.  See target_read and target_write for more
+   information.
+
+   One, and only one, of readbuf or writebuf must be non-NULL.  */
 
 int
 section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
@@ -644,8 +663,12 @@ exec_xfer_partial (struct target_ops *op
 }
 
 
+/* Prints info about all sections defined in the TABLE.  ABFD is
+   special cased --- it's filename is omitted; if it is the executable
+   file, its entry point is printed.  */
+
 void
-print_section_info (struct target_section_table *t, bfd *abfd)
+print_section_info (struct target_section_table *table, bfd *abfd)
 {
   struct target_section *p;
   /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64.  */
@@ -657,7 +680,7 @@ print_section_info (struct target_sectio
   if (abfd == exec_bfd)
     printf_filtered (_("\tEntry point: %s\n"),
                      paddress (bfd_get_start_address (abfd)));
-  for (p = t->sections; p < t->sections_end; p++)
+  for (p = table->sections; p < table->sections_end; p++)
     {
       printf_filtered ("\t%s", hex_string_custom (p->addr, wid));
       printf_filtered (" - %s", hex_string_custom (p->endaddr, wid));
Index: src/gdb/exec.h
===================================================================
--- src.orig/gdb/exec.h	2009-06-13 14:16:32.000000000 +0100
+++ src/gdb/exec.h	2009-06-13 14:19:17.000000000 +0100
@@ -28,59 +28,24 @@ struct bfd;
 
 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 target_section **,
 				struct target_section **);
 
-/* Resize the section table held by TABLE, by NUM_ADDED.  Returns the
-   old size.  */
-
 extern int resize_section_table (struct target_section_table *, int);
 
-/* Read or write from mappable sections of BFD executable files.
-
-   Request to transfer up to LEN 8-bit bytes of the target sections
-   defined by SECTIONS and SECTIONS_END.  The OFFSET specifies the
-   starting address.
-   If SECTION_NAME is not NULL, only access sections with that same
-   name.
-
-   Return the number of bytes actually transfered, or zero when no
-   data is available for the requested range.
-
-   This function is intended to be used from target_xfer_partial
-   implementations.  See target_read and target_write for more
-   information.
-
-   One, and only one, of readbuf or writebuf must be non-NULL.  */
-
 extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
 					      ULONGEST, LONGEST,
 					      struct target_section *,
 					      struct target_section *,
 					      const char *);
-
-/* Set the loaded address of a section.  */
 extern void exec_set_section_address (const char *, int, CORE_ADDR);
 
-/* Remove all target sections taken from ABFD.  */
-
 extern void remove_target_sections (bfd *abfd);
 
-/* Add the sections array defined by [SECTIONS..SECTIONS_END[ to the
-   current set of target sections.  */
-
 extern void add_target_sections (struct target_section *sections,
 				 struct target_section *sections_end);
 
-/* Prints info about all sections defined in the TABLE.  ABFD is
-   special cased --- it's filename is omitted; if it is the executable
-   file, its entry point is printed.  */
-
 extern void print_section_info (struct target_section_table *table,
 				bfd *abfd);
 
-
 #endif


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