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: [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order


On Sat, 02 Jun 2012 17:32:07 +0200, Joel Brobecker wrote:
> > I would also prefer to use there in all the definitions/declarations:
> > typedef int 
> >   (iterate_over_objfiles_in_search_order_cb_ftype) (struct objfile *objfile, 
> >                                                     void *cb_data);
> 
> So do I, except that it raised a question: Where should this typedef
> be located? It can't really be declared next to the only function
> that's going to use it, since this section of the code is generated
> on a loop from the data read in gdbarch.sh.

OK, why not, there is already that:
extern struct gdbarch *target_gdbarch;


> a maintenance issue where, should we delete this gdbarch method, we
> will probably forget to delete the typedef.

(a) As I do :grep -rw xxx . during such change I believe I would not miss it
and (b) it would not be the first dead source code in GDB.


Thanks,
Jan


diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 5d360af..c166352 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4245,7 +4245,7 @@ set_gdbarch_info_proc (struct gdbarch *gdbarch,
 }
 
 void
-gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, int (*cb) (struct objfile *objfile, void *cb_data), void *cb_data, struct objfile *current_objfile)
+gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->iterate_over_objfiles_in_search_order != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 8bbe0f0..7c13508 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -69,6 +69,11 @@ struct stap_parse_info;
    GDB, this global should be made target-specific.  */
 extern struct gdbarch *target_gdbarch;
 
+/* Callback type for method 'iterate_over_objfiles_in_search_order_ftype'.  */
+typedef int
+  (iterate_over_objfiles_in_search_order_cb_ftype) (struct objfile *objfile,
+                                                    void *cb_data);
+
 
 /* The following are pre-initialized by GDBARCH.  */
 
@@ -1185,8 +1190,8 @@ extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ft
    If not NULL, CURRENT_OBJFILE corresponds to the objfile being
    inspected when the symbol search was requested. */
 
-typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (struct gdbarch *gdbarch, int (*cb) (struct objfile *objfile, void *cb_data), void *cb_data, struct objfile *current_objfile);
-extern void gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, int (*cb) (struct objfile *objfile, void *cb_data), void *cb_data, struct objfile *current_objfile);
+typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile);
+extern void gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile);
 extern void set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order);
 
 /* Definition for an unknown syscall, used basically in error-cases.  */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 167eb2e..3592b82 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -947,7 +947,7 @@ M:void:info_proc:char *args, enum info_proc_what what:args, what
 #
 # If not NULL, CURRENT_OBJFILE corresponds to the objfile being
 # inspected when the symbol search was requested.
-m:void:iterate_over_objfiles_in_search_order:int (*cb) (struct objfile *objfile, void *cb_data), void *cb_data, struct objfile *current_objfile:cb, cb_data, current_objfile:0:default_iterate_over_objfiles_in_search_order::0
+m:void:iterate_over_objfiles_in_search_order:iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile:cb, cb_data, current_objfile:0:default_iterate_over_objfiles_in_search_order::0
 
 EOF
 }
@@ -1077,6 +1077,11 @@ struct stap_parse_info;
    Eventually, when support for multiple targets is implemented in
    GDB, this global should be made target-specific.  */
 extern struct gdbarch *target_gdbarch;
+
+/* Callback type for method 'iterate_over_objfiles_in_search_order_ftype'.  */
+typedef int
+  (iterate_over_objfiles_in_search_order_cb_ftype) (struct objfile *objfile,
+                                                    void *cb_data);
 EOF
 
 # function typedef's
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index daa6068..f5e5c75 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1536,7 +1536,7 @@ gdb_bfd_unref (struct bfd *abfd)
 void
 default_iterate_over_objfiles_in_search_order
   (struct gdbarch *gdbarch,
-   int (*cb) (struct objfile *objfile, void *cb_data),
+   iterate_over_objfiles_in_search_order_cb_ftype *cb,
    void *cb_data, struct objfile *current_objfile)
 {
   int stop = 0;
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 0c4f723..9f24491 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -528,7 +528,7 @@ extern int gdb_bfd_close_or_warn (struct bfd *abfd);
 
 extern void default_iterate_over_objfiles_in_search_order
   (struct gdbarch *gdbarch,
-   int (*cb) (struct objfile *objfile, void *cb_data),
+   iterate_over_objfiles_in_search_order_cb_ftype *cb,
    void *cb_data, struct objfile *current_objfile);
 
 
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 8c02294..116525c 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -420,7 +420,7 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
 void
 windows_iterate_over_objfiles_in_search_order
   (struct gdbarch *gdbarch,
-   int (*cb) (struct objfile *objfile, void *cb_data),
+   iterate_over_objfiles_in_search_order_cb_ftype *cb,
    void *cb_data, struct objfile *current_objfile)
 {
   int stop;
diff --git a/gdb/windows-tdep.h b/gdb/windows-tdep.h
index 81c460f..20bf66d 100644
--- a/gdb/windows-tdep.h
+++ b/gdb/windows-tdep.h
@@ -32,6 +32,6 @@ extern void windows_xfer_shared_library (const char* so_name,
 
 extern void windows_iterate_over_objfiles_in_search_order
   (struct gdbarch *gdbarch,
-   int (*cb) (struct objfile *objfile, void *cb_data),
+   iterate_over_objfiles_in_search_order_cb_ftype *cb,
    void *cb_data, struct objfile *current_objfile);
 #endif


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