From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3724 invoked by alias); 2 Jun 2012 15:49:25 -0000 Received: (qmail 3716 invoked by uid 22791); 2 Jun 2012 15:49:23 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 02 Jun 2012 15:49:00 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q52Fmawp021799 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 2 Jun 2012 11:48:36 -0400 Received: from host2.jankratochvil.net (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q52FmVs9032302 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sat, 2 Jun 2012 11:48:34 -0400 Date: Sat, 02 Jun 2012 15:49:00 -0000 From: Jan Kratochvil To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order Message-ID: <20120602154830.GA22422@host2.jankratochvil.net> References: <1338496603-5423-1-git-send-email-brobecker@adacore.com> <1338496603-5423-4-git-send-email-brobecker@adacore.com> <20120602135647.GA18163@host2.jankratochvil.net> <20120602153206.GA2659@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120602153206.GA2659@adacore.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00053.txt.bz2 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