This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: relax restrictions on per-architecture data registration
Andrew Cagney <ac131313@cygnus.com> writes:
> > 2001-06-01 Jim Blandy <jimb@redhat.com>
> >
> > Expand the gdbarch per-architecture data vector as needed, rather
> > than requiring that all per-architecture data be registered before
> > the first gdbarch object is allocated.
> > * gdbarch.sh: Changes to effect the following:
> > * gdbarch.c (alloc_gdbarch_data, init_gdbarch_data): Delete
> > declarations and definitions.
> > (check_gdbarch_data): New function, and declaration.
> > (gdbarch_alloc): Don't call alloc_gdbarch_data; leaving the fields
> > zero is good enough.
> > (free_gdbarch_data): Tolerate a null data pointer. Free only
> > those data items gdbarch->data actually has allocated.
> > (set_gdbarch_data, gdbarch_data): Call check_gdbarch_data.
> > (gdbarch_update_p): No need to call init_gdbarch_data.
>
> I think this is wrong. GDB's startup sequence is currently something like:
>
> o _initialize_*() registers any
> per-architecture data
>
> o GDB creates the initial architecture
>
> So that data buffer size would never change.
>
> To follow up my previous post. All I think is needed is for the code in
> arch-utils.c:initialize_current_architecture():
>
>
> if (GDB_MULTI_ARCH)
> {
> if (! gdbarch_update_p (info))
> {
> internal_error (__FILE__, __LINE__,
> "initialize_current_architecture: Selection
> of initial architecture
> failed");
> }
> }
>
> to be tweeked so that, when there is no multi-arch, the data vector is
> still initialized.
Okay. My first patch was exactly that, but then I felt like I was
assuming that all per-architecture data would be registered by the
time initialization was done, which wasn't a documented requirement in
gdbarch.h. So I made it more dynamic.
I'll revert my patch, and post a new one shortly.