This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC for: "Re: Regression for gdb.fortran/library-module.exp [Re: [RFA] choose symbol from given block's objfile first.]"
On Tue, 29 May 2012 18:02:01 +0200, Joel Brobecker wrote:
> > Just a gdbarch design detail - gdbarch attribute should be a real function so
> > that the default (SVR4-compatible) implementation can just ignore the
> > context_objfile parameter. The MS-Windows implementation will unconditionally
> > follow context_objfile. This will not clutter the default code with
> > MS-Windows specifics.
>
> I don't understand what you are trying to say regarding the gdbarch
> attribute. Do you mean that, instead of a yes/no integer, it should
> be a pointer to a function returning the yes/no integer?
It should be a pointer to function implementing the functionality - which
differs across platforms:
M:void:iterate_over_objfiles_in_search_order: iterate_over_objfiles_in_search_order_cb cb, void *cb_data, struct objfile *context_objfile: cb, cb_data, context_objfile
- I did not check it should be very exactly this way like m vs. M etc.
default implementation:
static void
default_iterate_over_objfiles_in_search_order
(iterate_over_objfiles_in_search_order_cb cb,
void *cb_data,
struct objfile *context_objfile)
{
int stop = 0;
struct objfile *objfile;
ALL_OBJFILES (objfile)
{
stop = cb (objfile, cb_data);
if (stop)
return;
}
}
set_gdbarch_iterate_over_objfiles_in_search_order (gdbarch, default_iterate_over_objfiles_in_search_order);
ms-windows implementation
static void
windows_iterate_over_objfiles_in_search_order
(iterate_over_objfiles_in_search_order_cb cb,
void *cb_data,
struct objfile *context_objfile)
{
int stop = 0;
struct objfile *objfile;
if (context_objfile)
{
stop = cb (context_objfile, cb_data);
if (stop)
return;
}
ALL_OBJFILES (objfile)
{
if (objfile != context_objfile)
{
stop = cb (objfile, cb_data);
if (stop)
return;
}
}
}
set_gdbarch_iterate_over_objfiles_in_search_order (gdbarch, windows_iterate_over_objfiles_in_search_order);
Thanks,
Jan