From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order
Date: Sat, 02 Jun 2012 15:49:00 -0000 [thread overview]
Message-ID: <20120602154830.GA22422@host2.jankratochvil.net> (raw)
In-Reply-To: <20120602153206.GA2659@adacore.com>
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);
\f
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
next prev parent reply other threads:[~2012-06-02 15:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 20:37 [RFA 0/3] Make global symbol objfile search order arch-dependent Joel Brobecker
2012-05-31 20:37 ` [RFA 3/3] Windows-specific iterate_over_objfiles_in_search_order Joel Brobecker
2012-06-02 13:57 ` Jan Kratochvil
2012-06-02 15:32 ` Joel Brobecker
2012-06-02 15:49 ` Jan Kratochvil [this message]
2012-06-04 4:55 ` Doug Evans
2012-06-04 13:02 ` Joel Brobecker
2012-05-31 20:37 ` [RFA 2/3] New "iterate_over_objfiles_in_search_order" gdbarch method Joel Brobecker
2012-05-31 20:37 ` [RFA/commit 1/3] Revert "Search global symbols from the expression's block objfile first." Joel Brobecker
2012-06-01 18:06 ` [RFA 0/3] Make global symbol objfile search order arch-dependent Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120602154830.GA22422@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox