Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] constify symfile.h section_offsets, section_addr_info
@ 2013-05-06 16:52 Doug Evans
  2013-05-06 18:37 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2013-05-06 16:52 UTC (permalink / raw)
  To: gdb-patches

Hi.
While researching the bfd section count bug,
I found some things a bit confusing: some parameters seemed to be just for
input but weren't marked with const (thus I had to dig deeper than I might
otherwise have had to).
Thus I've gone through and constified a few things.

I will commit this in a few days if there are no objections.

2013-05-05  Doug Evans  <dje@sebabeach.org>

	* dbxread.c (process_one_symbol): Constify section_offsets parameter.
	* stabsread.h (process_one_symbol): Update declaration.
	* dwarf2read.c (dw2_relocate): Constify new_offsets, delta parameters.
	* elfread.c (elf_symfile_relocate_probe): Ditto.
	* psymtab.c (relocate_psymtabs): Ditto.
	* objfiles.c (objfile_relocate1): Constify new_offsets parameter.
	(objfile_relocate): Ditto.
	* objfiles.h (objfile_relocate): Update declaration.
	* symfile.c (relative_addr_info_to_section_offsets): Constify
	addrs parameter.
	(default_symfile_offsets): Ditto.
	(syms_from_objfile_1): Constify offsets parameter.
	(syms_from_objfile): Ditto.
	(symbol_file_add_with_addrs_or_offsets): Ditto.
	(symfile_map_offsets_to_segments): Constify data parameter.
	* symfile.h (struct quick_symbol_functions): Constify new_offsets,
	delta parameters of member relocate.
	(struct sym_probe_fns): Constify new_offsets,
	delta parameters of member sym_relocate_probe.
	(struct sym_fns): Constify section_addr_info parameter of member
	sym_offsets.
	(relative_addr_info_to_section_offsets): Update declaration.
	(default_symfile_offsets): Ditto.
	(syms_from_objfile): Ditto.
	(symfile_map_offsets_to_segments): Ditto.

Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.145
diff -u -p -r1.145 dbxread.c
--- dbxread.c	8 Apr 2013 20:13:21 -0000	1.145
+++ dbxread.c	6 May 2013 05:10:46 -0000
@@ -2717,7 +2717,7 @@ cp_set_block_scope (const struct symbol 
 
 void
 process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
-		    struct section_offsets *section_offsets,
+		    const struct section_offsets *section_offsets,
 		    struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.793
diff -u -p -r1.793 dwarf2read.c
--- dwarf2read.c	30 Apr 2013 23:19:41 -0000	1.793
+++ dwarf2read.c	6 May 2013 05:10:47 -0000
@@ -3311,8 +3311,9 @@ dw2_dump (struct objfile *objfile)
 }
 
 static void
-dw2_relocate (struct objfile *objfile, struct section_offsets *new_offsets,
-	      struct section_offsets *delta)
+dw2_relocate (struct objfile *objfile,
+	      const struct section_offsets *new_offsets,
+	      const struct section_offsets *delta)
 {
   /* There's nothing to relocate here.  */
 }
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.154
diff -u -p -r1.154 elfread.c
--- elfread.c	15 Apr 2013 17:31:17 -0000	1.154
+++ elfread.c	6 May 2013 05:10:47 -0000
@@ -1667,8 +1667,8 @@ elf_compile_to_ax (struct probe *probe,
 
 static void
 elf_symfile_relocate_probe (struct objfile *objfile,
-			    struct section_offsets *new_offsets,
-			    struct section_offsets *delta)
+			    const struct section_offsets *new_offsets,
+			    const struct section_offsets *delta)
 {
   int ix;
   VEC (probe_p) *probes = objfile_data (objfile, probe_key);
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.159
diff -u -p -r1.159 objfiles.c
--- objfiles.c	4 May 2013 06:19:31 -0000	1.159
+++ objfiles.c	6 May 2013 05:10:47 -0000
@@ -709,7 +709,7 @@ relocate_one_symbol (struct symbol *sym,
 
 static int
 objfile_relocate1 (struct objfile *objfile, 
-		   struct section_offsets *new_offsets)
+		   const struct section_offsets *new_offsets)
 {
   struct obj_section *s;
   struct section_offsets *delta =
@@ -856,7 +856,8 @@ objfile_relocate1 (struct objfile *objfi
    files.  */
 
 void
-objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+objfile_relocate (struct objfile *objfile,
+		  const struct section_offsets *new_offsets)
 {
   struct objfile *debug_objfile;
   int changed = 0;
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.105
diff -u -p -r1.105 objfiles.h
--- objfiles.h	8 Apr 2013 20:04:42 -0000	1.105
+++ objfiles.h	6 May 2013 05:10:47 -0000
@@ -467,7 +467,7 @@ extern struct cleanup *make_cleanup_free
 
 extern void free_all_objfiles (void);
 
-extern void objfile_relocate (struct objfile *, struct section_offsets *);
+extern void objfile_relocate (struct objfile *, const struct section_offsets *);
 extern void objfile_rebase (struct objfile *, CORE_ADDR);
 
 extern int objfile_has_partial_symbols (struct objfile *objfile);
Index: psymtab.c
===================================================================
RCS file: /cvs/src/src/gdb/psymtab.c,v
retrieving revision 1.73
diff -u -p -r1.73 psymtab.c
--- psymtab.c	8 Apr 2013 20:18:11 -0000	1.73
+++ psymtab.c	6 May 2013 05:10:47 -0000
@@ -785,8 +785,8 @@ psymtab_to_symtab (struct objfile *objfi
 
 static void
 relocate_psymtabs (struct objfile *objfile,
-		   struct section_offsets *new_offsets,
-		   struct section_offsets *delta)
+		   const struct section_offsets *new_offsets,
+		   const struct section_offsets *delta)
 {
   struct partial_symbol **psym;
   struct partial_symtab *p;
Index: stabsread.h
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.h,v
retrieving revision 1.32
diff -u -p -r1.32 stabsread.h
--- stabsread.h	1 Jan 2013 06:32:51 -0000	1.32
+++ stabsread.h	6 May 2013 05:10:47 -0000
@@ -172,7 +172,8 @@ extern struct partial_symtab *end_psymta
 					   int textlow_not_set);
 
 extern void process_one_symbol (int, int, CORE_ADDR, char *,
-				struct section_offsets *, struct objfile *);
+				const struct section_offsets *,
+				struct objfile *);
 
 extern void elfstab_build_psymtabs (struct objfile *objfile,
 				    asection *stabsect,
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.372
diff -u -p -r1.372 symfile.c
--- symfile.c	5 May 2013 16:54:26 -0000	1.372
+++ symfile.c	6 May 2013 05:10:47 -0000
@@ -445,7 +445,7 @@ place_section (bfd *abfd, asection *sect
 void
 relative_addr_info_to_section_offsets (struct section_offsets *section_offsets,
 				       int num_sections,
-				       struct section_addr_info *addrs)
+				       const struct section_addr_info *addrs)
 {
   int i;
 
@@ -454,7 +454,7 @@ relative_addr_info_to_section_offsets (s
   /* Now calculate offsets for section that were specified by the caller.  */
   for (i = 0; i < addrs->num_sections; i++)
     {
-      struct other_sections *osp;
+      const struct other_sections *osp;
 
       osp = &addrs->other[i];
       if (osp->sectindex == -1)
@@ -676,7 +676,7 @@ addr_info_make_relative (struct section_
 
 void
 default_symfile_offsets (struct objfile *objfile,
-			 struct section_addr_info *addrs)
+			 const struct section_addr_info *addrs)
 {
   objfile->num_sections = gdb_bfd_count_sections (objfile->obfd);
   objfile->section_offsets = (struct section_offsets *)
@@ -932,7 +932,7 @@ init_entry_point_info (struct objfile *o
 static void
 syms_from_objfile_1 (struct objfile *objfile,
 		     struct section_addr_info *addrs,
-		     struct section_offsets *offsets,
+		     const struct section_offsets *offsets,
 		     int num_offsets,
 		     int add_flags)
 {
@@ -1042,7 +1042,7 @@ syms_from_objfile_1 (struct objfile *obj
 void
 syms_from_objfile (struct objfile *objfile,
 		   struct section_addr_info *addrs,
-		   struct section_offsets *offsets,
+		   const struct section_offsets *offsets,
 		   int num_offsets,
 		   int add_flags)
 {
@@ -1099,7 +1099,7 @@ static struct objfile *
 symbol_file_add_with_addrs_or_offsets (bfd *abfd,
                                        int add_flags,
                                        struct section_addr_info *addrs,
-                                       struct section_offsets *offsets,
+                                       const struct section_offsets *offsets,
                                        int num_offsets,
                                        int flags, struct objfile *parent)
 {
@@ -3672,7 +3672,8 @@ free_symfile_segment_data (struct symfil
    not be able to distinguish between an empty data segment and a
    missing data segment; a missing text segment is less plausible.  */
 int
-symfile_map_offsets_to_segments (bfd *abfd, struct symfile_segment_data *data,
+symfile_map_offsets_to_segments (bfd *abfd,
+				 const struct symfile_segment_data *data,
 				 struct section_offsets *offsets,
 				 int num_segment_bases,
 				 const CORE_ADDR *segment_bases)
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.125
diff -u -p -r1.125 symfile.h
--- symfile.h	12 Apr 2013 14:55:28 -0000	1.125
+++ symfile.h	6 May 2013 05:10:47 -0000
@@ -201,8 +201,8 @@ struct quick_symbol_functions
   /* This is called by objfile_relocate to relocate any indices loaded
      for OBJFILE.  */
   void (*relocate) (struct objfile *objfile,
-		    struct section_offsets *new_offsets,
-		    struct section_offsets *delta);
+		    const struct section_offsets *new_offsets,
+		    const struct section_offsets *delta);
 
   /* Find all the symbols in OBJFILE named FUNC_NAME, and ensure that
      the corresponding symbol tables are loaded.  */
@@ -337,8 +337,8 @@ struct sym_probe_fns
 
   /* Relocate the probe section of OBJFILE.  */
   void (*sym_relocate_probe) (struct objfile *objfile,
-			      struct section_offsets *new_offsets,
-			      struct section_offsets *delta);
+			      const struct section_offsets *new_offsets,
+			      const struct section_offsets *delta);
 };
 
 /* Structure to keep track of symbol reading functions for various
@@ -391,7 +391,7 @@ struct sym_fns
      probably be changed to a string, where NULL means the default,
      and others are parsed in a file dependent way.  */
 
-  void (*sym_offsets) (struct objfile *, struct section_addr_info *);
+  void (*sym_offsets) (struct objfile *, const struct section_addr_info *);
 
   /* This function produces a format-independent description of
      the segments of ABFD.  Each segment is a unit of the file
@@ -425,7 +425,7 @@ extern struct section_addr_info *
 
 extern void relative_addr_info_to_section_offsets
   (struct section_offsets *section_offsets, int num_sections,
-   struct section_addr_info *addrs);
+   const struct section_addr_info *addrs);
 
 extern void addr_info_make_relative (struct section_addr_info *addrs,
 				     bfd *abfd);
@@ -434,7 +434,7 @@ extern void addr_info_make_relative (str
    do anything special.  */
 
 extern void default_symfile_offsets (struct objfile *objfile,
-				     struct section_addr_info *);
+				     const struct section_addr_info *);
 
 /* The default version of sym_fns.sym_segments for readers that don't
    do anything special.  */
@@ -474,7 +474,7 @@ enum symfile_add_flags
 
 extern void syms_from_objfile (struct objfile *,
 			       struct section_addr_info *,
-			       struct section_offsets *, int, int);
+			       const struct section_offsets *, int, int);
 
 extern void new_symfile_objfile (struct objfile *, int);
 
@@ -585,7 +585,7 @@ extern bfd_byte *symfile_relocate_debug_
 						 bfd_byte *);
 
 extern int symfile_map_offsets_to_segments (bfd *,
-					    struct symfile_segment_data *,
+					    const struct symfile_segment_data *,
 					    struct section_offsets *,
 					    int, const CORE_ADDR *);
 struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] constify symfile.h section_offsets, section_addr_info
  2013-05-06 16:52 [patch] constify symfile.h section_offsets, section_addr_info Doug Evans
@ 2013-05-06 18:37 ` Tom Tromey
  2013-05-06 19:17   ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2013-05-06 18:37 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

>>>>> "Doug" == Doug Evans <dje@google.com> writes:

Doug> While researching the bfd section count bug,
Doug> I found some things a bit confusing: some parameters seemed to be just for
Doug> input but weren't marked with const (thus I had to dig deeper than I might
Doug> otherwise have had to).
Doug> Thus I've gone through and constified a few things.

Doug> I will commit this in a few days if there are no objections.

It looks good to me.
Thanks for doing this.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] constify symfile.h section_offsets, section_addr_info
  2013-05-06 18:37 ` Tom Tromey
@ 2013-05-06 19:17   ` Doug Evans
  2013-05-06 19:37     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2013-05-06 19:17 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Mon, May 6, 2013 at 11:37 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> While researching the bfd section count bug,
> Doug> I found some things a bit confusing: some parameters seemed to be just for
> Doug> input but weren't marked with const (thus I had to dig deeper than I might
> Doug> otherwise have had to).
> Doug> Thus I've gone through and constified a few things.
>
> Doug> I will commit this in a few days if there are no objections.
>
> It looks good to me.
> Thanks for doing this.
>
> Tom

With that, committed.
Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] constify symfile.h section_offsets, section_addr_info
  2013-05-06 19:17   ` Doug Evans
@ 2013-05-06 19:37     ` Tom Tromey
  2013-05-06 19:40       ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2013-05-06 19:37 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

>>>>> "Doug" == Doug Evans <dje@google.com> writes:

Doug> With that, committed.
Doug> Thanks!

I needed this as well.
I'm checking it in.

Tom

2013-05-06  Tom Tromey  <tromey@redhat.com>

	* somread.c (som_symfile_offsets): Add 'const' to addrs.
	* machoread.c (macho_symfile_offsets): Add 'const' to addrs.
	* xcoffread.c (xcoff_symfile_offsets): Add 'const' to addrs.
	Remove declaration.

Index: machoread.c
===================================================================
RCS file: /cvs/src/src/gdb/machoread.c,v
retrieving revision 1.50
diff -u -r1.50 machoread.c
--- machoread.c	8 Apr 2013 20:13:21 -0000	1.50
+++ machoread.c	6 May 2013 19:36:41 -0000
@@ -968,7 +968,7 @@
 
 static void
 macho_symfile_offsets (struct objfile *objfile,
-                       struct section_addr_info *addrs)
+                       const struct section_addr_info *addrs)
 {
   unsigned int i;
   unsigned int num_sections;
Index: somread.c
===================================================================
RCS file: /cvs/src/src/gdb/somread.c,v
retrieving revision 1.61
diff -u -r1.61 somread.c
--- somread.c	8 Apr 2013 20:13:22 -0000	1.61
+++ somread.c	6 May 2013 19:36:41 -0000
@@ -487,7 +487,8 @@
    Plain and simple for now.  */
 
 static void
-som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
+som_symfile_offsets (struct objfile *objfile,
+		     const struct section_addr_info *addrs)
 {
   int i;
   CORE_ADDR text_addr;
Index: xcoffread.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffread.c,v
retrieving revision 1.113
diff -u -r1.113 xcoffread.c
--- xcoffread.c	6 May 2013 14:15:50 -0000	1.113
+++ xcoffread.c	6 May 2013 19:36:41 -0000
@@ -220,9 +220,6 @@
 
 static void xcoff_symfile_finish (struct objfile *);
 
-static void xcoff_symfile_offsets (struct objfile *,
-				   struct section_addr_info *addrs);
-
 static char *coff_getfilename (union internal_auxent *, struct objfile *);
 
 static void read_symbol (struct internal_syment *, int);
@@ -3038,7 +3035,7 @@
 \f
 static void
 xcoff_symfile_offsets (struct objfile *objfile,
-		       struct section_addr_info *addrs)
+		       const struct section_addr_info *addrs)
 {
   const char *first_section_name;
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] constify symfile.h section_offsets, section_addr_info
  2013-05-06 19:37     ` Tom Tromey
@ 2013-05-06 19:40       ` Doug Evans
  0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2013-05-06 19:40 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

enable-targets=all to the rescue
I actually had that on my todo list. Blech.

Thanks.

On Mon, May 6, 2013 at 12:37 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> With that, committed.
> Doug> Thanks!
>
> I needed this as well.
> I'm checking it in.
>
> Tom
>
> 2013-05-06  Tom Tromey  <tromey@redhat.com>
>
>         * somread.c (som_symfile_offsets): Add 'const' to addrs.
>         * machoread.c (macho_symfile_offsets): Add 'const' to addrs.
>         * xcoffread.c (xcoff_symfile_offsets): Add 'const' to addrs.
>         Remove declaration.
>
> Index: machoread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/machoread.c,v
> retrieving revision 1.50
> diff -u -r1.50 machoread.c
> --- machoread.c 8 Apr 2013 20:13:21 -0000       1.50
> +++ machoread.c 6 May 2013 19:36:41 -0000
> @@ -968,7 +968,7 @@
>
>  static void
>  macho_symfile_offsets (struct objfile *objfile,
> -                       struct section_addr_info *addrs)
> +                       const struct section_addr_info *addrs)
>  {
>    unsigned int i;
>    unsigned int num_sections;
> Index: somread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/somread.c,v
> retrieving revision 1.61
> diff -u -r1.61 somread.c
> --- somread.c   8 Apr 2013 20:13:22 -0000       1.61
> +++ somread.c   6 May 2013 19:36:41 -0000
> @@ -487,7 +487,8 @@
>     Plain and simple for now.  */
>
>  static void
> -som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
> +som_symfile_offsets (struct objfile *objfile,
> +                    const struct section_addr_info *addrs)
>  {
>    int i;
>    CORE_ADDR text_addr;
> Index: xcoffread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/xcoffread.c,v
> retrieving revision 1.113
> diff -u -r1.113 xcoffread.c
> --- xcoffread.c 6 May 2013 14:15:50 -0000       1.113
> +++ xcoffread.c 6 May 2013 19:36:41 -0000
> @@ -220,9 +220,6 @@
>
>  static void xcoff_symfile_finish (struct objfile *);
>
> -static void xcoff_symfile_offsets (struct objfile *,
> -                                  struct section_addr_info *addrs);
> -
>  static char *coff_getfilename (union internal_auxent *, struct objfile *);
>
>  static void read_symbol (struct internal_syment *, int);
> @@ -3038,7 +3035,7 @@
>
>  static void
>  xcoff_symfile_offsets (struct objfile *objfile,
> -                      struct section_addr_info *addrs)
> +                      const struct section_addr_info *addrs)
>  {
>    const char *first_section_name;
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-06 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06 16:52 [patch] constify symfile.h section_offsets, section_addr_info Doug Evans
2013-05-06 18:37 ` Tom Tromey
2013-05-06 19:17   ` Doug Evans
2013-05-06 19:37     ` Tom Tromey
2013-05-06 19:40       ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox